Skip to content

Conversation

cpholguera
Copy link
Collaborator

@cpholguera cpholguera commented Sep 6, 2025

This PR updates test and documentation for screenshot prevention in Android, adding comprehensive coverage for FLAG_SECURE, setRecentsScreenshotEnabled, and Compose dialog security. It provides new guidance for identifying sensitive screens and handling recents screenshots on Android 13+.

  • Expanded test documentation with detailed guidelines for UI components, SurfaceViews, and Compose dialogs
  • Added new semgrep rules for detecting improper FLAG_SECURE usage and recents screenshot handling
  • Created comprehensive demo examples showing both correct and incorrect implementations
File Description
knowledge/android/MASVS-STORAGE/MASTG-KNOW-0053.md Updated with system vs user-initiated screenshot distinctions
prerequisites/identify-sensitive-screens.md New guidance for identifying screens requiring screenshot protection
best-practices/MASTG-BEST-0014.md Updated with comprehensive screenshot prevention guidance
tests-beta/android/MASVS-PLATFORM/MASTG-TEST-0291.md Expanded with detailed guidelines for FLAG_SECURE usage across different UI components
rules/mastg-android-sensitive-data-in-screenshot.yml Added new detection rules for FLAG_SECURE clearing and recents screenshot control
demos/android/MASVS-PLATFORM/MASTG-DEMO-0061/ Enhanced demo showing FLAG_SECURE setting and clearing patterns
demos/android/MASVS-PLATFORM/MASTG-DEMO-0062/ New demo for recents screenshot control via setRecentsScreenshotEnabled
demos/android/MASVS-PLATFORM/MASTG-DEMO-0063/ New demo for Compose dialog security policies

…stem-generated and user-initiated snapshots, and their security implications.
…ks of screenshots, screen recordings, and nonsecure displays, while emphasizing the use of FLAG_SECURE for enhanced security.
…DEMO-0061

- Revise title and sample description to clarify the use of FLAG_SECURE in Activities and Dialogs.
- Enhance the implementation in `MastgTest.kt` to demonstrate setting and clearing FLAG_SECURE for both Activity and Dialog.
- Update `MastgTest_reversed.java` to reflect changes in the FLAG_SECURE handling.
- Modify output.txt to include multiple code findings related to FLAG_SECURE usage.
…etailed guidelines for FLAG_SECURE and Recents screenshot handling in Android 13+
@cpholguera cpholguera requested a review from Copilot September 6, 2025 09:10
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates test and documentation for screenshot prevention in Android, adding comprehensive coverage for FLAG_SECURE, setRecentsScreenshotEnabled, and Compose dialog security. It provides new guidance for identifying sensitive screens and handling recents screenshots on Android 13+.

  • Expanded test documentation with detailed guidelines for UI components, SurfaceViews, and Compose dialogs
  • Added new semgrep rules for detecting improper FLAG_SECURE usage and recents screenshot handling
  • Created comprehensive demo examples showing both correct and incorrect implementations

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests-beta/android/MASVS-PLATFORM/MASTG-TEST-0291.md Expanded with detailed guidelines for FLAG_SECURE usage across different UI components
rules/mastg-android-sensitive-data-in-screenshot.yml Added new detection rules for FLAG_SECURE clearing and recents screenshot control
prerequisites/identify-sensitive-screens.md New guidance for identifying screens requiring screenshot protection
knowledge/android/MASVS-STORAGE/MASTG-KNOW-0053.md Updated with system vs user-initiated screenshot distinctions
demos/android/MASVS-PLATFORM/MASTG-DEMO-0061/ Enhanced demo showing FLAG_SECURE setting and clearing patterns
demos/android/MASVS-PLATFORM/MASTG-DEMO-0062/ New demo for recents screenshot control via setRecentsScreenshotEnabled
demos/android/MASVS-PLATFORM/MASTG-DEMO-0063/ New demo for Compose dialog security policies
best-practices/MASTG-BEST-0014.md Updated with comprehensive screenshot prevention guidance

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@cpholguera cpholguera requested a review from Copilot September 19, 2025 06:47
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 34 out of 34 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

cpholguera and others added 2 commits September 19, 2025 09:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant