Skip to content

script: Add crate-backup.py#13469

Merged
Turbo87 merged 3 commits intorust-lang:mainfrom
Turbo87:add-crate-backup-script
Apr 23, 2026
Merged

script: Add crate-backup.py#13469
Turbo87 merged 3 commits intorust-lang:mainfrom
Turbo87:add-crate-backup-script

Conversation

@Turbo87
Copy link
Copy Markdown
Member

@Turbo87 Turbo87 commented Apr 21, 2026

Adds a small Python script that downloads all published .crate files for one or more crates into the current working directory.

Useful during security incident response to preserve all versions of a crate for later analysis after the immediate issue has been handled.

Usage

python3 script/crate-backup.py serde tokio

@Turbo87 Turbo87 requested a review from a team April 21, 2026 07:00
@Turbo87
Copy link
Copy Markdown
Member Author

Turbo87 commented Apr 21, 2026

/cc @rust-lang/security @walterhpearce

@Turbo87 Turbo87 added the C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear label Apr 21, 2026
@Turbo87 Turbo87 force-pushed the add-crate-backup-script branch from f73c236 to 6424bbb Compare April 21, 2026 15:12
@rustbot

This comment has been minimized.

Copy link
Copy Markdown
Member

@emilyalbini emilyalbini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, commented on a possible small feature to add.

View changes since this review

Comment thread script/crate-backup.py
def list_versions(crate):
url = f"https://crates.io/api/v1/crates/{crate}/versions"
with fetch(url) as resp:
data = json.load(resp)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if this also saved the download counts for each version and wrote them to a file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done ✅

Turbo87 added 3 commits April 22, 2026 16:30
Useful during security incident response to preserve all versions of a crate for later analysis after the immediate issue has been handled.
@Turbo87 Turbo87 force-pushed the add-crate-backup-script branch from 6424bbb to 8c32642 Compare April 22, 2026 14:37
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 22, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Turbo87 Turbo87 merged commit 10b0cd7 into rust-lang:main Apr 23, 2026
13 checks passed
@Turbo87 Turbo87 deleted the add-crate-backup-script branch April 23, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants