Skip to content

Commit 9a35c0b

Browse files
committed
Auto merge of #12507 - arlosi:1password, r=epage
credential-providers: make 1password no longer built-in Since 1password is just one of many potential CLI-based credential providers, it makes more sense for it to be installable as a plugin rather than built-in to Cargo. This means that `cargo:1password` will no longer work as a credential provider. The replacement would be `cargo install cargo-credential-1password` and using `cargo-credential-1password` instead. r? `@ehuss`
2 parents 7b61184 + b74e5a0 commit 9a35c0b

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ base64 = "0.21.2"
2020
bytesize = "1.2"
2121
cargo = { path = "" }
2222
cargo-credential = { version = "0.3.0", path = "credential/cargo-credential" }
23-
cargo-credential-1password = { version = "0.3.0", path = "credential/cargo-credential-1password" }
2423
cargo-credential-wincred = { version = "0.3.0", path = "credential/cargo-credential-wincred" }
2524
cargo-credential-macos-keychain = { version = "0.3.0", path = "credential/cargo-credential-macos-keychain" }
2625
cargo-platform = { path = "crates/cargo-platform", version = "0.1.4" }
@@ -123,7 +122,6 @@ base64.workspace = true
123122
bytesize.workspace = true
124123
cargo-platform.workspace = true
125124
cargo-credential.workspace = true
126-
cargo-credential-1password.workspace = true
127125
cargo-credential-macos-keychain.workspace = true
128126
cargo-credential-wincred.workspace = true
129127
cargo-util.workspace = true

credential/cargo-credential-1password/src/lib.rs renamed to credential/cargo-credential-1password/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,7 @@ impl Credential for OnePasswordCredential {
301301
}
302302
}
303303
}
304+
305+
fn main() {
306+
cargo_credential::main(OnePasswordCredential {});
307+
}

src/cargo/util/auth/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ fn credential_action(
449449
"cargo:token" => Box::new(TokenCredential::new(config)),
450450
"cargo:paseto" => Box::new(PasetoCredential::new(config)),
451451
"cargo:token-from-stdout" => Box::new(BasicProcessCredential {}),
452-
"cargo:1password" => Box::new(cargo_credential_1password::OnePasswordCredential {}),
453452
"cargo:wincred" => Box::new(cargo_credential_wincred::WindowsCredential {}),
454453
"cargo:macos-keychain" => Box::new(cargo_credential_macos_keychain::MacKeychain {}),
455454
process => Box::new(CredentialProcessCredential::new(process)),

src/doc/src/reference/unstable.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,18 +1108,27 @@ executed within the Cargo process. They are identified with the `cargo:` prefix.
11081108
* `CARGO_REGISTRY_NAME_OPT` --- Optional name of the registry. Should not be used as a storage key. Not always available.
11091109

11101110
* `cargo:paseto` - implements asymmetric token support (RFC3231) as a credential provider.
1111-
* `cargo:1password`: Uses the 1password `op` CLI to store the token. You must
1112-
install the `op` CLI from the [1password
1113-
website](https://1password.com/downloads/command-line/). You must run `op
1114-
signin` at least once with the appropriate arguments (such as `op signin
1115-
my.1password.com [email protected]`), unless you provide the sign-in-address
1116-
and email arguments. The master password will be required on each request
1117-
unless the appropriate `OP_SESSION` environment variable is set. It supports
1118-
the following command-line arguments:
1119-
* `--account`: The account shorthand name to use.
1120-
* `--vault`: The vault name to use.
1121-
* `--sign-in-address`: The sign-in-address, which is a web address such as `my.1password.com`.
1122-
* `--email`: The email address to sign in with.
1111+
1112+
1113+
`cargo-credential-1password` uses the 1password `op` CLI to store the token. You must
1114+
install the `op` CLI from the [1password
1115+
website](https://1password.com/downloads/command-line/). You must run `op
1116+
signin` at least once with the appropriate arguments (such as `op signin
1117+
my.1password.com [email protected]`), unless you provide the sign-in-address
1118+
and email arguments. The master password will be required on each request
1119+
unless the appropriate `OP_SESSION` environment variable is set. It supports
1120+
the following command-line arguments:
1121+
* `--account`: The account shorthand name to use.
1122+
* `--vault`: The vault name to use.
1123+
* `--sign-in-address`: The sign-in-address, which is a web address such as `my.1password.com`.
1124+
* `--email`: The email address to sign in with.
1125+
1126+
Install the provider with `cargo install cargo-credential-1password`
1127+
In the config, add it to `global-credential-providers`:
1128+
```toml
1129+
[registry]
1130+
global-credential-providers = ["cargo-credential-1password"]
1131+
```
11231132

11241133
A wrapper is available for GNOME
11251134
[libsecret](https://wiki.gnome.org/Projects/Libsecret) to store tokens on

0 commit comments

Comments
 (0)