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

If SBOM ref has .json suffix, assume JSON mediatype #1859

Merged
merged 1 commit into from
May 11, 2022

Conversation

jdolitsky
Copy link
Contributor

When attaching a CycloneDX SBOM:

$ cosign attach sbom --type=cyclonedx --sbom=./sbom.json example.com/testing123:v0.1.0
WARNING: Attaching SBOMs this way does not sign them. If you want to sign them, use 'cosign attest -predicate ./myclone.json -key <key path>' or 'cosign sign -key <key path> <sbom image>'.
Uploading SBOM file for [example.com/testing123:v0.1.0] to [example.com/testing123:v0.1.0:sha256-*****.sbom] with mediaType [application/vnd.cyclonedx+xml].

The mediatype defaults to application/vnd.cyclonedx+xml, even though the incoming SBOM path has a .json extension.

This PR tries to help make a more educated guess as to the proper mediatype to use.

Signed-off-by: Josh Dolitsky <josh@dolit.ski>
@codecov-commenter
Copy link

codecov-commenter commented May 10, 2022

Codecov Report

Merging #1859 (3e05e82) into main (7a3c04f) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #1859      +/-   ##
==========================================
- Coverage   33.44%   33.43%   -0.02%     
==========================================
  Files         146      146              
  Lines        9340     9344       +4     
==========================================
  Hits         3124     3124              
- Misses       5843     5847       +4     
  Partials      373      373              
Impacted Files Coverage Δ
cmd/cosign/cli/options/attach.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a3c04f...3e05e82. Read the comment docs.

Copy link
Contributor

@hectorj2f hectorj2f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@hectorj2f
Copy link
Contributor

Perhaps we could do the same with xml sbom files.

@dlorenc dlorenc merged commit 471dde0 into sigstore:main May 11, 2022
@github-actions github-actions bot added this to the v1.9.0 milestone May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants