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: add initial PyPI docs #24772

Closed
wants to merge 20 commits into from
Closed

Conversation

woodruffw
Copy link
Contributor

This is a work in progress.

Why:

Closes #24594.

What's being changed (if available, include any code snippets, screenshots, or gifs):

This adds some documentation and a guide for OIDC federation between GitHub and PyPI, the Python Package Index. PyPI's OIDC publishing support is currently in a closed beta, so these changes are not 100% ready for public consumption yet; I'm just pushing this up for visibility + to get the ball rolling for when they become generally available 🙂

Check off the following:

  • I have reviewed my changes in staging (look for the "Automatically generated comment" and click the links in the "Preview" column to view your latest changes).
  • For content changes, I have completed the self-review checklist.

@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Mar 30, 2023
@github-actions
Copy link
Contributor

👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:
.devcontainer/**
.github/actions-scripts/**
.github/workflows/**
.github/CODEOWNERS
assets/fonts/**
data/graphql/**
Dockerfile*
src/**
lib/redirects/**
package*.json
scripts/**
content/actions/deployment/security-hardening-your-deployments/**

You'll need to revert all of the files you changed in that list using GitHub Desktop or git checkout origin/main <file name>. Once you get those files reverted, we can continue with the review process. :octocat:

@github-actions
Copy link
Contributor

github-actions bot commented Mar 30, 2023

Automatically generated comment ℹ️

This comment is automatically generated and will be overwritten every time changes are committed to this branch.

The table contains an overview of files in the content directory that have been changed in this pull request. It's provided to make it easy to review your changes on the staging site. Please note that changes to the data directory will not show up in this table.


Content directory changes

You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request.

Source Preview Production What Changed
actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect.md fpt
ghec
ghes@ 3.10 3.9 3.8 3.7 3.6
fpt
ghec
ghes@ 3.10 3.9 3.8 3.7 3.6
New file: actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-pypi.md fpt
ghec
fpt
ghec

fpt: Free, Pro, Team
ghec: GitHub Enterprise Cloud
ghes: GitHub Enterprise Server
ghae: GitHub AE

@cmwilson21
Copy link
Contributor

@woodruffw Thanks for the PR and for linking it to your issue! ✨

As this isn't ready yet, I'm going to triage it for review, but we won't merge this until you're ready. Please ping me again here when it's ready for merge ⚡

@cmwilson21 cmwilson21 added content This issue or pull request belongs to the Docs Content team actions This issue or pull request should be reviewed by the docs actions team waiting for review Issue/PR is waiting for a writer's review and removed triage Do not begin working on this issue until triaged by the team labels Mar 30, 2023
@cmwilson21
Copy link
Contributor

Actually, would this be better served as a draft PR until it's ready?

@woodruffw
Copy link
Contributor Author

Thanks for triaging @cmwilson21! I think this can be considered ready for review; I see the CI is red but I assume that it's mostly just lints that I need to handle 🙂

@github-actions

This comment was marked as outdated.

Signed-off-by: William Woodruff <william@trailofbits.com>
@github-actions

This comment was marked as outdated.

@woodruffw
Copy link
Contributor Author

Lintage fixed, but I'm not sure what's up with the link check -- perhaps that's failing because of the warnings about these files not being editable by third-party contributors? The path looks correct to me 🙂

@webknjaz
Copy link

webknjaz commented Apr 3, 2023

@woodruffw does this need the updated "Trusted Publishers" terminology injected in some of the places in these docs?

@github-actions

This comment was marked as outdated.

@woodruffw
Copy link
Contributor Author

does this need the updated "Trusted Publishers" terminology injected in some of the places in these docs?

Yep, I've made those changes -- I've preserved "OIDC" in places where we're talking about the GitHub functionality or IdP specifically, and changed the rest to "trusted publishing."

@woodruffw
Copy link
Contributor Author

@cmwilson21 This should be good for another review! The only failures are in the unallowed files check and the link checker, both of which I believe are happening because I'm not technically allowed to modify these 🙂

CC @MylesBorins and @steiza for factual/style checks as well, since I know you're invested in this landing 🙂

Copy link
Member

@steiza steiza left a comment

Choose a reason for hiding this comment

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

Thanks @woodruffw, some minor comments, otherwise looks great to me!

@github-actions

This comment was marked as off-topic.

Co-authored-by: Zach Steindler <steiza@github.com>
@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
@github-actions

This comment was marked as outdated.

1 similar comment
@github-actions
Copy link
Contributor

👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:
.devcontainer/**
.github/actions-scripts/**
.github/workflows/**
.github/CODEOWNERS
assets/fonts/**
data/graphql/**
Dockerfile*
src/**
lib/redirects/**
package*.json
scripts/**
content/actions/deployment/security-hardening-your-deployments/**

You'll need to revert all of the files you changed in that list using GitHub Desktop or git checkout origin/main <file name>. Once you get those files reverted, we can continue with the review process. :octocat:

Co-authored-by: Joe Clark <31087804+jc-clark@users.noreply.github.com>
@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

Signed-off-by: William Woodruff <william@trailofbits.com>
@github-actions

This comment was marked as outdated.

@woodruffw
Copy link
Contributor Author

Is there any way we can suppress these bot comments? This PR intentionally modifies files (due to a request from GH for docs) that would otherwise be considered out of scope for a third-party contribution.

@github-actions
Copy link
Contributor

👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:
.devcontainer/**
.github/actions-scripts/**
.github/workflows/**
.github/CODEOWNERS
assets/fonts/**
data/graphql/**
Dockerfile*
src/**
lib/redirects/**
package*.json
scripts/**
content/actions/deployment/security-hardening-your-deployments/**

You'll need to revert all of the files you changed in that list using GitHub Desktop or git checkout origin/main <file name>. Once you get those files reverted, we can continue with the review process. :octocat:

@github-actions
Copy link
Contributor

👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:
.devcontainer/**
.github/actions-scripts/**
.github/workflows/**
.github/CODEOWNERS
assets/fonts/**
data/graphql/**
Dockerfile*
src/**
lib/redirects/**
package*.json
scripts/**
content/actions/deployment/security-hardening-your-deployments/**

You'll need to revert all of the files you changed in that list using GitHub Desktop or git checkout origin/main <file name>. Once you get those files reverted, we can continue with the review process. :octocat:

@hubwriter
Copy link
Contributor

It looks like this could be merged. However, we can't do this here in this repo due to rules restricting changes to this part of the documentation in the OS repository. I'll create a new PR in our internal docs repo and move these changes over there so that we can get this merged.

@woodruffw - Many thanks for contributing to the docs.

@hubwriter hubwriter closed this Sep 11, 2023
Copy link

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

@hubwriter I've found several improvement possibilities. Would you be open to incorporating them in follow-ups?

Also, we're working on updating the PyPUG guide that might be of interest here: pypa/packaging.python.org#1261.

# NOTE: put your own distribution build steps here.
python -m build

- name: upload windows dists

Choose a reason for hiding this comment

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

Not "windows" dists but Python distribution packages.

name: release-dists
path: dist/

pypi-publish:

Choose a reason for hiding this comment

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

I'd add an environment example here.

- Owner: `myorg`
- Repository name: `myproject`
- Workflow name: `release.yml`
- (Optionally) a GitHub Actions environment name: `release`

Choose a reason for hiding this comment

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

I think the release name is confusing. I used to use it myself in the past but moved away from it in favor of pypi:

  1. There could be testpypi and other envs too, calling this one pypi describes the destination accurately.
  2. There could be other targets in separate jobs like publishing to GH releases etc.
  3. All of above could match the name release because it's overly generic. But semantically, those would be different release targets.
  4. Some of the envs would need protection rules while other would be unconditional (like requiring a human approval for PyPI but not TestPyPI).


```yaml{:copy}
jobs:
release-build:

Choose a reason for hiding this comment

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

I'd probably explicitly drop the privileges in this job or globally and emphasized that building must be done in a locked down environment that is separate from the publishing having elevated privileges.


To use OIDC with PyPI, add a trust configuration that links each project on PyPI to each repository and workflow combination that's allowed to publish for it.

1. Log into PyPI and navigate to the trusted publishing settings for the project you'd like to configure. For a project named `myproject`, this will be at `https://pypi.org/manage/project/myproject/settings/publishing/`.

Choose a reason for hiding this comment

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

This could clarify that it shows an example for existing projects but it's possible to achieve the same with fresh ones too.

@hubwriter
Copy link
Contributor

hubwriter commented Sep 11, 2023

@hubwriter I've found several improvement possibilities. Would you be open to incorporating them in follow-ups?

Thanks @webknjaz. If you could use the code review functionality for suggesting a specific change:

to indicate exactly what changes you would like to make to the Markdown I can transfer those suggestions to the new PR I've opened internally.

@hubwriter
Copy link
Contributor

Status update:

We're handling the changes currently proposed in this PR by @woodruffw in an internal PR now. This excludes any further changes arising from @webknjaz's comments (which I propose we handle with a new docs issue). The relevant product manager requested a couple of SMEs look at this and they have now got back to me. One of the SMEs asked for some further information. I have contacted @woodruffw directly about this.

Once I get sign-off from the SME I will merge/publish our internal PR.

@hubwriter
Copy link
Contributor

The new article has now been published:
https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-pypi

Many thanks @woodruffw for contributing this. 🎖️

@webknjaz - If you would like to suggest changes to the article please raise a docs issue:
https://github.com/github/docs/issues/new/choose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actions This issue or pull request should be reviewed by the docs actions team content This issue or pull request belongs to the Docs Content team waiting for review Issue/PR is waiting for a writer's review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OIDC: Add documentation + guidance for using GitHub's OpenID Connect provider with PyPI
7 participants