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

OIDC API Key Role RFC #49

Merged
merged 5 commits into from
Jul 30, 2023
Merged

Conversation

segiddins
Copy link
Member

@segiddins segiddins commented Jun 27, 2023

@indirect
Copy link
Member

This is a great start! The motivation section does a great job with "why", and the guide section does a great job with "what". I think most of what's in the "guide" section right now is actually implementation/reference details, and the guide should be something like "You are a RubyGems developer with MFA enabled, and you want to automated publishing gems. Here's how you do that: Step 1, 2, 3."

For reference/comparison, here is the PyPi parallel effort, called "Trusted Publishers":

If it's easier to compare/contrast using the Python version as a base, that seems reasonable.

@segiddins
Copy link
Member Author

@indirect is what I added what you have in mind?

@indirect
Copy link
Member

indirect commented Jul 3, 2023

Yes! I think that's close enough to discuss and approve the overall idea. 👍🏻

To ship the implementation as completed, I think we'll need the "guide" to be a bit more fleshed out, including the actual steps that are needed. For example, what are the gem publishers supposed to do with the example JSON documents? Where does the ID that they supply to the GitHub Action come from? etc. Feel free to either flesh out the guide here and then copy it into the docs later, or include the more complete docs alongside the implementation once you are more sure about how it will work.

@segiddins
Copy link
Member Author

including the actual steps that are needed

I think I included that? To start with, I plan on shipping the OIDC work without a public facing UI, which means the way to get set up will be through an admin using the admin interface.

Once we have some beta users and confirm the implementation (and with it, associated data structures) works for all involved, I was planning to build a UI at that point.

If that doesn't work for you, then I have to go back and build all that now, which will delay getting the core implementation released.

@indirect
Copy link
Member

indirect commented Jul 7, 2023

It's fine to ship it for testing with manual setup by maintainers. 👍 I just mean the actual docs, even if setup is manual by admins, will need to explain more granular detail about e.g. how to get the ID you put into the GitHub Action config.

@segiddins
Copy link
Member Author

Would it be better if i changed it to use the provider URL instead of the ID, and added in a unique index on the URL?

@indirect
Copy link
Member

indirect commented Jul 7, 2023

I'm not sure, but probably, if that makes it clearer what the config value is for?

@segiddins
Copy link
Member Author

OK never mind, I mis-understood. We end up using the ID because we need something to look up that uniquely identifies the API Key Role, without a priori being able to scope to a user.

I suppose we could do something like a user-supplied label that is combined with the account handle? But that's not great since the handles can change...

I think using the ID is fine for now. You will get it back (eventually) when you POST to create the API Key Role, you can find it when GETing the list of the current users API Key Roles, etc.

@segiddins segiddins marked this pull request as ready for review July 19, 2023 00:29
@segiddins segiddins changed the title wip: OIDC API Key Role RFC OIDC API Key Role RFC Jul 19, 2023
Copy link
Member

@jenshenny jenshenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great - happy to see this being introduced! 🚀 Planning to take a look at rubygems/rubygems.org#3716 shortly


1. Create a new API key role on RubyGems.org, configured with the desired permissions and access policy.

(At first release of this feature, API keys roles will be configured by the RubyGems.org team, via a support request)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would users submit a support request? Would this just be via email/slack or would it be a request form (asking for scopes, gem, etc) in RubyGems.org? I'm assuming the form could be slightly altered when it's released for the general audience.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for now, via a support request (email) or in slack. when ready to release to GA, there will be an API and web form for this

- What does the design for this look like when we allow onboarding Providers / API Key Roles through the web UI?
- How should we protect a future API that allows for creating & updating API key roles?
- What claims, if any, should we surface in the UI / API? What should that look like?
- How will we determine when to make this feature generally available?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be transparent, Shopify's publishing infrastructure is not using Github Actions currently though the goal is to migrate over. We would love to use this feature org-wide once the migration is completed, however it's to be determined where it is on the roadmap.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have an OIDC provider available to your publishing infra? If so, I'm happy to add it as another supported provider in the beta period

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not readily available, we're currently using shipit-engine. No need to add another provider, as Github Actions is what we're moving towards (just the timeline is a bit unknown at the moment).

@segiddins segiddins merged commit 61a3016 into rubygems:master Jul 30, 2023
@segiddins segiddins deleted the segiddins/oidc branch July 30, 2023 23:17
segiddins added a commit to rubygems/rubygems.org that referenced this pull request Aug 17, 2023
- Is the schema for Access Policies extensible enough to support arbitrary OIDC providers / the claims they will sign?
- What does the design for this look like when we allow onboarding Providers / API Key Roles through the web UI?
- How should we protect a future API that allows for creating & updating API key roles?
- What claims, if any, should we surface in the UI / API? What should that look like?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

References:


I'm most interested in the repository and job_workflow_ref claim, like octo-org/octo-automation/.github/workflows/oidc.yml@refs/heads/main.

I want that so:

  • I can compare to the repository specified by the gem.
  • I can compare the refs/tags/v1.2.3 portion to the version of the gem that was generated. That makes me comfortable the gem wasn't published by an issue_comment event that allowed script injection.
  • I can fetch and analyze the workflow file that produced the release
    • Maybe I'll make sure there is only one .jobs[] with .permissions["id-token"]: write
    • Maybe I'll look at the .job[].steps[].uses and match against an allowlist (e.g. I want the workflow to contain only actions/checkout@.*, ruby/setup-ruby@.* and rubygems/release-gem@.* steps.
    • The code in https://github.com/ossf/scorecard-webapp/blob/main/app/server/verify_workflow.go is a good implementation of ways one might want to verify the workflow file doesn't contain any shenaningans.
  • I especially like how this attribute works with reusable workflows. If https://github.com/rubygems/release-gem included a reusable workflow for users instead of an example workflow to copy/paste, then I could match against job_workflow_ref: rubygems/release-gem/.github/workflows/release.yml@.* to allow any gems published using the "approved" workflow.

Please redirect if there is a better place for this discussion ❤️ .

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 this pull request may close these issues.

4 participants