feat: add primitive support for verify subject on local oci-store #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Test:
I use a local oci layout as the store to test the verify command. I built an image which is signed by Notation.
The command to verify it:
config.json:
{ "name": "notation-verifier-1", "trustPolicyDoc": { "version": "1.0", "trustPolicies": [ { "name": "default", "registryScopes": [ "*" ], "signatureVerification": { "level": "strict" }, "trustStores": [ "ca:ratify2" ], "trustedIdentities": [ "*" ] } ] }, "trustStorePath": "/home/libinbin/.config/notation" }Note: the succeeded at root level is always false as we didn't set up the policy enforcer.
Validation result:
{ "succeeded": false, "artifactReports": [ { "subject": "oci-layout2/local-oci-layout@sha256:f2502800f0663995420b13214a0d20eae1ec9a3c072f99c462cef0132a684556", "artifact": "oci-layout2/local-oci-layout@sha256:8b9494d734b2c878eab7b4b5e21e7b13b93e10f564e3d2b382294c15cc711a08", "artifactType": "application/vnd.cncf.notary.signature", "results": [ { "succeeded": false, "verifierName": "notation-verifier-1", "verifierType": "notation", "detail": "signature is not produced by a trusted signer" } ], "artifactReports": null }, { "subject": "oci-layout2/local-oci-layout@sha256:f2502800f0663995420b13214a0d20eae1ec9a3c072f99c462cef0132a684556", "artifact": "oci-layout2/local-oci-layout@sha256:b3f6395ff2389b13a33f709f4e527530f16275d483b40a6a2712306b46722275", "artifactType": "application/vnd.cncf.notary.signature", "results": [ { "succeeded": true, "description": "Notation signature verification succeeded", "verifierName": "notation-verifier-1", "verifierType": "notation", "detail": { "Issuer": "CN=ratify3,O=Notary,L=Seattle,ST=WA,C=US", "SN": "CN=ratify3,O=Notary,L=Seattle,ST=WA,C=US" } } ], "artifactReports": null } ] }