adds SSH signature validation for git commits#1141
adds SSH signature validation for git commits#1141bb-Ricardo wants to merge 11 commits intofluxcd:mainfrom
Conversation
96523af to
1561774
Compare
|
@bb-Ricardo please run |
eedb46c to
048e862
Compare
e247a34 to
5e6ab4d
Compare
|
Hi, was just wondering if this PR is sufficient or if anything else is needed? |
stefanprodan
left a comment
There was a problem hiding this comment.
Tests are failing with open signatures/... no such file or directory please run make test-git before pushing commits.
|
sorry for that, now the tests passed locally. |
83338dc to
51ceefd
Compare
|
@hiddeco - would you mind to have a look at this PR again? Thank you. |
pjbgf
left a comment
There was a problem hiding this comment.
@bb-Ricardo thanks for working on this. Overall LGTM, however I'd remove any references to DSA as per thread below.
git/signatures/testdata/gpg_signatures/generate_gpg_fixtures.sh
Outdated
Show resolved
Hide resolved
git/signatures/testdata/gpg_signatures/generate_gpg_fixtures.sh
Outdated
Show resolved
Hide resolved
git/signatures/testdata/gpg_signatures/commit_dsa_2048_signed.txt
Outdated
Show resolved
Hide resolved
| // It returns the fingerprint of the key the signature was verified with, or an error. | ||
| // It does not verify the signature of the referencing tag (if present). Users are | ||
| // expected to explicitly verify the referencing tag's signature using `c.ReferencingTag.VerifySSH()` | ||
| func (c *Commit) VerifySSH(authorizedKeys ...string) (string, error) { |
There was a problem hiding this comment.
I think having a new func per type is sub-optimal as that violates OCP. From an user perspective that feels a bit awkward, as you need to iterate through commits, check each type and then make the verification. I'd rather that is abstracted away.
That being said, we can keep this as is and revisit it during the implementation upstream in go-git.
There was a problem hiding this comment.
Hi @pjbgf,
I could rework this but didn't want to break any current implementation in the source-controller. Not actually sure which other component uses this part of the pkg.
I would also like to see most of the functionality implemented in go-git and only abstract here where needed.
Maybe we can continue with the discussions over there.
|
@bb-Ricardo please use rebase not merge. Undo the last merge, and properly rebase your fork, GH has a button for this if you go to your forked repo. |
- adds new package git/signatures - adds validation of SSH signed commits to ssh_signature.go - moves GPG signature validation to gpg_signature.go - adds text fixtures for all SSH and GPG key types including commits and signatures - adds tests for all key/signature combinations - adds wrapper for "Verify(keyRings ...string)" function Signed-off-by: Ricardo Bartels <ricardo.bartels@telekom.de>
Signed-off-by: Ricardo Bartels <ricardo.bartels@telekom.de>
Signed-off-by: Ricardo Bartels <ricardo.bartels@telekom.de>
Signed-off-by: Ricardo Bartels <ricardo.bartels@telekom.de>
Signed-off-by: Ricardo Bartels <ricardo.bartels@telekom.de>
Signed-off-by: Ricardo Bartels <ricardo.bartels@telekom.de>
Signed-off-by: Ricardo Bartels <ricardo.bartels@telekom.de>
Signed-off-by: Ricardo Bartels <ricardo.bartels@telekom.de>
…tureType' Signed-off-by: Ricardo Bartels <ricardo.bartels@telekom.de>
Co-authored-by: Paulo Gomes <paulo.gomes.uk@gmail.com> Signed-off-by: Ricardo <ricardo@bitchbrothers.com>
Signed-off-by: Ricardo Bartels <ricardo.bartels@telekom.de>
b6f0ece to
bd9abd8
Compare
Yes, sorry. I used the seemingly convenient button GitHub offered in this PR. I removed all occurrences of GPG DSA keys in the tests and test fixtures. |
This PR adds support of SSH signature validation.
resolves: fluxcd/flux2#4145