-
Notifications
You must be signed in to change notification settings - Fork 407
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
Signing built images #357
Comments
Great idea! |
This is where I really want a sidechannel for build outputs (my stupid "layoutput" thing). |
+1 to native integration here. Generally my preference would be to bias towards the ephemeral key route and use the same ephemeral key to sign all of the images produced (we should probably also start to think about incorporating a variety of opinionated attributes based on things we know about the build). re: many images something like |
This PR includes a technique I have been using to incorporate keyless signing into some ko-like tools: sigstore/cosign#647 Basically it only kicks in when We sacrifice some amount of configurability, but my inclination here would be to probably adjust how |
+1 to Ideally we'd end in a state where things are signed by default using ambient tokens if available, which can be disabled with a flag or config. Do we want to support signing with explicit keys? Or just leave that for cosign? |
I think the first order of business will be to get the distroless images signed against Fulcio. For configuring things, I think trying to standardize on env vars in cosign upstream would be my preference (for portability across tools). For opting out (beyond experiment), I think some .ko.yaml syntax is called for, we can introduce this to ease folks into it too. Another step between “experiment guarded” and “opt-out” to encourage folks to start signing will be to always verify, but make verification non-fatal (print warnings). I also think we probably want some sort of refresh token flow for users before we move beyond experimental. sorry this ended up sort of stream of consciousness. |
Ok, full keyboard so here's sort of what I'm thinking in terms of phasing this in.
(once the default base images are signed against Fulcio)
(once keyless signing is no longer "experimental" in Sigstore)
(once we have a clear opt-out path for base images)
As with If we find out that being more aggressive signing things in dev is important (e.g. back-pressure from |
Starting to poke through code, I think the most natural integration point for signing is likely to implement a new
If we have a signing publisher, we can accumulate / pass through images to an inner publisher, and then sign all of the accumulated images in As I'm writing this I realize that |
So it looks like currently: return cli.Sign().Exec(context.Background(), n.digests.List()) ... generates a new cert for every image, and send the user through a separate 3LO for each one, so on big projects (e.g. cc @dlorenc |
When `COSIGN_EXPERIMENTAL=true`, this will verify base images, and sign produced images using the KEYLESS flow. Fixes: ko-build#357 Fixes: ko-build#356
When `COSIGN_EXPERIMENTAL=true`, this will verify base images, and sign produced images using the KEYLESS flow. Fixes: ko-build#357 Fixes: ko-build#356
When `COSIGN_EXPERIMENTAL=true`, this will verify base images, and sign produced images using the KEYLESS flow. Fixes: ko-build#357 Fixes: ko-build#356
Have we thought through what new CLI flags we'd need? Regardless of how cosign-as-an-sdk evolves,
Maybe we should wait for the [EXPERIMENTAL] stuff to become un-experimental -- sad as it would be to have to wait for the nice things -- before adding all those |
I don't really think experimental will change much in the flag surface either way. |
Picking this back up, since I think we're a lot closer to having this be possible than we were six months ago. The concerns I think we all have are roughly threefold:
To solve (3) I'd like to propose we start by only having This eliminates the need for flags to configure a key, including references to keys in KMS systems, and security key flows. Instead of having flags for Signing will be disabled by default, behind a new flag, If we're happy with the added dependencies required to get this working, we're pretty close to having the user-signing OIDC flow too, using sigstore/sigstore's btw, after shelving #433 for adding ~400kloc of dependencies, we had about half that many lines sneak in through #718 anyway, so I think the dependency ship may have sailed ⛵. Not that we shouldn't keep working to get cosign's dependencies down, but maybe it's worth just biting the bullet and getting signing in before cutting out those deps. |
Once we have image signing in place we should also have |
Some more considerations I think we'll need to...consider:
|
I figured we'd have something like |
Is that effectively " gitsign has to deal with a lot of these issues too, fwiw, to prevent OAuth popup spam while always providing a valid unexpired cert (sigstore/gitsign#75). I'd kind of rather write that in Go, even if it's painful. gitsign has to live in Git's constraints, ko is much more free to do better. |
I think that with |
Yeah. I think we're talking about the same thing. The problems in #357 (comment) roughly concern how to avoid multiple unnecessary 3LOs, since that will really ruin the experience of using
|
Nope, this was dumb. We should just build all the images we're going to build (1 for
I still don't have a good answer to this.
I think doing one signing pass after all the builds complete means this isn't an issue. It shouldn't take 10m just to push the signatures. |
I might have an okay answer to this.
|
@imjasonh - may be |
OIDC signing for cosign is no longer experimental, after the recent Sigstore GA. I still think I'd like to focus on keyless signing in |
We've also been talking about plumbing sufficient environment variables into
Where the former emits a set of:
I think we should aim to align with that model for configuring Perhaps we should have a way to configure keyful via the env too? |
I love the keyless signing but then wondering how we can configure keyless signing w/o browser, typically to have integration with CI/automation. I see lots of
|
I also faced an dependencies issue as detailed here sigstore/cosign#2477 |
GitHub OIDC and Google and Amazon Workload Identity OIDC are all pretty straightforward to detect and use automatically, without flags. The |
That should be better, we should wait for it IMHO |
@imjasonh when trying the https://docs.sigstore.dev/cosign/openid_signing#oauth-flows I still see we get prompted to open browser or other kind of manual intervention. Not sure how they play with automation/CI workflow , I mean just by providing |
When you run For example:
This will sign the image as the GitHub Actions workload identity. You can see what that looks like in Rekor here: https://rekor.tlog.dev/?logIndex=7576978 To do this, All of this should already be abstracted by |
@imjasonh have you tried using GitHub OIDC outside of GH Actions similar to how we can do GCP |
I don't believe this is supported. GitHub OIDC is only a workload identity, and not a user identity based on a PAT. |
I might be in this situation. We have an internal build system that runs on Kubernetes and connects to Buildkit directly where we can "reliably" inject a private key for a build Job. I think supporting key-based signing would be a good start for Ko too and I'd like to help contribute if it's on the roadmap as this might be the fastest way for us to start signing images. |
It looks like this issue has gone somewhat fallow... the last comments I see are in #603 (comment), which mention the need to reduce sigstore's dependency tree. Is that still the blocker, or is it implementation of Matt's environment setup in cosign in #357 (comment) ? |
Yeah, I think that cosign needs to go on a major diet. We've been achieving signing of ko (and apko) build images and attesting SBOMs and more with a set of terraform providers, which skirt this (direct) dependency. |
@jonjohnsonjr has done a fair bit of hacking and cutting on cosign's code to use it in tf-cosign, with an internal fork called I could see this being a good avenue for further exploration and integration into |
See my most recent comments in #603 (comment) -- it looks like the |
Users can sign images produced with
ko publish
using tools likecosign
.For example:
ko resolve
produces potentially many images, which makes this a bit harder. You couldko resolve
then scan the resulting YAML forko
-built image references and sign all of those with some bash magic, but 🤮 .Would it be useful to have a
ko resolve --sign cosign.key
flag that used the provided key to sign all images built duringko resolve
?ko publish --sign cosign.key
could also be a convenience alias for, effectively,cosign sign $(ko publish)
, which wouldn't require users to havecosign
installed.@dlorenc good idea? bad idea?
The text was updated successfully, but these errors were encountered: