Skip to content

fix(analysis): include sdk-23 permissions in get_permissions - #117

Open
Manny7717 wants to merge 1 commit into
Exodus-Privacy:v1from
Manny7717:fix/sdk23-permissions
Open

Manny7717 wants to merge 1 commit into
Exodus-Privacy:v1from
Manny7717:fix/sdk23-permissions

Conversation

@Manny7717

Copy link
Copy Markdown

What

StaticAnalysis.get_permissions() delegates to androguard's APK.get_permissions(), which only returns plain <uses-permission> entries. Permissions gated behind <uses-permission-sdk-23> (the standard declaration for Android 14+ permissions like FOREGROUND_SERVICE and its typed variants, REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, ...) were therefore silently dropped from every analysis.

Fixes Exodus-Privacy/exodus#698.

Reproduction

Downloaded two Zerion builds from F-Droid and compared the parsed permission list against the F-Droid package page:

APK Before (androguard get_permissions()) F-Droid listing After (this PR)
com.professor.zerion_30300.apk (3.0.3) 16 21 21
com.professor.zerion_20007.apk (2.0.7) 13 19 19

The raw manifest contains the same 5 extra declarations as <uses-permission-sdk-23> in both builds (2.0.7 additionally has FOREGROUND_SERVICE_PHONE_CALL), confirmed with two independent parsers (androguard 4.1.1 and pyaxmlparser) — both return only the plain <uses-permission> set, while the actual element count in the binary manifest is higher.

Change

get_permissions() now walks the manifest XML directly and collects uses-permission, uses-permission-sdk-23 and uses-permission-sdk-m entries, deduplicated and in manifest order. No behavior change for apps that only use plain <uses-permission> (the resulting list is identical to the previous one).

Tests

  • Added TestPermissions (4 cases) covering: sdk-23 and plain permissions, sdk-m, deduplication, manifest order.
  • Regression-proven: the new tests fail against the previous implementation and pass with it.
  • Full existing suite: python -m unittest discover -s exodus_core -p "test_*.py" → 13/13 OK.
  • flake8 clean on both changed files.

Android 14+ permissions such as FOREGROUND_SERVICE and its typed
variants are declared in the manifest with <uses-permission-sdk-23>,
which androguard's APK.get_permissions() ignores. As a result these
permissions never appeared on reports even though the app requests
them (e.g. Exodus-Privacy/exodus#698).

Walk the manifest XML directly and collect uses-permission,
uses-permission-sdk-23 and uses-permission-sdk-m entries, deduplicated
and in manifest order.
@codeurimpulsif codeurimpulsif added the AI Slop This PR may contain AI generated code/text slop label Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Slop This PR may contain AI generated code/text slop

Development

Successfully merging this pull request may close these issues.

[Bug] Failure to detect some permissions

2 participants