-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(image): add Sigstore bundle SBOM support #9516
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
base: main
Are you sure you want to change the base?
Conversation
Add support for extracting DSSE payloads from Sigstore bundles when processing OCI referrer SBOMs. This enables Trivy to handle SBOM attestations created with newer Cosign versions that use the bundle format. - Add extractDSSEFromSigstoreBundle method to parse Sigstore bundles - Update parseReferrer to handle Sigstore bundle artifact type - Add SigstoreBundleArtifactType constant and include in supported types - Includes test coverage with test data files
|
I just saw that it might be a bit cleaner to add a "SigstoreBundle" as a Pseudo SBOM format such as the DSSE -> In-toto -> CycloneDx wrapper here Happy to change the implementation if that would be preferred. |
| } | ||
| defer os.Remove(dsseFilePath) | ||
| filePath = dsseFilePath | ||
| fmt.Printf("DEBUG: Extracted DSSE to file: %s\n", dsseFilePath) |
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.
you can use a.logger.Debug
| tmpFile.Close() | ||
| os.Remove(tmpFile.Name()) | ||
| return "", xerrors.Errorf("failed to write DSSE envelope: %w", err) | ||
| } | ||
| if err = tmpFile.Close(); err != nil { | ||
| os.Remove(tmpFile.Name()) | ||
| return "", xerrors.Errorf("failed to close temp file: %w", err) | ||
| } |
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.
Can we use defer for this?
| MediaType string `json:"mediaType"` | ||
| } | ||
|
|
||
| func (a Artifact) extractDSSEFromSigstoreBundle(bundlePath string) (string, error) { |
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.
Can we use temp dir from parseReferrer?
Description
Add support for extracting DSSE payloads from Sigstore bundles when processing OCI referrer SBOMs. This enables Trivy to handle SBOM attestations created with newer Cosign versions that use the new sigstore bundle format.
Related issues
Checklist
I've added usage information (if the PR introduces new options)I've included a "before" and "after" example to the description (if the PR is a user interface change).