-
Notifications
You must be signed in to change notification settings - Fork 616
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
publish: Use description
, license
and license_file
fields from embedded Cargo.toml
file
#7194
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Turbo87
added
C-internal 🔧
Category: Nonessential work that would make the codebase more consistent or clear
A-backend ⚙️
labels
Sep 27, 2023
Turbo87
force-pushed
the
desc-license-from-manifest
branch
from
September 27, 2023 12:00
767b9c4
to
c8fc07f
Compare
Turbo87
force-pushed
the
desc-license-from-manifest
branch
from
September 27, 2023 12:14
c8fc07f
to
9c9599e
Compare
/cc myself I will take a look tomorrow. |
☔ The latest upstream changes (presumably c2946d9) made this pull request unmergeable. Please resolve the merge conflicts. |
There are a couple of cases to consider here: - if a krate with the same name exists, `existing_crate` will be `Some(_)` and the `max_upload_size` value is used. - if no krate with the same name exists yet, `existing_crate` will be `None` and the default size limits are used. - if no krate with the same name exists yet and there are two concurrent publish requests, the default size limits are used. this should be fine since there is no way to increase the size limits during publish or via the API in general. tl;dr there is a potential race condition here, but it doesn't matter for this specific case
…SERT` SQL queries This will allow us to use the data from the `Cargo.toml` file in the tarball instead of the JSON metadata blob.
…file` fields from embedded `Cargo.toml` file ... instead of the metadata JSON blob
…icense_file` fields These fields are no longer read by our server, so we can skip the deserialization step.
Turbo87
force-pushed
the
desc-license-from-manifest
branch
from
September 27, 2023 12:57
9c9599e
to
d48b5ad
Compare
LawnGnome
approved these changes
Sep 27, 2023
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.
One trivial question, but no substantive concerns. LGTM! 👍
This was referenced Sep 28, 2023
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-backend ⚙️
C-internal 🔧
Category: Nonessential work that would make the codebase more consistent or clear
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR changes our handling of the
description
,license
andlicense_file
fields so that they are read from theCargo.toml
file embedded in the crate tarball, instead of the metadata JSON blob.This is another step forward towards avoiding issues like https://blog.vlt.sh/blog/the-massive-hole-in-the-npm-ecosystem in the Rust ecosystem. Note that, compared to e.g. npm, this is currently not exploitable due to the way cargo works, but it is still confusing to our users if the metadata does not match what is actually in the tarball.
This change required a small reordering of things in the publish endpoint. Specifically, the publish size limit is read from the database earlier than previously, which could potentially cause a race condition, but from what I can tell this race condition should not matter in practice (see commit message for details). Similarly, the tarball analysis step now happens before we run any
INSERT
queries on the database, since the tarball analysis result is now needed before we can insert anything. Thirdly, the description and license validation now happens after the tarball analysis for obvious reasons.