-
Notifications
You mu 8000 st be signed in to change notification settings - Fork 22
Feature request: Ability to trust OIDC tokens bypassing the OIDC protocol with a JWKS file in the GitHub repository #841
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
Comments
One dumb question: How will it access the Octo-STS app if it is an air-gapped environment? And if the Octo-STS app is installed in the air gap, how will it access GitHub to get the token? |
You're right, maybe air-gapped is not exactly the case/the best choice of words, but you sure can have e.g. a Kubernetes cluster that lacks a public API server/OIDC discovery endpoint, e.g. GKE. I'll remove this from the issue description and PR content! |
We currently use that in Cloud Run and kubernetes; you need to add the service account and give the permissions. You can see the example of a policy here: https://github.com/wolfi-dev/advisories/blob/main/.github/chainguard/lifecycle-adv-triage.sts.yaml |
Oops, you're right! Last time I checked a long time ago it wasn't possible to reach the discovery endpoint of a GKE cluster, maybe they changed it recently or this is just a feature of GKE Autopilot? I created a token like this:
The
Then I
Brilliant! However, there's plenty of Kubernetes clusters with private API server/OIDC discovery endpoints out there 😁 I worked on a company where we tried to use the API server binary flags |
Yes, the issuer endpoints for GKE, EKS, and AKS (with their v2 identity stuff) are all publicly accessible (and have been for years), I added support to sigstore/fulcio for signing with these a while back, and we have long supported federation with these at Chainguard. We added support for something similar (in the Chainguard issuer) several years ago to support KinD clusters, which may have outbound networking, but aren't themselves accessible for OIDC discovery (minikube is probably the same story). I believe that all we would need to do to technically to support this is to add an 8000 optional field to trust policies that allows the repository to specify the JWKS it is willing to accept, and I know the underlying library we use for validation supports accepting a static JWKS to use for validation. That said, I want to highlight my favorite Jurassic park meme: Your scientists were so preoccupied with whether they COULD do it, then didn't stop to think whether they SHOULD do it. There are a lot of gotchas needed to "hold this right." Folks would need to not only check in the initial JWKS into their repository, but they would need to update them BEFORE the issuer starts to issue tokens with rotated keys, or STS interactions will fail until the JWKS are rotated in the trust policy. Generally issuers can handle this by providing cache-control headers on the discovery endpoints, but my guess is that 99% of folks using this (or the GCP feature) simply aren't rotating their issuer keys at all 😱 I'm not entirely opposed to this, but...
|
Hi @mattmoor, thanks for the feedback here!
Then I really can't explain myself 😛
Yes, you are exactly right about this, that's a concern I have too... But I really don't know another solution to this problem, happy to brainstorm ideas 🤷 Looks like the Chainguard solution you linked to is exactly the same
Yes, that's what I did in this PR for implementing the feature requested here: #842 You have a good point about having a real use case. As I mentioned in another issue in this repo, I'd be very interested in implementing Octo STS in CNCF Flux (which sure has lots of non-cloud users), we are implementing this RFC there right now for the three major cloud providers. GitHub unfortunately does not support GHCR access through GitHub Apps, though, which limits our interest in actually implementing this... So I really just filed this issue+PR with the intention to simply contribute a cool feature, to be honest. Let's maybe wait for this issue to get upvoted, then? |
Gotcha, yeah the Flux use case could be interesting if there's a mutual user interested in that. I still need to poke at the packages stuff, I could have sworn I played with that (successfully), but it's been a long year 😅 |
Hi again 👋
A very cool feature of GCP's Workload Identity Federation is the ability to upload a JWKS file for supporting issuers that are not accessible from the Internet for whatever reasons (compliance, etc.), like a Kubernetes cluster with a private API server/OIDC discovery endpoint (e.g.
kind
running locally). See the GCP docs for this feature:https://cloud.google.com/iam/docs/workload-identity-federation#oidc-credential-security
It would be very cool if the trust policy had a field
jwks
where you can specify a multi-line string containing a JWKS JSON document, i.e. the output of a request tohttps://<issuer>/openid/v1/jwks
, like this:The trust policy above should allow the Kubernetes
ServiceAccount
my-app
from the namespacemy-app
to read the contents of the GitHub repository.It would be easy to implement this through
oidc.NewVerifier()
, like you are already doing for tests. This would require moving the call tos.lookupInstallAndTrustPolicy()
up, above the OIDC token verification part in thefunc (s *sts) Exchange()
method.I'm filing a PR for this 😁
The text was updated successfully, but these errors were encountered: