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

Provide Trusted Publisher information pypi's API #14799

Closed
Tracked by #15871
lukehinds opened this issue Oct 24, 2023 · 7 comments
Closed
Tracked by #15871

Provide Trusted Publisher information pypi's API #14799

lukehinds opened this issue Oct 24, 2023 · 7 comments

Comments

@lukehinds
Copy link

What's the problem this feature will solve?

Trusted publisher is now a feature in pypi, with plans to render the information on the UI care of #14727 - "verified via Trusted Publishing"

It would be useful to provide the same information via the API. This way anyone who ingests the API and consults the metadata such as source repository, has an improved level of confidence that this is correct (over the previous implementation which allowed publishers to stuff made up values in setup.py / pyproject.toml)

Describe the solution you'd like

Render a value via the API to signify the package was published using trusted publisher.

Additional context

@lukehinds lukehinds added feature request requires triaging maintainers need to do initial inspection of issue labels Oct 24, 2023
@miketheman miketheman added APIs/feeds trusted-publishing and removed requires triaging maintainers need to do initial inspection of issue labels Oct 24, 2023
@di di added the requires triaging maintainers need to do initial inspection of issue label Nov 2, 2023
@di
Copy link
Member

di commented Nov 2, 2023

Thanks for the issue @lukehinds.

I'm not sure I see the value in an API field like trusted_publishing: true -- this doesn't actually provide any additional assurances about where the package came from or whether the provided metadata is accurate. An attacker (e.g. a starjacker) could still publish from one repository via trusted publishing and say the project is from another repo.

Instead, it would probably make more sense to expose something like the repository URL that has been configured for trusted publishing, but this is a fairly GitHub-centric view and wouldn't cover other future publishers that we have plans to add support for (like Activestate, Google Cloud Build, etc). We'd need to think about how to do this in a consistent way that still allows us to accommodate the potential variations between different trusted publishers.

@lukehinds
Copy link
Author

An attacker (e.g. a starjacker) could still publish from one repository via trusted publishing and say the project is from another repo.

I can't confess to have read the code behind TP, but are you sure its possible to just stuff any value in? From what I can tell you have explicitly list the repo and workflow URI in order for OIDC publishing to work. If no validation still occurs, that's quite an omission.

image

@di
Copy link
Member

di commented Nov 2, 2023

It is possible to put any information you want in those fields, but it's only possible to publish from the repository that's been configured.

However, that's not what I'm talking about: regardless of what is in those fields, metadata like Project-Url comes from the artifact itself and doesn't currently have any relationship to what trusted publisher is configured (which is why we're talking about 'verifying' it in #14727). We don't currently surface the values that trusted publishing is configured with anywhere publicly.

@lukehinds
Copy link
Author

Thanks for the info @dl. I might not have been clear enough here with my thinking, my suggestion is when we are 'verifying' it in #14727 , we also expose the same via the API.

@woodruffw
Copy link
Member

Triaging: this is included in PEP 740, which we're tracking with #15871 🙂

@woodruffw woodruffw removed the requires triaging maintainers need to do initial inspection of issue label Jul 9, 2024
@woodruffw
Copy link
Member

Update: TP metadata is now indirectly supplied in the simple HTML and JSON APIs, per PEP 740.

xref: #16546

@di
Copy link
Member

di commented Sep 11, 2024

(This was temporarily rolled back, but will be resolved soon, so I'll leave this closed)

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

4 participants