-
Notifications
You must be signed in to change notification settings - Fork 44
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. 🚀 New features to boost your workflow:
|
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]>
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.
LGTM
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 | ||
} |
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.
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.
This PR is an implementation of the Notary Project spec notaryproject/specifications#325.
Resolves #540