Skip to content
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

Create an example of federating with a google service account #36

Open
mattmoor opened this issue Jan 22, 2024 · 9 comments
Open

Create an example of federating with a google service account #36

mattmoor opened this issue Jan 22, 2024 · 9 comments
Assignees

Comments

@mattmoor
Copy link
Member

... using the chainguard.dev/sdk client!

@mattmoor
Copy link
Member Author

I think that we can use sts.New from here.

Something like:

xchg := sts.New("https://octo-sts.dev", "does-not-matter", sts.WithScope("wolfi-dev/os"), sts.WithIdentity("blah"))
...
ts, err := idtoken.NewTokenSource(ctx, "octo-sts.dev")
token, err := ts.Token()
res, err := xchg.Exchange(ctx, token)

// Use res.Token

@cpanato it'd be great to try this out in the chainguard-devops repos to try and eliminate their need for PATs, but maybe this is blocked on support for org-level stuff 🤔

@rawlingsj you mentioned that lifecycle was using PATs, so maybe that's another place we could pilot this with repo-level grants?

@mattmoor
Copy link
Member Author

I confirmed that we can use chainguard.dev/sdk for this:
https://github.com/chainguard-dev/mattmoor-actions/actions/runs/7649456188/job/20843888651#step:7:7

See the code here: https://github.com/chainguard-dev/mattmoor-actions/blob/dd6a460c85933d8eb21e5f8e18cd98c6d2e69a92/main.go#L17-L27

@cpanato
Copy link
Collaborator

cpanato commented Jan 25, 2024

I will implement that

I need to know how the org one to access any repo will work, I am asking that because the service that takes care of the release notes can be installed for any repo, or we will define per repo as well?

@cpanato
Copy link
Collaborator

cpanato commented Jan 29, 2024

@mattmoor
Copy link
Member Author

@cpanato if you put the policy into .github and don't specify repositories then it'll apply to all repos in the org.

@cpanato
Copy link
Collaborator

cpanato commented Jan 31, 2024

to close this ticket, do you want a code example in the repo?

@mattmoor
Copy link
Member Author

I think we should have it somewhere public, but I don't have any great ideas for where.

@cpanato
Copy link
Collaborator

cpanato commented Feb 1, 2024

i would say here, but this is private, maybe in the action repo for the octo-sts

@mattmoor
Copy link
Member Author

mattmoor commented Feb 5, 2024

We should add token revocation to the sample, e.g. #92

@cpanato cpanato self-assigned this Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants