@@ -28,28 +28,28 @@ keyring.
28
28
[ guide-level-explanation ] : #guide-level-explanation
29
29
30
30
Suppose a user has their authentication token stored in a password manager, and
31
- the password manager provides a command, ` creds cargo` , to decrypt and print
32
- that token in a secure way. Instead of also storing the token in plaintext, the
33
- user can add this snippet to their own ` .cargo/credentials ` to authenticate
34
- with crates.io:
31
+ the password manager provides a command, ` /usr/bin/ cargo-creds ` , to decrypt and
32
+ print that token in a secure way. Instead of also storing the token in
33
+ plaintext, the user can add this snippet to their own ` .cargo/credentials ` to
34
+ authenticate with crates.io:
35
35
36
36
``` toml
37
37
[registry ]
38
- token-from-process = " creds cargo"
38
+ token-from-process = " /usr/bin/ cargo-creds "
39
39
```
40
40
41
41
When authentication is required Cargo will execute the command and use its
42
- output as the token, which will never be stored by Cargo on disk. The command
43
- will be executed inside the system's shell environment, to allow the usage of
44
- CLI utilities :
42
+ output as the token, which will never be stored by Cargo on disk. If the
43
+ command requires arguments, for example ` password-manager creds crates-io ` , you
44
+ can add them in a list :
45
45
46
46
``` toml
47
47
[registry ]
48
- token-from-process = " creds cargo | awk '{print($2)}' "
48
+ token-from-process = [ " password-manager " , " creds" , " crates-io " ]
49
49
```
50
50
51
- It will be possible to use ` token-from-process ` on both crates.io and alternative
52
- registries.
51
+ It will be possible to use ` token-from-process ` on both crates.io and
52
+ alternative registries.
53
53
54
54
# Reference-level explanation
55
55
[ reference-level-explanation ] : #reference-level-explanation
@@ -60,12 +60,15 @@ When a `token` key is also present, the latter will take precedence over
60
60
` token-from-process ` to maintain backward compatibility, and a warning will be
61
61
issued to let the user know about that.
62
62
63
+ The ` token-from-process ` key accepts either a string containing the binary to
64
+ call or a list containing the binary name and the arguments to provide to it.
65
+
63
66
When a ` cargo ` subcommand needs the authentication token, Cargo will execute
64
- the string contained in the configuration key with the system shell ( ` cmd.exe `
65
- on Windows and ` sh ` on other platforms ). The process will inherit Cargo's
66
- standard input and error, and the standard output will be captured by Cargo to
67
- read the token (with trimmed newlines). If the command returns an exit code
68
- other than ` 0 ` Cargo will treat that as a failure.
67
+ the binary contained in the configuration key with the defined arguments (if
68
+ provided by the user ). The process will inherit Cargo's standard input and
69
+ error, and the standard output will be captured by Cargo to read the token
70
+ (with trimmed newlines). If the command returns an exit code other than ` 0 `
71
+ Cargo will treat that as a failure.
69
72
70
73
The following environment variables will be provided to the executed command:
71
74
@@ -75,8 +78,7 @@ The following environment variables will be provided to the executed command:
75
78
# Drawbacks
76
79
[ drawbacks ] : #drawbacks
77
80
78
- This RFC requires cargo to execute a command with the system shell, which could
79
- make it more difficult to port Cargo to a new operative system without a shell.
81
+ * No known drawbacks yet.*
80
82
81
83
# Rationale and alternatives
82
84
[ rationale-and-alternatives ] : #rationale-and-alternatives
@@ -104,8 +106,8 @@ secret storage we expect a lot of users to use.
104
106
Multiple command line tools implement this system or a similar one to retrieve
105
107
authentication tokens or other secrets:
106
108
107
- * [ awscli] [ awscli ] includes the ` credentials_process ` setting with the same
108
- behavior as the one proposed in this RFC.
109
+ * [ awscli] [ awscli ] includes the ` credentials_process ` setting with nearly the
110
+ same behavior as the one proposed in this RFC.
109
111
* [ Docker CLI] [ docker ] offers "credential stores", programs the Docker CLI
110
112
calls with specific arguments expecting JSON output. Implementations are
111
113
provided for common storage systems, and the protocol is documented for users
@@ -120,7 +122,7 @@ authentication tokens or other secrets:
120
122
# Unresolved questions
121
123
[ unresolved-questions ] : #unresolved-questions
122
124
123
- * Nothing here yet.*
125
+ * No known unresolved questions yet.*
124
126
125
127
# Future possibilities
126
128
[ future-possibilities ] : #future-possibilities
0 commit comments