-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[CWE-925] Intent verification is only needed on non-empty onReceive methods. #18907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
egregius313
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @teuron,
Thank you for the contribution.
I think this change is better suited for the UnverifiedOnReceiveMethod class in java/ql/lib/semmle/code/java/security/ImproperIntentVerificationQuery.qll like so:
UnverifiedOnReceiveMethod() {
- not VerifiedIntentFlow::flow(DataFlow::parameterNode(this.getIntentParameter()), _)
+ not VerifiedIntentFlow::flow(DataFlow::parameterNode(this.getIntentParameter()), _) and
+ // Empty methods do not need to be verified since they do not perform any actions.
+ this.getBody().getNumStmt() > 0
}Adding it there will update any other location where unverifiedSystemReceiver is used, such as in the tests.
For testing this change, it would make sense to add an empty receiver to the test files (and AndroidManifest) in java/ql/test/query-tests/security/CWE-925.
Finally, this will need a minorAnalysis change note (guide here).
Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
java/ql/src/change-notes/2025-03-03-fix-improper-intent-verification-query.md
Outdated
Show resolved
Hide resolved
…cation-query.md Co-authored-by: Edward Minnix III <egregius313@github.com>
The intent verification is currently triggering on empty
onReceivemethods likewhich is not needed and leads to false positives.