Repository navigation
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
StaticAnalysis.get_permissions()delegates to androguard'sAPK.get_permissions(), which only returns plain<uses-permission>entries. Permissions gated behind<uses-permission-sdk-23>(the standard declaration for Android 14+ permissions likeFOREGROUND_SERVICEand 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:
get_permissions())com.professor.zerion_30300.apk(3.0.3)com.professor.zerion_20007.apk(2.0.7)The raw manifest contains the same 5 extra declarations as
<uses-permission-sdk-23>in both builds (2.0.7 additionally hasFOREGROUND_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 collectsuses-permission,uses-permission-sdk-23anduses-permission-sdk-mentries, 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
TestPermissions(4 cases) covering: sdk-23 and plain permissions, sdk-m, deduplication, manifest order.python -m unittest discover -s exodus_core -p "test_*.py"→ 13/13 OK.flake8clean on both changed files.