-
Notifications
You must be signed in to change notification settings - Fork 0
Add output flag for notation verify #1
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: attestations-impl
Are you sure you want to change the base?
Conversation
Signed-off-by: Byron Chien <chienb@amazon.com>
Signed-off-by: Byron Chien <chienb@amazon.com>
Signed-off-by: Byron Chien <chienb@amazon.com>
Signed-off-by: Byron Chien <chienb@amazon.com>
Signed-off-by: Byron Chien <chienb@amazon.com>
priteshbandi
left a comment
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.
Few nitpicks, else LGTM
cmd/notation/verify.go
Outdated
| } | ||
|
|
||
| func printMetadataIfPresent(outcome *notation.VerificationOutcome) { | ||
| func printResult(outputFormat string, reference string, outcome *notation.VerificationOutcome) 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.
| func printResult(outputFormat string, reference string, outcome *notation.VerificationOutcome) error { | |
| func printResult(outputFormat, reference string, outcome *notation.VerificationOutcome) 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.
huh, didn't realize it wasn't necessary, is this a go thing?
specs/commandline/verify.md
Outdated
| "reference": "localhost:5000/net-monitor@sha256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
| "userMetadata": { | ||
| "io.wabbit-networks.buildId": "123" | ||
| } |
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.
Are we missing result?
cmd/notation/verify.go
Outdated
| fmt.Printf("Resolved artifact tag `%s` to digest `%s` before verification.\n", ref.Reference, manifestDesc.Digest.String()) | ||
| fmt.Println("Warning: The resolved digest may not point to the same signed artifact, since tags are mutable.") | ||
| } |
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.
nit: this should go into std.err instead of std.out. its not part of your change but can we open an issue to track this?
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.
issue: notaryproject#513
cmd/notation/verify.go
Outdated
| if outputFormat == ioutil.OutputJson { | ||
| output.UserMetadata = metadata | ||
| return ioutil.PrintObjectAsJson(output) | ||
| } |
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.
are we throwing away outputFormat object if output != json ?
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.
yes, can make it cleaner and only setup the object if output format is json
cmd/notation/verify.go
Outdated
|
|
||
| func printMetadataIfPresent(outcome *notation.VerificationOutcome) { | ||
| func printResult(outputFormat, reference string, outcome *notation.VerificationOutcome) error { | ||
| output := verifyOutput{Reference: reference, Result: "Success", UserMetadata: map[string]string{}} |
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.
nit: usually its best practice to start with failure mode and add then override data, unless you have all the data you need to call success.
Signed-off-by: Byron Chien <chienb@amazon.com>
Signed-off-by: Byron Chien <chienb@amazon.com>
Signed-off-by: Byron Chien <chienb@amazon.com>
305a491 to
cb6d2ed
Compare
Signed-off-by: Byron Chien <chienb@amazon.com>
Signed-off-by: Byron Chien <chienb@amazon.com>
5f040e0 to
1c3cddf
Compare
Signed-off-by: Byron Chien <chienb@amazon.com>
Signed-off-by: Byron Chien <chienb@amazon.com>
c049b11 to
aa74179
Compare
Signed-off-by: Byron Chien <chienb@amazon.com>
* Added error handling and unit tests. * WIP for notaryproject#516 * Resolves notaryproject#525 Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
a5d4634 to
8b8ea52
Compare
Signed-off-by: Byron Chien <chienb@amazon.com>
…y cmds (notaryproject#507) Adds support for signed user metadata in `notation sign` and `notation verify`. [Relevant spec](notaryproject#498) example sign usage: chienb@a07817b52895 notation % notation sign $IMAGE --user-metadata io.wabbit-networks.buildId=123 --user-metadata io.wabbit-networks.buildTime=123 Successfully signed localhost:5000/net-monitor@sha256:5a07385af4e6b6af81b0ebfd435aedccdfa3507f0609c658209e1aba57159b2b --------------- example verification: chienb@a07817b52895 notation % notation verify $IMAGE --user-metadata io.wabbit-networks.buildTime=123 Resolved artifact tag `v1` to digest `sha256:5a07385af4e6b6af81b0ebfd435aedccdfa3507f0609c658209e1aba57159b2b` before verification. Warning: The resolved digest may not point to the same signed artifact, since tags are mutable. Successfully verified signature for localhost:5000/net-monitor@sha256:5a07385af4e6b6af81b0ebfd435aedccdfa3507f0609c658209e1aba57159b2b The artifact was signed with the following user metadata. KEY VALUE io.wabbit-networks.buildTime 123 io.wabbit-networks.buildId 123 ----- Signed-off-by: Byron Chien <chienb@amazon.com>
Signed-off-by: Byron Chien <chienb@amazon.com>
Signed-off-by: Byron Chien <chienb@amazon.com>
e1f0559 to
b22ae06
Compare
Don't access value of default pointer if it is nil. This is actually a bug(unable to delete key if defualt key is not present) fix. Signed-off-by: Pritesh Bandi <pritesb@amazon.com>
Signed-off-by: Byron Chien <chienb@amazon.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
- fail fast on unknown output format - print warnings to stderr for both output formats - omit empty metadata from json response Signed-off-by: Byron Chien <chienb@amazon.com>
Signed-off-by: Byron Chien <chienb@amazon.com>
- rename PrintObjectAsJson => PrintObjectAsJSON - move output format constants to flags.go - use switch for verify output behavior - add documentation output methods - call out failure behavior in spec Signed-off-by: Byron Chien <chienb@amazon.com>
ae0e5c5 to
79b3217
Compare
Adds output flag for notation verify to format output as json. Also updates the notation verify spec for the new flag.
Signed-off-by: Byron Chien chienb@amazon.com