Skip to content

Add Android MASTG Test, Demo, Knowledge and Best Practice for AndroidX Security State - #4004

Draft
cpholguera with Copilot wants to merge 2 commits into
masterfrom
copilot/add-test-demo-know-best-for-security-state
Draft

cpholguera with Copilot wants to merge 2 commits into
masterfrom
copilot/add-test-demo-know-best-for-security-state

Conversation

Copilot AI commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Adds MASTG content for the AndroidX Security State library (androidx.security:security-state), which reports per-component patch compliance and update availability beyond Build.VERSION.SECURITY_PATCH. It does not cover device authenticity or tampering; Play Integrity is needed for that.

All IDs are drafting placeholders (0x01). Real IDs need to be assigned after review.

  • Knowledge (MASTG-KNOW-0x01, MASVS-CODE)
    • Describes SecurityStateManager and SecurityPatchState, the vulnerability report feed, and the library's scope.
  • Best practice (MASTG-BEST-0x01)
    • Check the per-component security state before sensitive flows, enforce the decision on the backend, handle report-load failures explicitly, and pair the check with Play Integrity.
  • Test (MASTG-TEST-0x01, static)
    • Looks for Security State API usage and Build.VERSION.SECURITY_PATCH reads. It fails if the APIs are absent or their result is never evaluated.
    • Tagged MASWE-0077, chosen from memory because the MASWE list isn't in the repo. Please confirm.
  • Rule (rules/mastg-android-device-security-state.yml)
    • Semgrep inventory rule (INFO) for the same APIs.
  • Demo (MASTG-DEMO-0x01)
    • A sample that calls the APIs but ignores the result, so the test fails.
    • output.txt is real semgrep output (5 findings) from running the rule on MastgTest_reversed.java.
val manager = SecurityStateManager(context)
manager.getGlobalSecurityState()
val updated = SecurityPatchState(context).isDeviceFullyUpdated()
// result only returned to the UI, never used to gate anything

For reviewers

  • I couldn't reach the Android docs from the sandbox, so the API names come from memory. Please check them against the docs.
  • MastgTest_reversed.java is hand-written, not decompiled from a built APK.
  • The Kotlin sample hasn't been built or run on a device, and the demo doesn't yet record platform version, IDE version or device.

Co-authored-by: cpholguera <29175115+cpholguera@users.noreply.github.com>
Copilot AI changed the title [WIP] Add new TEST, DEMO, KNOW, and BEST entries for Security State Add Android MASTG Test, Demo, Knowledge and Best Practice for AndroidX Security State Oct 1, 2026
Copilot AI requested a review from cpholguera October 1, 2026 18:28

This branch has not been deployed

No deployments
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.

Add a new Test, Demo, Know and Best for Security State

2 participants