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

publish token to GH Pages? #5

Closed
jku opened this issue Sep 15, 2023 · 5 comments · Fixed by #7
Closed

publish token to GH Pages? #5

jku opened this issue Sep 15, 2023 · 5 comments · Fixed by #7

Comments

@jku
Copy link
Collaborator

jku commented Sep 15, 2023

This is very neat (an abomination but a neat one) , I'm thinking of using this in my own testing as well... The only tricky part seems to be finding a token: see https://github.com/sigstore/sigstore-conformance/blob/6c958ac7c74146cb694b9bdb3f8111c3e447d6cf/test/conftest.py#L75 for an example

What if the workflow published to GitHub Pages with a static filename? That way the newest produced token could always be available at https://sigstore-conformance.github.io/extremely-dangerous-public-oidc-beacon/cursed-token.txt. Am I missing anything?

The downloader would still have to deal with the token being too old (unsure how at this hand waving stage) but all of this would go away:

  • GitHub auth
  • workflow run json download
  • workflow run json parsing
  • unzipping
@jku
Copy link
Collaborator Author

jku commented Sep 15, 2023

downloader would still have to deal with the token being too old (unsure how at this hand waving stage)

I think this is easiest:

token=jwt.decode(cursed_token_data[:-1], options={"verify_signature": False})
expiry=datetime.fromtimestamp(token["exp"])

should be trivial to retry if the token is not valid ( or is valid for less than 10 secs or however long we need it for)

@woodruffw
Copy link
Collaborator

What if the workflow published to GitHub Pages with a static filename? That way the newest produced token could always be available at https://sigstore-conformance.github.io/extremely-dangerous-public-oidc-beacon/cursed-token.txt. Am I missing anything?

This is a great idea, and should be way less flaky than the current approach!

If you have the time to work on this I'd be overjoyed to review and merge it, otherwise I'll try and find the time to do it in the near future 🙂

@jku
Copy link
Collaborator Author

jku commented Sep 26, 2023

If you have the time to work on this I'd be overjoyed to review and merge it, otherwise I'll try and find the time to do it in the near future 🙂

It's on my list of "when I need a break from actual project, try this"... so no promises but I might. I'll leave a note here if I do anything

@jku
Copy link
Collaborator Author

jku commented Oct 5, 2023

So... this is easy to do, I have it running in my fork.

Unfortunately

  • the existing artifact can't be used to publish to Pages (pages requires a zip that contains a tar that contains a single directory)
  • sigstore-conformance will break if I add another artifact

Plan:

  • patch sigstore-conformance to not break if it sees multiple artifacts, hopefully there are no other users of this?
  • later merge branch that adds another artifact and GH pages publish to this project
  • later switch sigstore-conformance to actually use the GH pages published artifact

@woodruffw
Copy link
Collaborator

That plan SGTM -- I think it's safe to assume that sigstore-conformance is the only current user.

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

Successfully merging a pull request may close this issue.

2 participants