-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(sbom): use group field for jar in cyclonedx #4674
feat(sbom): use group field for jar in cyclonedx #4674
Conversation
func getPackageName(typ string, component cdx.Component) string { | ||
// Jar uses `Group` field for `GroupID` | ||
if typ == packageurl.TypeMaven && component.Group != "" { | ||
return fmt.Sprintf("%s:%s", component.Group, component.Name) | ||
} | ||
return component.Name | ||
} |
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 think it should be done here. What do you think?
Lines 73 to 85 in df61fd4
if p.Type == packageurl.TypeMaven || p.Type == ftypes.Gradle { | |
// Maven and Gradle packages separate ":" | |
// e.g. org.springframework:spring-core | |
pkg.Name = strings.Join([]string{ | |
p.Namespace, | |
p.Name, | |
}, ":") | |
} else { | |
pkg.Name = strings.Join([]string{ | |
p.Namespace, | |
p.Name, | |
}, "/") | |
} |
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.
Or is PURL missing groupID?
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.
we use component.Name after this PR - https://github.com/aquasecurity/trivy/pull/4306/files#diff-caf585364b1a95f5cb5dbda210a5ca931fad058915ba586540c8aa32a7883311R346
But maybe it's better to use the purl name for jars
. Wdyt?
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.
Oh, I just remember the change. OK, so we can go with your change.
Description
Maven and Gradle CycloneDX plugins use Group field for
GroupID
.#4669
#4635
We need to add support of this case.
Also split
GroupID
andArtifactID
bygroup
andname
fields.Related Issues
Checklist