-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add gitsign show
subcommand.
#191
Conversation
Adds a new subcommand that outputs an in-toto Statement containing the source provenance of the given commit. Also moves io Stream creation into the root RunE func so that streams aren't created for subcommands that don't need them. Signed-off-by: Billy Lynch <[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.
Might have just missed this on my reading, but can we add the same verification logic from gitsign --verify
as well when we parse the signature to check its authentic?
I'm not against it, but the nice thing about just formatting without verification is that this works for any signature type - GPG, SSH, x509, Gitsign, etc. If we add verification then we'd probably need to add support for the other key types to stay consistent (which opens a whole can of worms). |
Ah I see, is there a generic |
Not really 😬 There's What we can do as a happy medium is add a |
I'd prefer {
"_type": "https://in-toto.io/Statement/v0.1",
"predicateType": "gitsign.sigstore.dev/predicate/git/v0.1",
"subject": [
{
"name": "[email protected]:wlynch/gitsign.git",
"digest": {
"sha1": "10a3086104c5331623be85a5e30d709f457b536b"
}
}
],
"predicate": {
"source": {
"tree": "194fca354a2439028e347ce5e19e4db45bd708a6",
"parents": [
"2eaf8fc6d66505baa90640d018e1131cd8e99334"
],
"author": {
"name": "Billy Lynch",
"email": "[email protected]",
"date": "2022-11-14T16:13:19-05:00"
},
"committer": {
"name": "Billy Lynch",
"email": "[email protected]",
"date": "2022-11-14T16:13:19-05:00"
},
"message": "add sample\n"
},
+ "signature_verified": false,
"signature": "-----BEGIN SIGNED MESSAGE-----\nMIIEAwYJKoZIhvcNAQcCoIID9DCCA/ACAQExDTALBglghkgBZQMEAgEwCwYJKoZI\nhvcNAQcBoIICpDCCAqAwggImoAMCAQICFFTzLmXKAlKX5xTUaYoUE5giCxZvMAoG\nCCqGSM49BAMDMDcxFTATBgNVBAoTDHNpZ3N0b3JlLmRldjEeMBwGA1U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bGkmabjgOAFNh/luR8Ekg/oUm2pdgIhAP+e\ngvO2EMqCOteiJ6n8GqqfKChNEz0cqKb4NExvAe14MAoGCCqGSM49BAMDA2gAMGUC\nMQC8e+o4ApPfhBDH09K46zBB+q4HIAt3MDURLSfHgzmLjuSo14QGXrXb+FhMPXJ2\nksgCMFNaIcO13Ez2uuJMjIYYm5sLT681xxyxRENMn4DdecwARHeKSX9wnbAb1zxk\n3sBRLw==\n-----END CERTIFICATE-----\n"
}
]
}
} My thinking here is that folks need to make policy decisions based on this attestations and might not have access to go pull the source and verify themselves at that point (that is why we're using this attestation in the first place) so we want some clear signals that it was verified by the entity that signed this attestation. |
If we just fail out on SSH signatures and x509 is ok for now? I feel like if you're reaching for this tool its a corner case because you probably
So we'll be able to handle the common situations |
We wouldn't be able to verify anything that isn't Gitsign, including GPG / GitHub web-flow signed commits which is why I'm worried. 😬 Unsigned commits is also an interesting case - my gut feeling is that I think it's okay to produce provenance documents that don't have a signature. It's up to the attestor to determine if that's something they are willing to sign off on. |
Signed-off-by: Billy Lynch <[email protected]>
Ahh dang ok, I understand your hesitation now. |
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.
Nice job! I have a few things.
This was accidentally left in place while trying to debug a different issuer. Signed-off-by: Billy Lynch <[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
Summary
Adds a new subcommand that outputs an in-toto Statement containing the source provenance of the given commit. This works for both Gitsign + GPG signed git commits - it extracts the cert information if present.
This can be coupled with other tools like cosign to produce attestations, i.e.:
Also moves io Stream creation into the root RunE func so that streams aren't created for subcommands that don't need them.
Possibly fixes #105 (@Dentrax @developer-guy let me know what you think!)
cc @adityasaky (you may be interested in this)
Signed-off-by: Billy Lynch [email protected]
Release Note
gitsign show
subcommand to print out an in-toto Statement for a given Git commit.Documentation
I plan on generating cobra docs in another PR!