Skip to content

Use trusted publishing for Cargo crates - #17426

Merged
arlosi merged 1 commit into
rust-lang:masterfrom
Kobzol:trusted-publishing
Oct 6, 2026
Merged

arlosi merged 1 commit into
rust-lang:masterfrom
Kobzol:trusted-publishing

Conversation

@Kobzol

@Kobzol Kobzol commented Sep 2, 2026 •

Copy link
Copy Markdown
Member

Companion to rust-lang/team#2727. This is done to improve publishing security, and allow us to track Cargo crates in the team database.

CC @Mark-Simulacrum (probably you'll want to wait until the next release? or we can test drive it tomorrow on 1.98.1 :) )

CARGO_REGISTRY_TOKEN should be removed from this repository once this PR is merged.

@rustbot rustbot added A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 2, 2026
@rustbot

rustbot commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

r? @epage

rustbot has assigned @epage.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @epage, @weihanglo
  • @epage, @weihanglo expanded to epage, weihanglo
  • Random selection from epage, weihanglo

@epage

epage commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

With this, is manual token publishing being removed? We occasionally need to do one-off publishes and don't have CI setup for that. Granted Eric was the only one who could do that and unsure if he handed that off to anyone else.

@Kobzol

Kobzol commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

The whole idea of trusted publishing is to publish only from CI, yeah. How did the one-off publishes work? We can still make the publish process be manually triggered, e.g. by clicking on a workflow in the GitHub UI.

@epage

epage commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The whole idea of trusted publishing is to publish only from CI, yeah.

No, trusted publishing is about providing a more secure way to publish from an automated system and does not convey any more trust than local, manual publishing. The name is very confusing. See also https://blog.yossarian.net/2026/07/07/You-shouldnt-trust-trusted-publishing. William Woodruff and I talked about this on Zulip when they were proposing to add it to crates.io.

@epage

epage commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

We can still make the publish process be manually triggered, e.g. by clicking on a workflow in the GitHub UI.

Eric handled it. The current workflow is insufficient because it is designed for releases and doesn' handle things like home.

@Kobzol

Kobzol commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

The whole idea of trusted publishing is to publish only from CI, yeah.

No, trusted publishing is about providing a more secure way to publish from an automated system and does not convey any more trust than local, manual publishing. The name is very confusing. See also https://blog.yossarian.net/2026/07/07/You-shouldnt-trust-trusted-publishing. William Woodruff and I talked about this on Zulip when they were proposing to add it to crates.io.

I'm aware of that discussion :) And I agree that the name is not ideal, but the point is still the same, you have to publish from CI (meaning, if we move forward with the infra plan, it just won't be possible to publish otherwise). So we should figure out how to make that work for all use-cases of t-cargo.

Eric handled it. The current workflow is insufficient because it is designed for releases and doesn' handle things like home.

We can add parameters to the workflow, e.g. in the GitHub UI you can run it manually and select which crates to publish via a comma-separated list. Or we could add a script that will do the same.

@weihanglo

Copy link
Copy Markdown
Member

Eric handled it. The current workflow is insufficient because it is designed for releases and doesn' handle things like home.

We can add parameters to the workflow, e.g. in the GitHub UI you can run it manually and select which crates to publish via a comma-separated list. Or we could add a script that will do the same.

Yes, home is the only thing left. Other are handled by t-release. I don't expect any meaningful release in the future for home. Maybe we should discontinue home and instead create a new repo called rustup-cargo-home co-owned by t-rustup and t-cargo, so we don't need to deal with this out-of-band publish in rust-lang/cargo repo.

@Kobzol

Kobzol commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

I think that's a bit orthogonal to using trusted publishing, but in general moving that crate to a separate repository sounds like a useful cleanup on its own, at least to me.

@weihanglo

Copy link
Copy Markdown
Member

With this, is manual token publishing being removed? We occasionally need to do one-off publishes and don't have CI setup for that. Granted Eric was the only one who could do that and unsure if he handed that off to anyone else.

Handed off to me (as you can see I am one of the owner).

Some packages are not published automatically because they are not part of the Rust release train. This currently only includes the home package. These are published manually on an as-needed or as-requested basis by whoever has permissions (currently @ehuss or the Release/Infra team)2.

home is the only crate needing manual publish. That was why I think home simplifies adding trusted publishing workflow to cargo.

@Kobzol

Kobzol commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

Ah, ok. If home is indeed the only one, and otherwise Cargo is always published through tags, then that would indeed simplify things. But we can still add support for manual publishes to Cargo if needed :)

@weihanglo

Copy link
Copy Markdown
Member

The conclusion in #t-cargo > discontinue `home` and a new rustup-cargo-util shared repo is kinda we probably want to keep home or future cargo-util-home in the same repo, so still needs some manual-publish escape hatch.

@Kobzol

Kobzol commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

Home wasn't published by this GHA workflow anyway, right? So we just won't add it to the team repo yet, and then nothing changes for it.

@arlosi arlosi left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! We talked about this in the Cargo meeting today and agreed to move forward.

View changes since this review

@arlosi
arlosi added this pull request to the merge queue Oct 6, 2026
Merged via the queue into rust-lang:master with commit 62f3d21 Oct 6, 2026
28 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 6, 2026
@ubiratansoares

Copy link
Copy Markdown

FYK : I removed CARGO_REGISTRY_TOKEN from the release environment. Token invalidation to follow

@Kobzol
Kobzol deleted the trusted-publishing branch October 6, 2026 16:40
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 7, 2026
Update cargo submodule

11 commits in f3865b2a4d1acc5276f6b3c67d0e057f4dab3928..45c3aacf0e8dabdcdb6b7b518db100061d6367a7
2026-09-29 19:58:08 +0000 to 2026-10-06 16:29:08 +0000
- feat(pkgid-spec): Builtin package spec parsing and formatting (rust-lang/cargo#17539)
- feat(hints): support minimum optimization levels (rust-lang/cargo#17368)
- Use trusted publishing for Cargo crates (rust-lang/cargo#17426)
- feat(trim-paths): stabilize `profile.trim-paths` (rust-lang/cargo#17488)
- fix(pkgid): avoid panic on malformed protocol URLs (rust-lang/cargo#17548)
- fix(git)!: Default to net.git-fetch-with-cli if git is present (rust-lang/cargo#17329)
- Improved testsuite file permissions cleanup (rust-lang/cargo#17547)
- docs(guide): Give an example of checking for stale lockfile (rust-lang/cargo#17546)
- Add new peak memory table to cargo timings enabled via `-Zmem-stats` (rust-lang/cargo#17531)
- docs(changlog): Update 1.100.0 to reflect a beta backport (rust-lang/cargo#17542)
- feat(lint): Making the lint name a terminal hyperlink to docs (rust-lang/cargo#17538)
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 7, 2026
Update cargo submodule

11 commits in f3865b2a4d1acc5276f6b3c67d0e057f4dab3928..45c3aacf0e8dabdcdb6b7b518db100061d6367a7
2026-09-29 19:58:08 +0000 to 2026-10-06 16:29:08 +0000
- feat(pkgid-spec): Builtin package spec parsing and formatting (rust-lang/cargo#17539)
- feat(hints): support minimum optimization levels (rust-lang/cargo#17368)
- Use trusted publishing for Cargo crates (rust-lang/cargo#17426)
- feat(trim-paths): stabilize `profile.trim-paths` (rust-lang/cargo#17488)
- fix(pkgid): avoid panic on malformed protocol URLs (rust-lang/cargo#17548)
- fix(git)!: Default to net.git-fetch-with-cli if git is present (rust-lang/cargo#17329)
- Improved testsuite file permissions cleanup (rust-lang/cargo#17547)
- docs(guide): Give an example of checking for stale lockfile (rust-lang/cargo#17546)
- Add new peak memory table to cargo timings enabled via `-Zmem-stats` (rust-lang/cargo#17531)
- docs(changlog): Update 1.100.0 to reflect a beta backport (rust-lang/cargo#17542)
- feat(lint): Making the lint name a terminal hyperlink to docs (rust-lang/cargo#17538)
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Oct 8, 2026
Update cargo submodule



15 commits in f3865b2a4d1acc5276f6b3c67d0e057f4dab3928..29c5daa1afc262323364e039bb70c83372cc702c
2026-09-29 19:58:08 +0000 to 2026-10-07 22:13:48 +0000
- test: mark requiring ssh for tests shelling out to it (rust-lang/cargo#17563)
- chore(deps): update msrv (rust-lang/cargo#17532)
- fix(rustdoc): suppress edition unspecified warnings (rust-lang/cargo#17557)
- chore(deps): update cargo-semver-checks to v0.51.0 (rust-lang/cargo#17553)
- feat(pkgid-spec): Builtin package spec parsing and formatting (rust-lang/cargo#17539)
- feat(hints): support minimum optimization levels (rust-lang/cargo#17368)
- Use trusted publishing for Cargo crates (rust-lang/cargo#17426)
- feat(trim-paths): stabilize `profile.trim-paths` (rust-lang/cargo#17488)
- fix(pkgid): avoid panic on malformed protocol URLs (rust-lang/cargo#17548)
- fix(git)!: Default to net.git-fetch-with-cli if git is present (rust-lang/cargo#17329)
- Improved testsuite file permissions cleanup (rust-lang/cargo#17547)
- docs(guide): Give an example of checking for stale lockfile (rust-lang/cargo#17546)
- Add new peak memory table to cargo timings enabled via `-Zmem-stats` (rust-lang/cargo#17531)
- docs(changlog): Update 1.100.0 to reflect a beta backport (rust-lang/cargo#17542)
- feat(lint): Making the lint name a terminal hyperlink to docs (rust-lang/cargo#17538)
@rustbot rustbot added this to the 1.101.0 milestone Oct 8, 2026
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Oct 10, 2026
Update cargo submodule



15 commits in f3865b2a4d1acc5276f6b3c67d0e057f4dab3928..29c5daa1afc262323364e039bb70c83372cc702c
2026-09-29 19:58:08 +0000 to 2026-10-07 22:13:48 +0000
- test: mark requiring ssh for tests shelling out to it (rust-lang/cargo#17563)
- chore(deps): update msrv (rust-lang/cargo#17532)
- fix(rustdoc): suppress edition unspecified warnings (rust-lang/cargo#17557)
- chore(deps): update cargo-semver-checks to v0.51.0 (rust-lang/cargo#17553)
- feat(pkgid-spec): Builtin package spec parsing and formatting (rust-lang/cargo#17539)
- feat(hints): support minimum optimization levels (rust-lang/cargo#17368)
- Use trusted publishing for Cargo crates (rust-lang/cargo#17426)
- feat(trim-paths): stabilize `profile.trim-paths` (rust-lang/cargo#17488)
- fix(pkgid): avoid panic on malformed protocol URLs (rust-lang/cargo#17548)
- fix(git)!: Default to net.git-fetch-with-cli if git is present (rust-lang/cargo#17329)
- Improved testsuite file permissions cleanup (rust-lang/cargo#17547)
- docs(guide): Give an example of checking for stale lockfile (rust-lang/cargo#17546)
- Add new peak memory table to cargo timings enabled via `-Zmem-stats` (rust-lang/cargo#17531)
- docs(changlog): Update 1.100.0 to reflect a beta backport (rust-lang/cargo#17542)
- feat(lint): Making the lint name a terminal hyperlink to docs (rust-lang/cargo#17538)
github-actions Bot pushed a commit to rust-lang/stdarch that referenced this pull request Oct 12, 2026
Update cargo submodule



15 commits in f3865b2a4d1acc5276f6b3c67d0e057f4dab3928..29c5daa1afc262323364e039bb70c83372cc702c
2026-09-29 19:58:08 +0000 to 2026-10-07 22:13:48 +0000
- test: mark requiring ssh for tests shelling out to it (rust-lang/cargo#17563)
- chore(deps): update msrv (rust-lang/cargo#17532)
- fix(rustdoc): suppress edition unspecified warnings (rust-lang/cargo#17557)
- chore(deps): update cargo-semver-checks to v0.51.0 (rust-lang/cargo#17553)
- feat(pkgid-spec): Builtin package spec parsing and formatting (rust-lang/cargo#17539)
- feat(hints): support minimum optimization levels (rust-lang/cargo#17368)
- Use trusted publishing for Cargo crates (rust-lang/cargo#17426)
- feat(trim-paths): stabilize `profile.trim-paths` (rust-lang/cargo#17488)
- fix(pkgid): avoid panic on malformed protocol URLs (rust-lang/cargo#17548)
- fix(git)!: Default to net.git-fetch-with-cli if git is present (rust-lang/cargo#17329)
- Improved testsuite file permissions cleanup (rust-lang/cargo#17547)
- docs(guide): Give an example of checking for stale lockfile (rust-lang/cargo#17546)
- Add new peak memory table to cargo timings enabled via `-Zmem-stats` (rust-lang/cargo#17531)
- docs(changlog): Update 1.100.0 to reflect a beta backport (rust-lang/cargo#17542)
- feat(lint): Making the lint name a terminal hyperlink to docs (rust-lang/cargo#17538)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants