-
Notifications
You must be signed in to change notification settings - Fork 642
Add deleted_crates
database table
#9912
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9912 +/- ##
==========================================
- Coverage 89.16% 89.06% -0.10%
==========================================
Files 292 294 +2
Lines 30316 30419 +103
==========================================
+ Hits 27031 27094 +63
- Misses 3285 3325 +40 ☔ View full report in Codecov by Sentry. |
a11076b
to
eb45233
Compare
@walterhpearce and I had a discussion this morning, and he's going to write it up in #9904, but we're probably going to need to track the versions in deleted crates as well. So let's hold this for now pending that write up, please. |
I don't think #9904 is the right place for this though. We already perform deletions through the admin tool and that PR is just enabling users to do it by themselves.
when? the RFC has been merged 2.5 months ago. would've been good to get input back then when it was still open... |
The main concern I discussed with @LawnGnome is around immediate takeover of a crate for malicious purposes. The threat scenario is the event of a author deleting a crate, and an attacker publishing the same name and version, or the same name and a semver-compatible version. In both of these cases, what mechanisms exist to notify the user that this is occuring? Does Cargo.lock checksums prevent the immediate update scenario? What about updates occuring for a semver-compat update? I think it is an open question on where the responsibility for this lies - the open question was whether crates should enforce such a version-prevention mechanisms (force a major version bump), or should a flag be present for My gut says option #2, the user notification, is the ideal scenario here. |
yes, unless there is a bug in cargo that skips the checksum checks that should be the case
the crate deletion RFC gives 4 different conditions that need to be met for users to be able to self-delete crates:
the combination of these IMHO makes this a somewhat unlikely scenario.
the same could be said about crate transfers, which we already allow. but for the common use case of "I named my crate actix_web, but realized it should have been actix-web" it would be a bit unfortunate for the author to not be able to republish their existing versions. I guess it could be a limit only if a different author uses the name, but I'm not sure it is really worth the complexity.
I'm open to something like that, but that needs design work and a) I don't know enough about cargo to be able to do that and b) I don't think we should block the deletion tracking on an implementation on the cargo side, since that would likely delay the RFC implementation by months. |
I noticed that the Should we consider the delete action as a |
considering that currently only people with Heroku admin access can use the tool and that those have database access too, I think it's safe enough 😉
|
This table will be used to record when a crate was deleted, (optionally) why it was deleted, who deleted it, and when it will be available for re-creation again.
eb45233
to
31f08b3
Compare
(This is kind of a combo comment for this and #9904, but since the most recent conversation is here, I'm going to put it here.) I think we're agreed that the answer to the open RFC question around deleted crate name reuse is "allow reuse, with some minimal restrictions", which this PR implements. I'm still grappling with the question around versions, though. Given that, I set up a couple of test cases to see what would happen, assuming normal use of lockfiles by a user.1 Basic set up:
The good news: without any changes, a lockfile does the expected:
The less good news: a simple
For completeness, publishing a crate with the same versionPublishing a crate with the exact same version and trying to rebuild
To be clear: I don't think But I think the So, in summary: I'm happy to merge this as-is, (pending a proper review momentarily, but I had a quick look and I think it's fine at first glance), but I think we also need a Footnotes
|
yeah, that matches what I expected
given the constraints/requirements that we have set for being able to delete a crate I'm not sure whether we actually need to require this. (see #9912 (comment))
if we were to implement this we might want to have a quick chat about the design and what exactly we are trying to solve here. if this is about "don't let the new user publish something semver compatible" then something like a
thanks for the review :) |
That's true — the reverse dependency and download checks do (greatly) reduce the risk here. While they're good heuristics to avoid general ecosystem disruption, I can imagine corner cases where this might still be a problem, though (large company uses a crate that literally nobody else uses, it gets deleted, someone is sloppy on the internal code review when pulling a new version in).
I'm more concerned about the semver-compatible case, since an actual version match should trigger the checksum failure noted above. A
I'm open to feedback on whether that's enough of a problem in practice to be worth the extra complexity. |
if large company uses the crate then shouldn't we see this reflected in the download numbers? answering my own question: if they use an internal crates.io proxy, we might not see the full download numbers. so yeah, it's a potential edge case. but how likely that is... 🤷♂️
if they want to do pre-release stuff then
I'd invoke my regular "if in doubt, ask/check what the other registries are doing" 😅 |
I guess my concern is that the hypothetical new crate author might want to be able to do a 0.x version to clearly communicate that they're still developing their crate, but realistically, let's wait until that's a real concern and go from there. We can transition from " I'll put a PR together for the |
This table will be used to record when a crate was deleted, (optionally) why it was deleted, who deleted it, and when it will be available for re-creation again. I've kept the database dump visibility as private for now. We can decide later whether to make it public or not, and what fields to include.
The
delete-crate
admin tool is adjusted to fill the new table, optionally recording--deleted-by
and--message
parameters. Note that the admin tool defaults toavailable_at = deleted_at
for now, to match the current behavior. This can be adjusted in a dedicated pull request if we decide to do so.The publish endpoint is adjusted to check the new table for availability of the crate name before accepting the publish.
This PR should address #9904 (comment) by making it possible for the crate deletion endpoint to set
available_at = deleted_at + 24 hours
or whatever other value we choose (including0 hours
). It also addresses a couple of requests/comments over the years to track deletions in a more structured way than adding a comment to a Zulip thread.