-
Notifications
You must be signed in to change notification settings - Fork 645
controllers/krate/publish: Add support for Trusted Publishing access tokens #11294
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
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of non-binding suggestions, but LGTM in general. I like the new trustpub
test, in particular! :+1
When "Trusted Publishing" is used we can no longer associate the release with a specific crates.io user account. The column is already nullable since old releases did not track the information, so there are no changes needed on the database side.
🙋 I was wondering if we could use the creator of the trustpub config as |
I think that could be misleading, since it is not the person that triggered the release itself. It might be possible to figure out the releaser from the |
🙋 Another question came up. I noticed that only the regular (non-TrustPub) AuthType requires a verified email for publishing, while the TrustPub AuthType does not seem to require this. Would it be bad to ensure email is verified before creating a trustpub config? |
yeah, we should probably implement that 👍 |
Some(_) => EndpointScope::PublishUpdate, | ||
None => EndpointScope::PublishNew, | ||
}; | ||
let trustpub_token = req |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might still like a small explanatory comment here along the lines of:
let trustpub_token = req | |
// Trusted publishing tokens are distinguished from regular crates.io API tokens because they | |
// use the Bearer auth scheme, so we look for that specific prefix. | |
let trustpub_token = req |
But if you think that's unnecessary, that's not a blocker.
.transpose() | ||
.map_err(|_| forbidden("Invalid authentication token"))?; | ||
|
||
let auth = if let Some(trustpub_token) = trustpub_token { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely clearer than before, so 👍.
This is the last major missing puzzle piece for the Trusted Publishing backend work: the ability to use temporary access tokens to publish new versions of crates.
Related:
PUT /api/v1/trusted_publishing/github_configs
API endpoint #11113PUT /api/v1/trusted_publishing/tokens
API endpoint #11131