From 2969e58bb2ef5423ac95fefc7a23b50a7735ca22 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 31 Jan 2026 22:48:52 +0000 Subject: [PATCH 1/2] Initial plan From 22afcd3e3722fca9e819cb416a54f8fde2defb3a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 31 Jan 2026 22:56:29 +0000 Subject: [PATCH 2/2] Add MASTG content for Android 16 accessibilityDataSensitive feature - Created Knowledge page MASTG-KNOW-0108 for accessibilityDataSensitive - Created Best Practice MASTG-BEST-0029 for marking UI views as sensitive - Created Test MASTG-TEST-0321 for static detection - Created Test MASTG-TEST-0322 for dynamic verification - Created Demo MASTG-DEMO-0083 demonstrating detection with semgrep - Created semgrep rule for static analysis Co-authored-by: cpholguera <29175115+cpholguera@users.noreply.github.com> --- best-practices/MASTG-BEST-0029.md | 110 ++++++++++++++++++ .../MASTG-DEMO-0083/MASTG-DEMO-0083.md | 72 ++++++++++++ .../MASTG-DEMO-0083/MastgTest.kt | 35 ++++++ .../MASTG-DEMO-0083/activity_login.xml | 51 ++++++++ .../MASVS-PLATFORM/MASTG-DEMO-0083/output.txt | 60 ++++++++++ .../MASVS-PLATFORM/MASTG-DEMO-0083/run.sh | 12 ++ .../android/MASVS-PLATFORM/MASTG-KNOW-0108.md | 88 ++++++++++++++ ...-android-accessibility-data-sensitive.yaml | 88 ++++++++++++++ .../android/MASVS-PLATFORM/MASTG-TEST-0321.md | 67 +++++++++++ .../android/MASVS-PLATFORM/MASTG-TEST-0322.md | 68 +++++++++++ 10 files changed, 651 insertions(+) create mode 100644 best-practices/MASTG-BEST-0029.md create mode 100644 demos/android/MASVS-PLATFORM/MASTG-DEMO-0083/MASTG-DEMO-0083.md create mode 100644 demos/android/MASVS-PLATFORM/MASTG-DEMO-0083/MastgTest.kt create mode 100644 demos/android/MASVS-PLATFORM/MASTG-DEMO-0083/activity_login.xml create mode 100644 demos/android/MASVS-PLATFORM/MASTG-DEMO-0083/output.txt create mode 100755 demos/android/MASVS-PLATFORM/MASTG-DEMO-0083/run.sh create mode 100644 knowledge/android/MASVS-PLATFORM/MASTG-KNOW-0108.md create mode 100644 rules/mastg-android-accessibility-data-sensitive.yaml create mode 100644 tests-beta/android/MASVS-PLATFORM/MASTG-TEST-0321.md create mode 100644 tests-beta/android/MASVS-PLATFORM/MASTG-TEST-0322.md diff --git a/best-practices/MASTG-BEST-0029.md b/best-practices/MASTG-BEST-0029.md new file mode 100644 index 00000000000..f597f38536d --- /dev/null +++ b/best-practices/MASTG-BEST-0029.md @@ -0,0 +1,110 @@ +--- +title: Marking UI Views as Containing Sensitive Data +alias: marking-ui-views-sensitive-data +id: MASTG-BEST-0029 +platform: android +knowledge: [MASTG-KNOW-0108] +available_since: 35 +--- + +## Overview + +Starting with Android 16 (API level 35), developers should mark sensitive UI views using the [`accessibilityDataSensitive`](https://developer.android.com/reference/android/view/View#attr_android:accessibilityDataSensitive) attribute to protect against malicious accessibility services. This protection prevents unauthorized apps with accessibility permissions from reading sensitive view content or performing interactions unless they are declared as legitimate accessibility tools via [`isAccessibilityTool`](https://developer.android.com/reference/android/accessibilityservice/AccessibilityServiceInfo#FLAG_ACCESSIBILITY_TOOL). + +## Recommendation + +Apply `accessibilityDataSensitive="true"` to views that handle or display sensitive information, such as: + +- Login screens (username and password fields) +- Payment and transaction confirmation screens +- Personal information forms (SSN, credit card numbers, etc.) +- Two-factor authentication inputs +- Biometric authentication prompts +- Any view displaying confidential user data + +### XML Implementation + +```xml + + +