4 ms·
Use KeePassXC to sign your Git commits
- sethherr 3y agoWhat’s the reason I would want to do this? Is there a specific threat I need to be aware of with regard to threat vector on git commits?
- cdchn 3y agoSBOM/chain of custody all the way back to an individual doing a commit.
- sethherr 3y agoThis is the opposite of a specific threat vector
- cdchn 3y agoSoftware supply chain attacks not specific enough?
- lima 3y agoNot in terms of specific threat model.
- computerfriend 3y agoThreat: attacker can commit malicious code to a repository by impersonation. Mitigation: verify commit signatures.
- atoav 3y agoWe are on computers, so everything can be changed all the time. E.g. there could be malware that changes a cloned git repos commits before you compile the software. If the commits are signed that malware would have to know the private key of that dev to do that, which is one additional hurdle that makes this kind of attack way harder to pull off.
- nprateem 3y agoIdeally your CD system would refuse to deploy commits signed with keys it doesn't recognise, but I've never seen that implemented.
- hannob 3y agoIn Gentoo, I believe we already reject pushing unsigned commits.
- deleted 3y ago[deleted]
- okamiueru 3y agoWhat is "this"? - If "sign with SSH instead of GPG", the answer is convenience. - If "sign commits", the answer is authentication of the user of the commit. Encryption part isn't relevant as you get that already regardless with https/ssh protocols when communicating with the git server. As for why you want to authenticate the user, the better question to ask, is, why wouldn't you? No one can push any commit on your behalf. In some cases it is extremely important because certain branches might be protected due to automated CI/CD pipelines that contain secrets. Without enforcing verification of authenticity, a user might push a commit pretending to be a different user, which exposes those secrets. One might say "well, then you have a bigger problem in your organization", which leads to the restated question of "why not?". It just one of those things we do, like health care workers washing their hands.
- abdullahkhalids 3y agoI am a little confused. Some time back, I added my github ssh key to KeePassXC, and checked the option to Add key to the ssh agent when I unlock my database. I can then just sign my commits. I don't recall doing any of these settings at all.
- sitzkrieg 3y agosigned with ssh key instead
- ilammy 3y agoI tend to agree with the argument Linus put forward a long time ago, saying that there is little reason to sign commits instead of tags in git. * Commit references the tree. If you sign the entire commit object – which is what you want, not leaving a way to change something about the commit without invalidating the signature – you sign the file tree as you saw it and implicitly all its history. Might as well sign the tag then. * Signatures separable from the commit have a benefit of allowing someone other than the author and committer at the time to certify authenticity of the file tree. For example, if the key needs to be rotated later, you can slap a new signature over the previous one. * Signing every single commit is tedious, so you're bound to get it automated at some point. Now your signatures are worth less because your keys are always around to indiscriminately, automatically sign whatever.
- Already__Taken 3y agoI think ssh keys signing goes a long way to point 3. I haven't looks if you can (or if it matters) to sign with an ssh certificate, but that would be useful to add some context to the signature too.
- thrwwycbr 3y agoThe point he was making was not about the tech or tools to sign commits. It was about the laziness of humans not actually reading the code thoroughly when they sign it, and therefore negating the point of ledging/signing the state of the project.
- bpfrh 3y agoThe last point can be mitigated by a hardware based security key(nitrokey,yubikey,etc). Key would then by not on your device so extraction would be difficult or impossible. You would need to touch the key to grant the sign request which would prevent any signing without you noticing.
- ilammy 3y agoIt's more about the slippery slope of security vs convenience. I do git rebase -i often. Do I want to touch my yubikey exactly 37 times for the 37 commits amended, or do I want to touch it once and just trust the software for the next N seconds to sign only these commits and not anything else? Now, if I'm the verifier, do I trust the signer to do it properly? Or the half their commits are actually made by their cat and automatically signed? Signing a tag is a relatively rare and very deliberate action. A more secure approach is less likely to impact convenience, reducing the chance of compromising security because it was inconvenient.
- andrewshadura 3y agoHonestly, I don't get the point of it. SSH keys, unlike PGP keys, are meant to be disposable and don't carry any identity information. If anything, I'd rather use my PGP keys with SSH (an option available for about a decade I think).
- wolletd 3y agoPeople don't get the security concepts. Probably, just a lot of people wanted signed commits because they somehow "better", but couldn't get PGP to work. But they use SSH keys to push to GitHub anyway, so someone added the option to use SSH keys to sign Git commits. Now everyone can have a green "Verified" symbol on their commits. It's worth less, but it looks better!
- thrwwycbr 3y agoChecklist security in a nutshell. Does it have a checkmark? Yes? Must be secure then.
- SAI_Peregrinus 3y agoMost users are using `git` with some sort of server, and authenticating their development system(s) to that server with SSH. Git-over-SSH support is built in to `git`. Using the same key to that already identifies and authenticates you to the server is more convenient than needing a second, parallel PKI set up.
- Hack0133 3y ago[flagged]
- deleted 3y ago[deleted]
- LKummer 3y agoI have a similar setup with Bitwarden. I've managed GPG keys manually for commit/tag signing before and switched to a consolidated setup using SSH keys for almost everything. Managing GPG keys on multiple computers was hell. Forwarding SSH agent changed how I distribute my keys, and helped reduce the amount of places keys are distributed to and kept in memory. I've been meaning to write about that workflow because it really streamlined how I manage keys.