Skip to content

Conversation

bananabr
Copy link
Contributor

The method signature for the Android Logger methods in the java/ql/src/experimental/semmle/code/java/Logging.qll is wrong and prevents the proper identification of sensitive data logging in Android applications.

@bananabr bananabr requested a review from a team as a code owner September 16, 2021 16:31
@github-actions github-actions bot added the Java label Sep 16, 2021
@bananabr
Copy link
Contributor Author

bananabr commented Sep 16, 2021

Would a fix like this be a candidate for the One-For-All program?
I found many vulnerable Android apps in LGTM using this fix that were not previously covered by the current query but I am not sure if a fix meets the "improve an existing query and extend its coverage " requirement.

Simplified using a set-literal as suggested by @intrigus-lgtm
Comment on lines 36 to 37
m.getDeclaringType().getASourceSupertype*() = t or
m.getDeclaringType().extendsOrImplements*(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

These seem like they're saying the same thing, are you aware of a case that means you need both?

Copy link
Contributor Author

@bananabr bananabr Sep 16, 2021

Choose a reason for hiding this comment

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

To be honest I just tried to keep this as close to the originally approved query as possible. Why are these both required in lines 24 and 25? My understanding is also that they are equivalent.

Copy link
Contributor

Choose a reason for hiding this comment

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

There are some differences in relation to generics, in particular how these relations deal with parameterizations, raw types, type variables, and wildcard types. But for something simple like this case, then I expect them to be equivalent (with some possible caveats if there are generic subclasses of android.util.Log).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just realized the Log class in Android is final, so neither is required. I will push the update in a minute.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I simplified the query considering the fact the Log class is final. All my test results remained the same.

@bananabr
Copy link
Contributor Author

Would a fix like this be a candidate for the One-For-All program?
I found many vulnerable Android apps in LGTM using this fix that were not previously covered by the current query but I am not sure if a fix meets the "improve an existing query and extend its coverage " requirement.

Can someone, please, answer this question? I just want to know if fixes like this one are in scope for the One-for-All program. If the are, I will take the time to submit the required issue. I also would like to mention that I really like codeQL so I will keep contributing to the code any chance I have.

Kudos to the team

@intrigus-lgtm
Copy link
Contributor

Would a fix like this be a candidate for the One-For-All program?
I found many vulnerable Android apps in LGTM using this fix that were not previously covered by the current query but I am not sure if a fix meets the "improve an existing query and extend its coverage " requirement.

Can someone, please, answer this question? I just want to know if fixes like this one are in scope for the One-for-All program.

(NOTE: I'm not affiliated with lgtm.com or the codeql team in any way)

I'd say that this PR should be eligible.
This PR also "only" fixes the detection of an existing query: https://github.com/github/codeql/pull/5349/files#diff-e703c1a656e7f606993e8939b636c98943fe2f46eb6b121fb67444fd8c104b3f
So there is some precedent for such PRs.

And per the bounty rules:

Write a CodeQL query that models a vulnerability class not currently covered by the current queries, or improve an existing query and extend its coverage to detect additional vulnerabilities.

So if you

find at least one CVE that was not previously found by an existing query

it should indeed be eligible.

It might also make sense to add tests for the Logging.qll file, because it seems as if the original PR did not add tests (but I also did not look into it too much).

@smowton smowton merged commit 3123abf into github:main Sep 22, 2021
@smowton
Copy link
Contributor

smowton commented Sep 22, 2021

Sorry I didn't notice the question; yes in principle I think it's eligible though I imagine the bounty would be smaller than most due to the low technical difficulty of the fix. However there's no harm in submitting an application!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants