Skip to content

Commit 07cac75

Browse files
committed
feat: stabilize credential-process and registry-auth
1 parent 4518131 commit 07cac75

File tree

24 files changed

+550
-448
lines changed

24 files changed

+550
-448
lines changed
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
# cargo-credential-1password
22

3-
This is the implementation for the Cargo credential helper for [1password].
4-
See the [credential-process] documentation for how to use this.
3+
A Cargo [credential provider] for [1password].
4+
5+
`cargo-credential-1password` uses the 1password `op` CLI to store the token. You must
6+
install the `op` CLI from the [1password
7+
website](https://1password.com/downloads/command-line/). You must run `op signin`
8+
at least once with the appropriate arguments (such as `op signin my.1password.com [email protected]`),
9+
unless you provide the sign-in-address and email arguments. The master password will be required on each request
10+
unless the appropriate `OP_SESSION` environment variable is set. It supports
11+
the following command-line arguments:
12+
* `--account`: The account shorthand name to use.
13+
* `--vault`: The vault name to use.
14+
* `--sign-in-address`: The sign-in-address, which is a web address such as `my.1password.com`.
15+
* `--email`: The email address to sign in with.
516

617
[1password]: https://1password.com/
7-
[credential-process]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#credential-process
18+
[credential provider]: https://doc.rust-lang.org/nightly/cargo/reference/registry-authentication.html

credential/cargo-credential-libsecret/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
This is the implementation for the Cargo credential helper for [GNOME libsecret].
44
See the [credential-process] documentation for how to use this.
55

6+
This credential provider is built-in to cargo as `cargo:libsecret`.
7+
68
[GNOME libsecret]: https://wiki.gnome.org/Projects/Libsecret
7-
[credential-process]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#credential-process
9+
[credential-process]: https://doc.rust-lang.org/nightly/cargo/reference/registry-authentication.html

credential/cargo-credential-macos-keychain/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
This is the implementation for the Cargo credential helper for [macOS Keychain].
44
See the [credential-process] documentation for how to use this.
55

6+
This credential provider is built-in to cargo as `cargo:macos-keychain`.
7+
68
[macOS Keychain]: https://support.apple.com/guide/keychain-access/welcome/mac
7-
[credential-process]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#credential-process
9+
[credential-process]: https://doc.rust-lang.org/nightly/cargo/reference/registry-authentication.html
10+

credential/cargo-credential-wincred/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
This is the implementation for the Cargo credential helper for [Windows Credential Manager].
44
See the [credential-process] documentation for how to use this.
55

6+
This credential provider is built-in to cargo as `cargo:wincred`.
7+
68
[Windows Credential Manager]: https://support.microsoft.com/en-us/windows/accessing-credential-manager-1b5c916a-6a16-889f-8581-fc16e8165ac0
7-
[credential-process]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#credential-process
9+
[credential-process]: https://doc.rust-lang.org/nightly/cargo/reference/registry-authentication.html

credential/cargo-credential/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ provides an interface to store tokens for authorizing access to a registry
55
such as https://crates.io/.
66

77
Documentation about credential processes may be found at
8-
https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#credential-process
8+
https://doc.rust-lang.org/nightly/cargo/reference/credential-provider-protocol.html
99

1010
Example implementations may be found at
1111
https://github.com/rust-lang/cargo/tree/master/credential

src/cargo/core/features.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,6 @@ unstable_cli_options!(
729729
check_cfg: Option<(/*features:*/ bool, /*well_known_names:*/ bool, /*well_known_values:*/ bool, /*output:*/ bool)> = ("Specify scope of compile-time checking of `cfg` names/values"),
730730
codegen_backend: bool = ("Enable the `codegen-backend` option in profiles in .cargo/config.toml file"),
731731
config_include: bool = ("Enable the `include` key in config files"),
732-
credential_process: bool = ("Add a config setting to fetch registry authentication tokens by calling an external process"),
733732
direct_minimal_versions: bool = ("Resolve minimal dependency versions instead of maximum (direct dependencies only)"),
734733
doctest_xcompile: bool = ("Compile and run doctests for non-host target using runner config"),
735734
dual_proc_macros: bool = ("Build proc-macros for both the host and the target"),
@@ -745,7 +744,6 @@ unstable_cli_options!(
745744
panic_abort_tests: bool = ("Enable support to run tests with -Cpanic=abort"),
746745
profile_rustflags: bool = ("Enable the `rustflags` option in profiles in .cargo/config.toml file"),
747746
publish_timeout: bool = ("Enable the `publish.timeout` key in .cargo/config.toml file"),
748-
registry_auth: bool = ("Authentication for alternative registries"),
749747
rustdoc_map: bool = ("Allow passing external documentation mappings to rustdoc"),
750748
rustdoc_scrape_examples: bool = ("Allows Rustdoc to scrape code examples from reverse-dependencies"),
751749
script: bool = ("Enable support for single-file, `.rs` packages"),
@@ -819,6 +817,12 @@ const STABILIZED_TERMINAL_WIDTH: &str =
819817

820818
const STABILISED_SPARSE_REGISTRY: &str = "The sparse protocol is now the default for crates.io";
821819

820+
const STABILIZED_CREDENTIAL_PROCESS: &str =
821+
"Authentication with a credential provider is always available.";
822+
823+
const STABILIZED_REGISTRY_AUTH: &str =
824+
"Authenticated registries are available if a credential provider is configured.";
825+
822826
fn deserialize_build_std<'de, D>(deserializer: D) -> Result<Option<Vec<String>>, D::Error>
823827
where
824828
D: serde::Deserializer<'de>,
@@ -1084,6 +1088,8 @@ impl CliUnstable {
10841088
"sparse-registry" => stabilized_warn(k, "1.68", STABILISED_SPARSE_REGISTRY),
10851089
"terminal-width" => stabilized_warn(k, "1.68", STABILIZED_TERMINAL_WIDTH),
10861090
"doctest-in-workspace" => stabilized_warn(k, "1.72", STABILIZED_DOCTEST_IN_WORKSPACE),
1091+
"credential-process" => stabilized_warn(k, "1.74", STABILIZED_CREDENTIAL_PROCESS),
1092+
"registry-auth" => stabilized_warn(k, "1.74", STABILIZED_REGISTRY_AUTH),
10871093

10881094
// Unstable features
10891095
// Sorted alphabetically:
@@ -1101,7 +1107,6 @@ impl CliUnstable {
11011107
}
11021108
"codegen-backend" => self.codegen_backend = parse_empty(k, v)?,
11031109
"config-include" => self.config_include = parse_empty(k, v)?,
1104-
"credential-process" => self.credential_process = parse_empty(k, v)?,
11051110
"direct-minimal-versions" => self.direct_minimal_versions = parse_empty(k, v)?,
11061111
"doctest-xcompile" => self.doctest_xcompile = parse_empty(k, v)?,
11071112
"dual-proc-macros" => self.dual_proc_macros = parse_empty(k, v)?,
@@ -1122,7 +1127,6 @@ impl CliUnstable {
11221127
"panic-abort-tests" => self.panic_abort_tests = parse_empty(k, v)?,
11231128
"profile-rustflags" => self.profile_rustflags = parse_empty(k, v)?,
11241129
"publish-timeout" => self.publish_timeout = parse_empty(k, v)?,
1125-
"registry-auth" => self.registry_auth = parse_empty(k, v)?,
11261130
"rustdoc-map" => self.rustdoc_map = parse_empty(k, v)?,
11271131
"rustdoc-scrape-examples" => self.rustdoc_scrape_examples = parse_empty(k, v)?,
11281132
"separate-nightlies" => self.separate_nightlies = parse_empty(k, v)?,

src/cargo/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@
9191
//! This is the `#[cargo_test]` proc-macro used by the test suite to define tests.
9292
//! - [`credential`](https://github.com/rust-lang/cargo/tree/master/credential)
9393
//! This subdirectory contains several packages for implementing the
94-
//! experimental
95-
//! [credential-process](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#credential-process)
96-
//! feature.
94+
//! [credential providers](https://doc.rust-lang.org/nightly/cargo/reference/registry-authentication.html).
9795
//! - [`mdman`](https://github.com/rust-lang/cargo/tree/master/crates/mdman)
9896
//! ([nightly docs](https://doc.rust-lang.org/nightly/nightly-rustc/mdman/index.html)):
9997
//! This is a utility for generating cargo's man pages. See [Building the man

src/cargo/ops/registry/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ fn registry(
145145
None,
146146
operation,
147147
vec![],
148+
false,
148149
)?)
149150
} else {
150151
None

src/cargo/ops/registry/publish.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> {
161161
None,
162162
operation,
163163
vec![],
164+
false,
164165
)?));
165166
}
166167

src/cargo/sources/registry/download.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ pub(super) fn download(
8585
None,
8686
Operation::Read,
8787
vec![],
88+
true,
8889
)?)
8990
} else {
9091
None

0 commit comments

Comments
 (0)