Repository navigation
Name each patched package as a VEX product so Trivy and Grype match it - #2243
Draft
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Draft
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Conversation
`socket-patch vex` named only the project as each statement's product, with the patched packages as subcomponents. Trivy and Grype look a finding up by the package's own PURL, so the document suppressed nothing in either scanner. Each statement now keeps the project product first, unchanged, and names every package again as a product of its own: by its PURL, without qualifiers, and for a gem built for a platform other than `ruby` as `name@version-platform`, which is how Grype and Syft report it. A form that would stand for packages of one vulnerability with different statuses (a patched and an `affected` build of one gem) is left out, so the scanner keeps reporting the finding. Checked with Trivy 0.76.2 and Grype 0.122.1 on an npm project with 10 patched packages: the document now hides 13 patched findings in hosted mode and 12 in vendored mode in both scanners, where it hid none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
socket-patch vexnames only the project as each statement's product, with the patched packages as subcomponents. Trivy and Grype look a finding up by the package's own PURL, so the document suppresses nothing in either scanner.Change
products[0].subcomponentssee the same packages as before.platformis notruby,pkg:gem/<name>@<version>-<platform>, which is how Grype and Syft report it. Trivy reports it with no platform.affectedbuild of one gem. The scanner then keeps reporting that finding.--productoverride is not repeated.CLI_CONTRACT.md(Statement products),docs/usage.md(withtrivy/grypecommands) and the Bazel example indocs/ecosystems.mdare updated.Testing
Unit tests cover native gems,
platform=ruby, a shared form with mixed statuses, a shared form with all builds patched, and the product override.Updated the conformance tests,
e2e_vex,e2e_embedded_vexand the Bazel harness, which compared the wholeproductsarray.Ran every
vex::core test plus thevex,e2e_vex*andcli_parse_vextest binaries. All pass.cargo clippy --locked --workspace --all-features -- -D warningsis clean.The release binary was run on an npm project with 10 hosted patches and on the same project vendored, then scanned with Trivy 0.76.2 (
fs --vex) and Grype 0.122.1 (dir: --vex):A native-gem statement with all three forms hides the finding in both scanners.
Before ready
/code-review highon this diff.🤖 Generated with Claude Code