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
ci: Generate SLSA signatures for GitHub released tarballs #1438
Conversation
Signed-off-by: Asra Ali <asraa@google.com>
Related: #1219 |
Codecov Report
@@ Coverage Diff @@
## main #1438 +/- ##
==========================================
- Coverage 73.40% 73.31% -0.10%
==========================================
Files 115 115
Lines 8757 8772 +15
==========================================
+ Hits 6428 6431 +3
- Misses 1688 1696 +8
- Partials 641 645 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Hey Asra 👋 Thanks for this, and it looks good! When @laurentsimon proposed similar for That's here: Could you add a similar workflow here as well? It might also be useful to add to other projects as you roll this out. |
Did I read that correctly, that they hosted public Docker image with committed keys? "The attacker was able to extract an HMAC key for a Google Cloud Storage service account from an intermediate layer in our public Codecov Self-Hosted Docker image. " |
@asraa what is the attack vector? From the command line it looks like I just need to forge
|
That's what it sounds like, yeah. This is actually pretty easy to do with a Dockerfile:
This sounds like the Tools like Trivy and Grype will scan for secrets in these intermediate layers, and I wrote a tool to demonstrate it simply here: https://github.com/imjasonh/chaff
The attestation is also signed by the GitHub Actions OIDC identity (example here), and verification presumably includes checking that the signature was signed by who it says it was signed by:
This block means that the GitHub OIDC identity got this cert from Sigstore's Fulcio root CA (also verified) after doing an OIDC exchange with Fulcio to verify its identity. edit to add: The |
Does it really protect from Codecov attack? If |
Correct, we're putting some trust into This is why we run as little as possible before/during our goreleaser process, and do our best to pin to specific goreleaser versions. The addition of a signed attestation doesn't obviate the need for diligent code reviews and release hygiene. It would help a consumer of the built artifacts have more confidence in how that artifact was built, when, and by what process. |
Thanks! @imjasonh had it all correct:
Yes, to this point, if you modify the attestation's I'll send a follow-up with verification and an update to verification instructions! |
Maybe
That still doesn't guarantee there are no meanies in dependencies during like https://github.com/google/go-containerregistry/pull/1435/files unless people are motivated to stake their $$$ on reviews. The crypto junkie in me just can not leave this thing alone without thinking how the whole thing could be replaced with distributed storage for signed content addressable hashes and DHT. :D |
This still depends on a root CA, which should give automated certificates. Which means I can fork the repo and generate this (spot the difference).
If need to download the signature the same way I download binary to check, then if there doubts that binary is valid, there are the same doubts that signature is not forged. To me signed hashes of binaries on the blockchain is an easier solution. But I don't know what specific attack vector SLSA is trying to block. |
If you fork the repo the origin in the cert will be different: |
there's also sget https://github.com/sigstore/cosign#sget which is a curl-like tool but can verify hash / signatures, and uses container registries to index artifacts. |
But if I fork to Maybe it is the tailless blockchain with hashes to check against.. but it is not immediately obvious, and I am not ready to study it yet. |
The verification instructions prevent this, due to the flag If you were importing a key, then you as a client would require making sure that you've pulled the latest, most up-to-date key. Verifying against the identity prevents this. Furthermore, not only does it absolve maintainers of needing to manage keys and issue revocations, but it also gives users much, much more information than just proof of ownership and tamper-resistiance. It allows a user to inspect the provenance manifest, and inspect what commit it was built from and which workflow it was generated from.
This is done through TUF -- our utilities bundle a trusted root and verify a remote repository against that using a chain of signed roots. It fetches the latest cert to verify against. |
Signed-off-by: Asra Ali asraa@google.com
Hi,
I'm reaching out on behalf of the Open Source Security Foundation (openssf.org). We work on improving the security of critical open source projects like yours.
Together with GitHub, we designed a free, easy-to-use method of code signing. It will help your users verify that your release tarballs were built from your repository’s workflow and not altered by anyone. It’s just a few lines of code, but it will make your project more secure against third-party tampering and attacks like attacks like Codecov and CTX.
I’ve created this PR to shows how to add this seamless code signing to your workflow. You don’t have to be a cryptography expert or learn complicated tools and verification is simple for your users.
Furthermore, I have tested the workflow on my own fork. You can see the release with the attached provenance here. I would love to add verification instructions as well, but don't see a place where this is mentioned yet. Verification looks like
You can read more on the SLSA blog. Please reach out if you have any questions!