Skip to content
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

Support gradle's verification-metadata.xml? #915

Closed
faern opened this issue Apr 12, 2024 · 5 comments · Fixed by #943
Closed

Support gradle's verification-metadata.xml? #915

faern opened this issue Apr 12, 2024 · 5 comments · Fixed by #943
Assignees
Labels
enhancement New feature or request

Comments

@faern
Copy link

faern commented Apr 12, 2024

Hi. It looks like osv-scanner only checks for gradle.lockfile and friends, not verification-metadata.xml (Gradle dependency verification), which is the only "lockfile"-like thing we have for gradle.

We currently use another tool for scanning our gradle dependency tree against NVD, and that tool works with the files we have. We would like to migrate to osv-scanner if possible. Is there any reason osv-scanner does not parse this file, or is it simply because it has not been added yet?

We currently use the following tool to scan our gradle dependency tree against NVD: https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/index.html.

Current results:

$ osv-scanner scan --lockfile android/gradle/verification-metadata.xml
could not determine extractor for /home/foobarbaz/android/gradle/verification-metadata.xml
@oliverchang oliverchang added the enhancement New feature or request label Apr 16, 2024
@oliverchang
Copy link
Collaborator

Thanks for the request! we simply have not added support for this yet.

@G-Rath is this something we can put on your plate?

@G-Rath
Copy link
Collaborator

G-Rath commented Apr 23, 2024

@faern would it be possible for you to provide a couple of examples of this file, for building test fixtures? All good if not, it'd just save me some searching if you can🙂

@faern
Copy link
Author

faern commented Apr 23, 2024

Here is our own lockfile, I can start by linking that. I'll see if I can find more examples later: https://github.com/mullvad/mullvadvpn-app/blob/main/android/gradle/verification-metadata.xml

@albin-mullvad
Copy link

albin-mullvad commented Apr 23, 2024

This would be a great addition to the tool!

Here's another one used by the official F-Droid Android Client app that also includes signature checks. Also adding a link to the script they use to generate the file:
https://gitlab.com/fdroid/fdroidclient/-/blob/master/gradle/verification-metadata.xml
https://gitlab.com/fdroid/fdroidclient/-/blob/master/gradle/update-verification-metadata.sh

And here's another used by AndroidX (Google) as well as their documentation about using it to verify their artifacts:
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:gradle/verification-metadata.xml
https://developer.android.com/jetpack/getting-started#verify_dependencies

@G-Rath
Copy link
Collaborator

G-Rath commented Apr 25, 2024

Thanks all for the samples! I'll start digging and post back here if I have any questions :)

cuixq pushed a commit that referenced this issue May 23, 2024
This adds support for parsing `gradle/verification-metadata.xml` files -
since this seems to be like an actual lockfile it's very
straightforward: we just parse the file as XML and extract out the name
+ version of "component".

The interesting part of this is that unlike other project-relative
lockfiles this file currently must exist in the `gradle` directory which
raises questions about how `--recursive` comes into play previously we'd
not enabled APK and DPKG checking by default but I feel that was more
because they were absolute paths and so didn't make sense to do when
people were scanning in "project mode".

For now I've just taken the simple route of making the file
`gradle/verification-metadata.xml` since that does just work (except for
the "find parser" flow which checks against `path.Base` so that has the
`gradle` omitted).

Resolves #915
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants