Skip to content

feat: artifactType support in signature manifest #542

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Two-Hearts
Copy link
Contributor

@Two-Hearts Two-Hearts commented Apr 27, 2025

This PR is an implementation of the Notary Project spec notaryproject/specifications#325.

Resolves #540

Copy link

codecov bot commented Apr 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.31%. Comparing base (02cc632) to head (c48e8ad).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #542      +/-   ##
==========================================
+ Coverage   80.92%   81.31%   +0.38%     
==========================================
  Files          36       36              
  Lines        3355     3350       -5     
==========================================
+ Hits         2715     2724       +9     
+ Misses        493      483      -10     
+ Partials      147      143       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Copy link
Contributor

@JeyJeyGao JeyJeyGao left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +244 to +256
if image.ArtifactType == ArtifactTypeNotation && image.Config.MediaType == ocispec.MediaTypeEmptyJSON {
// 1. artifactType is "application/vnd.cncf.notary.signature",
// and config.mediaType is "application/vnd.oci.empty.v1+json"
node.ArtifactType = image.ArtifactType
} else if image.ArtifactType == "" && image.Config.MediaType == ArtifactTypeNotation {
// 2. artifacteType does not exist,
// and config.mediaType is "application/vnd.cncf.notary.signature"
node.ArtifactType = image.Config.MediaType
} else {
// not a valid Notary Project signature
logger.Infof("not a valid Notary Project signature with artifactType %q and config.mediaType %q", image.ArtifactType, image.Config.MediaType)
continue
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It is better to have a switch statement on image.ArtifactType.

Note: node is not always a Notary Project signature. It can be a SBoM or other artifacts. We should not have info log for those artifacts.

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.

Add support of artifactType under signature manifest
3 participants