-
Notifications
You must be signed in to change notification settings - Fork 607
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
Add java.Matcher configuration to includes maven upstream sha1 query #714
Conversation
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
7fd3f09
to
b5c98f1
Compare
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
8323017
to
2884e42
Compare
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
2884e42
to
c3b3276
Compare
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
@@ -9,8 +9,8 @@ require ( | |||
github.com/anchore/go-testutils v0.0.0-20200925183923-d5f45b0d3c04 | |||
github.com/anchore/go-version v1.2.2-0.20210903204242-51efa5b487c4 | |||
github.com/anchore/packageurl-go v0.1.1-0.20220314153042-1bcd40e5206b | |||
github.com/anchore/stereoscope v0.0.0-20220330165332-7fc73ee7b0f0 | |||
github.com/anchore/syft v0.43.0 |
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.
Update on next syft release
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.
Only other thing I'll note at the moment is that we'll probably want to update the README with this one. Removing global state is MEGA-👍, though!
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
08bc8c6
to
ab786ce
Compare
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
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.
great maven search addition, and love that this paves the way to exposing user-configuration for matchers in the future
internal/config/datasources.go
Outdated
|
||
func (cfg externalSources) loadDefaultValues(v *viper.Viper) { | ||
v.SetDefault("external-sources.enable", false) | ||
v.SetDefault("external-sources.maven.search-maven-upstream", false) |
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.
nit: since we have the master switch (which is great) we could have the maven search option default to on
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.
I strongly +1 this
internal/config/datasources.go
Outdated
} | ||
|
||
type maven struct { | ||
SearchMavenUpstream bool `yaml:"search-maven-upstream" json:"search_maven_upstream" mapstructure:"search-maven-upstream"` |
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.
nit: the full config path stutters: external-sources.maven.search-maven-upstream
with maven
showing up twice.
maybe rename the field to search-upstream
? Or more descriptive to the what or how of the operation, such as search-by-sha1
or find-artifact-group-id
(not saying these suggestions are necessarily better, but wanted to give an idea)
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.
Yea nice suggestion. I'll update the config here.
TODO before merge and thanks for the 🟢 @wagoodman and @kzantow :
|
@spiffcs I'd like to see two more things:
|
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Still debugging these env variables |
@kzantow this should work for you |
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
dab92ea
to
56bbeff
Compare
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
Add Grype Matcher configuration for upstream maven query based on SHA1
Syft is now able to generate
sha1
digests for discovered java archives. These digests are included along with the java archive metadata output.anchore/syft#941
This PR adds the ability for the user to configure the
java.Matcher
to query the maven upstream repository for additional data that may not be present at time of SBOM generation.Specifically, sboms of java archives are sometimes limited in their details when
pom.xml
orpom.properties
are not present at the time of analysis. Queryingmaven
given an archives sha1 digest value allows users to add fidelity to their vulnerability report when matching against data not relying on CPE generation (GHSA or GL Advisory Database).It should be noted that a NEW package is not generated for the grype output. Matches found with this method are assigned directly to the java package that presented the sha1 for search. No duplication should be caused from doing this additional query.
The
.grype.yaml
configuration has been updated to include the following block:Features added
TODO
Demo
Disabled - 606 vulnerabilities reported:

Enabled - 682 vulnerabilities reported:

Yardstick Analysis vs current release and branch:
This shows all of the additional vulnerabilities captured when enabling upstream matching:
None of these findings appear to be FP and can all be accurately attributed to the image.
What's interesting here is that after running yardstick the new branch shows
22
new vulnerabilities reported. The output of the respective commands (current release vs branch) shows a difference of76
when comparing theScanned image [xxx vulnerabilities]
field (606 vs 682). This disparity has been found to be related to additionalrelatedVulnerabiities
being populated as a result of enabling the upstream source. When searching by sha and matching withGHSA
is also will generate a newrelatedVulnerability
for theNVD source
. New vulnerabilities PLUS packages that can now be found via the GHSA and not just CPE account for this increase in the output.I have found that the branch results will overwrite
exact-direct-match
withexact-indirect-match
if a vulnerability is found upstream via the checksum search.Signed-off-by: Christopher Phillips christopher.phillips@anchore.com