Skip to content

Commit bbe11f8

Browse files
committed
Added section on authentication for git registries; clarified section on https requirements
1 parent d2bd2ec commit bbe11f8

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

text/0000-cargo-alternative-registry-auth.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- Feature Name: cargo_alternative_registry_auth
22
- Start Date: 2021-03-31
3-
- RFC PR: rust-lang/rfcs#0000
3+
- RFC PR: rust-lang/rfcs#3139
44
- Tracking Issue: rust-lang/rust#0000
55

66
# Summary
@@ -40,13 +40,13 @@ To avoid the overhead of an extra HTTP request when fetching `config.json`, the
4040

4141
```toml
4242
[registries]
43-
my-registry = { index = "https://example.com/index", auth-required = true }
43+
my-registry = { index = "sparse+https://example.com/index", auth-required = true }
4444
```
4545

46-
## Security considerations
47-
If the server responds with an HTTP redirect, the redirect would be followed, but the Authorization header would not be sent to the redirect target.
46+
## Security
47+
If the server responds with an HTTP redirect, the redirect would be followed, but the Authorization header would *not* be sent to the redirect target.
4848

49-
The authorization header would only be included for requests using `https` or requests targeting `localhost`. If cargo detected an alternative registry was configured to send the authorization token over an insecure channel, it would exit with an error informing the user.
49+
The authorization header would only be included for requests using `https://`. Under no circumstances would cargo pass an authorization header over an unencrypted `http://` connection. If cargo detected an alternative registry was configured to send the authorization token over an insecure channel, it would exit with an error.
5050

5151
## Interaction with `credential-process`
5252
The unstable [credential-process](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#credential-process) feature stores credentials keyed on the registry api url, which is only available in after fetching `config.json` from the index. If access to the index is secured using the authorization token, then Cargo will be unable to fetch the `config.json` file before calling the credential process.
@@ -58,6 +58,7 @@ To resolve this issue, the credential process feature would use the registry *in
5858

5959
Since the token may be used multiple times in a single cargo session (such as updating the index + downloading crates), Cargo should cache the token if it is provided by a `credential-process` to avoid repeatedly calling the credential process.
6060

61+
6162
## Command line options
6263
Cargo commands such as `install` or `search` that support an `--index <INDEX>` command line option to use a registry other than what is available in the configuration file would gain a `--token <TOKEN>` command line option (similar to `publish` today). If a `--token <TOKEN>` command line option is given, the provided authorization token would be sent along with the request.
6364

@@ -97,4 +98,10 @@ Alternatives:
9798
# Future possibilities
9899
[future-possibilities]: #future-possibilities
99100

100-
The `credential-process` system could be extended to support generating tokens rather than only storing them. This would further improve security and allow additional features such as 2FA prompts.
101+
## Credential Process
102+
The `credential-process` system could be extended to support generating tokens rather than only storing them. This would further improve security and allow additional features such as 2FA prompts.
103+
104+
## Authentication for Git-based registries
105+
Private registries may want to use the same Authorization header for controlling access to a git-based index over `https`, rather than letting git handle the authentication separately.
106+
107+
This could be enabled by the same local configuration key `auth-required = true` in the `[registries]` table. Both `libgit2` and the `git` command line have a mechanism for specifying an additional header that could be used to pass the Authorization header.

0 commit comments

Comments
 (0)