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

Protection for account resurrection attacks on GitLab OIDC Trusted Publishing #15643

Open
facutuesca opened this issue Mar 20, 2024 · 1 comment

Comments

@facutuesca
Copy link
Contributor

facutuesca commented Mar 20, 2024

(For context, a GitLab namespace is like a GitHub organization/user. E.g: samplenamespace is the namespace of the https://gitlab.com/samplenamespace/repository project.)

As specified in the GitLab OIDC publisher documentation, currently PyPI does not fetch the GitLab namespace ID when setting up a Trusted Publisher.

This means the claim verification is done against the namespace's (string) name. For example, setting up a trusted publisher for https://gitlab.com/samplenamespace/sampleproject//release.yml will check that the OIDC claims contain the namespace samplenamespace.

In contrast, the GitHub Trusted Publishing implementation fetches the org/user ID during creation of the Trusted Publisher, and checks the claim against that ID. This protects against account resurrection attacks, since a namespace can be deleted and a new one with the same name created, but IDs are unique.

Currently, implementing this the same way we do it on GitHub TPs is not possible due to a limitation of GitLab's API. It's not possible to fetch the ID of a public personal namespace (think username in https://gitlab.com/username/repository). See this comment for an explanation and more details of the limitation.

A possible solution for this could be implementing a TOFU (Trust On First Use) scheme, where the ID of the namespace is read from the claims of the OIDC token the first time the Trusted Publisher is used, and stored as part of the TP's configuration and used to validate future claims.

cc @di @woodruffw

@facutuesca facutuesca added feature request requires triaging maintainers need to do initial inspection of issue labels Mar 20, 2024
@woodruffw woodruffw added trusted-publishing and removed requires triaging maintainers need to do initial inspection of issue labels Mar 20, 2024
@woodruffw
Copy link
Member

Thanks @facutuesca!

(I asked @facutuesca to file this as a separate issue so that we don't lose track of it. As previously discussed, it isn't a priority for the current implementation given limitations on GitLab's side + complexity tradeoffs on PyPI's side.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants