-
Notifications
You must be signed in to change notification settings - Fork 9
Conversation
cmd/endorser/README.md
Outdated
generates an endorsement statement, with the given provenances listed in the endorsement statement's | ||
evidence field. | ||
|
||
Example execution with not provenances: |
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.
Example execution with not provenances: | |
Example execution without provenances: |
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.
Fixed :)
cmd/endorser/main.go
Outdated
) | ||
|
||
// layout represents the expected date format. | ||
const layout = "20060102" |
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.
What format is this? Why not use ISO 8601? If it cannot be changed, could you add a comment here explaining why?
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 ISO 8601. Both YYYY-MM-DD and YYYYMMDD are allowed (wikipedia). But, changed it to YYYY-MM-DD.
cmd/endorser/main.go
Outdated
binaryDigest := flag.String("binary_digest", "", "Digest of the binary to endorse, of the form alg:value. Accepted values for alg include sha256, and sha2-256") | ||
binaryName := flag.String("binary_name", "", "Name of the binary to endorse. Should match the name in provenances, if provenance URIs are provided.") | ||
verificationOptions := flag.String("verification_options", "", "Output path to a textproto file containing verification options.") | ||
endorsementPath := flag.String("endorsement_path", "endorsement.json", "Output path to store the generated endorsement statement in.") | ||
notBefore := flag.String("not_before", defaultNotBefore, | ||
"Optional - The date from which the endorsement is effective. The expected date format is YYYYMMDD. Defaults to 1 day after the issuance date.") | ||
notAfter := flag.String("not_after", defaultNotAfter, | ||
"Required - The expiry date of the endorsement. The expected date format is YYYYMMDD. Defaults to 90 day after the issuance date.") | ||
flag.Var(&provenanceURIs, "provenance_uris", "URIs of the provenances.") |
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.
I think flags are normally in the top level scope, unless they need to be dynamically generated.
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.
Done.
cmd/endorser/main.go
Outdated
binaryName := flag.String("binary_name", "", "Name of the binary to endorse. Should match the name in provenances, if provenance URIs are provided.") | ||
verificationOptions := flag.String("verification_options", "", "Output path to a textproto file containing verification options.") | ||
endorsementPath := flag.String("endorsement_path", "endorsement.json", "Output path to store the generated endorsement statement in.") | ||
notBefore := flag.String("not_before", defaultNotBefore, |
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.
Setting the default to a dynamic value seems confusing; if someone runs the --help command, they will see the default change all the time I think? It seems more appropriate to leave that empty, and if so rely on some logic to deal with the default
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.
Makes sense. Removed the defaults from the flag
, but these defaults are used if no value is specified.
cmd/endorser/main.go
Outdated
|
||
bytes, err := json.MarshalIndent(endorsement, "", " ") | ||
if err != nil { | ||
log.Fatalf("could not marshal the fuzzing claim: %v", err) |
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.
Which fuzzing claim?
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.
Good catch. sloppy copy-paste. Fixed.
cmd/endorser/main.go
Outdated
} | ||
|
||
func main() { | ||
// Current time in UTC time zone since it is used by OSS-Fuzz. |
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.
What is the connection with OSS-Fuzz?
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.
Oops! Copy-paste! Fixed.
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.
Thanks for the review.
cmd/endorser/README.md
Outdated
generates an endorsement statement, with the given provenances listed in the endorsement statement's | ||
evidence field. | ||
|
||
Example execution with not provenances: |
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.
Fixed :)
cmd/endorser/main.go
Outdated
) | ||
|
||
// layout represents the expected date format. | ||
const layout = "20060102" |
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 ISO 8601. Both YYYY-MM-DD and YYYYMMDD are allowed (wikipedia). But, changed it to YYYY-MM-DD.
cmd/endorser/main.go
Outdated
} | ||
|
||
func main() { | ||
// Current time in UTC time zone since it is used by OSS-Fuzz. |
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.
Oops! Copy-paste! Fixed.
cmd/endorser/main.go
Outdated
binaryName := flag.String("binary_name", "", "Name of the binary to endorse. Should match the name in provenances, if provenance URIs are provided.") | ||
verificationOptions := flag.String("verification_options", "", "Output path to a textproto file containing verification options.") | ||
endorsementPath := flag.String("endorsement_path", "endorsement.json", "Output path to store the generated endorsement statement in.") | ||
notBefore := flag.String("not_before", defaultNotBefore, |
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.
Makes sense. Removed the defaults from the flag
, but these defaults are used if no value is specified.
cmd/endorser/main.go
Outdated
binaryDigest := flag.String("binary_digest", "", "Digest of the binary to endorse, of the form alg:value. Accepted values for alg include sha256, and sha2-256") | ||
binaryName := flag.String("binary_name", "", "Name of the binary to endorse. Should match the name in provenances, if provenance URIs are provided.") | ||
verificationOptions := flag.String("verification_options", "", "Output path to a textproto file containing verification options.") | ||
endorsementPath := flag.String("endorsement_path", "endorsement.json", "Output path to store the generated endorsement statement in.") | ||
notBefore := flag.String("not_before", defaultNotBefore, | ||
"Optional - The date from which the endorsement is effective. The expected date format is YYYYMMDD. Defaults to 1 day after the issuance date.") | ||
notAfter := flag.String("not_after", defaultNotAfter, | ||
"Required - The expiry date of the endorsement. The expected date format is YYYYMMDD. Defaults to 90 day after the issuance date.") | ||
flag.Var(&provenanceURIs, "provenance_uris", "URIs of the provenances.") |
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.
Done.
cmd/endorser/main.go
Outdated
|
||
bytes, err := json.MarshalIndent(endorsement, "", " ") | ||
if err != nil { | ||
log.Fatalf("could not marshal the fuzzing claim: %v", err) |
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.
Good catch. sloppy copy-paste. Fixed.
83bf39e
to
a81d632
Compare
Have tested with the following commands:
Provenance-less endorsement:
Resulting endorsement:
Normal endorsement with linked provenance:
Resulting endorsement: