Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose access to EXTRA_IS_SENSITIVE for setString on Android #222

Open
mmmcloughlin opened this issue Jan 24, 2024 · 0 comments
Open

Expose access to EXTRA_IS_SENSITIVE for setString on Android #222

mmmcloughlin opened this issue Jan 24, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@mmmcloughlin
Copy link

Describe the Feature

Starting with Android 13, the system will display any text that is copied in a popover UI on the user's screen. If the user has copied sensitive content (such as a password), this can lead to sensitive data exposure.
To mitigate this risk factor, Android 13 introduces a new flag, EXTRA_IS_SENSITIVE, that can be applied to data copied to the clipboard. If this flag is applied, the system will treat the data copied to the clipboard as sensitive and will refrain from displaying it on the user's screen.

Possible Implementations

ClipboardModule.java needs the following added before setPrimaryClip in setString. This could be an optional flag passed to setString

public void setString(String text, Boolean isSensitive) {
  try {
    ClipData clipdata = ClipData.newPlainText(null, text);
    
    if (isSensitive) {
      PersistableBundle extras = new PersistableBundle();
      extras.putBoolean("android.content.extra.IS_SENSITIVE", true);
      clipdata.getDescription().setExtras(extras);
    }
    ...

Related Issues

@mmmcloughlin mmmcloughlin added the enhancement New feature or request label Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant