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

Should only check maven central if pom info is missing #2216

Open
wagoodman opened this issue Oct 28, 2024 · 3 comments
Open

Should only check maven central if pom info is missing #2216

wagoodman opened this issue Oct 28, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@wagoodman
Copy link
Contributor

Today when you enable searching for artifact and group ID from maven central with a sha1 then this is done for all java artifacts, not just ones missing artifact and group ID

if metadata, ok := p.Metadata.(pkg.JavaMetadata); ok {
for _, digest := range metadata.ArchiveDigests {
if digest.Algorithm == "sha1" {
indirectPackage, err := m.GetMavenPackageBySha(digest.Value)
if err != nil {
. This condition should be tightened -- instead of always searching, we should only search if there is missing pom data.

@wagoodman wagoodman added the bug Something isn't working label Oct 28, 2024
@wagoodman wagoodman moved this to Ready in OSS Oct 28, 2024
@kzantow
Copy link
Contributor

kzantow commented Oct 30, 2024

Should we move this functionality to Syft, as part of the family of --enrichments? Looking up package info via archive hash seems like something that would benefit both tools.

@wagoodman
Copy link
Contributor Author

I think we should do this in both places, since there are multiple avenues. That is, agreed, this should be in syft as an opt in enrichment option. But in case you're using an non-syft SBOM or otherwise different input source with grype then we should still allow for looking up this information.

@kzantow
Copy link
Contributor

kzantow commented Oct 31, 2024

This seems like one of the things that could be done strictly during an "enhancement" phase in Syft, which Grype also runs. In other words:

First, Syft scans, finds JAR files, attempts to identify using bytes available, surfaces packages with all info including SHA-1 hashes for JARs
-- OR --
Syft imports an SBOM into the internal Syft data model

Then, Syft passes found packages to enhancement

This would have to happen before compliance rules are applied.

I think this would allow Grype to essentially operate the same as it does today and allow Syft to get the benefit of updating the certain incomplete Java records.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Ready
Development

No branches or pull requests

2 participants