Skip to content

Commit 4a169da

Browse files
avargitster
authored andcommitted
fetch doc: note "pushurl" caveat about "credentialsInUrl", elaborate
Amend the documentation and release notes entry for the "fetch.credentialsInUrl" feature added in 6dcbdc0 (remote: create fetch.credentialsInUrl config, 2022-06-06), it currently doesn't detect passwords in `remote.<name>.pushurl` configuration. We shouldn't lull users into a false sense of security, so we need to mention that prominently. This also elaborates and clarifies the "exposes the password in multiple ways" part of the documentation. As noted in [1] a user unfamiliar with git's implementation won't know what to make of that scary claim, e.g. git hypothetically have novel git-specific ways of exposing configured credentials. The reality is that this configuration is intended as an aid for users who can't fully trust their OS's or system's security model, so lets say that's what this is intended for, and mention the most common ways passwords stored in configuration might inadvertently get exposed. 1. https://lore.kernel.org/git/[email protected]/ Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Acked-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8168d5e commit 4a169da

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

Documentation/RelNotes/2.37.0.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ UI, Workflows & Features
5555
* Update the doctype written in gitweb output to xhtml5.
5656

5757
* The "fetch.credentialsInUrl" configuration variable controls what
58-
happens when a URL with embedded login credential is used.
58+
happens when a URL with embedded login credential is used on either
59+
"fetch" or "push". Credentials are currently only detected in
60+
`remote.<name>.url` config, not `remote.<name>.pushurl`.
5961

6062

6163
Performance, Internal Implementation, Development Support etc.

Documentation/config/fetch.txt

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,34 @@ fetch.writeCommitGraph::
9898
`git push -f`, and `git log --graph`. Defaults to false.
9999

100100
fetch.credentialsInUrl::
101-
A URL can contain plaintext credentials in the form
102-
`<protocol>://<user>:<password>@<domain>/<path>`. Using such URLs
103-
is not recommended as it exposes the password in multiple ways,
104-
including Git storing the URL as plaintext in the repository config.
105-
The `fetch.credentialsInUrl` option provides instruction for how Git
106-
should react to seeing such a URL, with these values:
101+
A configured URL can contain plaintext credentials in the form
102+
`<protocol>://<user>:<password>@<domain>/<path>`. You may want
103+
to warn or forbid the use of such configuration (in favor of
104+
using linkgit:git-credential[1]).
105+
+
106+
Note that this is currently limited to detecting credentials in
107+
`remote.<name>.url` configuration, it won't detect credentials in
108+
`remote.<name>.pushurl` configuration.
109+
+
110+
You might want to enable this to prevent inadvertent credentials
111+
exposure, e.g. because:
112+
+
113+
* The OS or system where you're running git may not provide way way or
114+
otherwise allow you to configure the permissions of the
115+
configuration file where the username and/or password are stored.
116+
* Even if it does, having such data stored "at rest" might expose you
117+
in other ways, e.g. a backup process might copy the data to another
118+
system.
119+
* The git programs will pass the full URL to one another as arguments
120+
on the command-line, meaning the credentials will be exposed to oher
121+
users on OS's or systems that allow other users to see the full
122+
process list of other users. On linux the "hidepid" setting
123+
documented in procfs(5) allows for configuring this behavior.
124+
+
125+
If such concerns don't apply to you then you probably don't need to be
126+
concerned about credentials exposure due to storing that sensitive
127+
data in git's configuration files. If you do want to use this, set
128+
`fetch.credentialsInUrl` to one of these values:
107129
+
108130
* `allow` (default): Git will proceed with its activity without warning.
109131
* `warn`: Git will write a warning message to `stderr` when parsing a URL

0 commit comments

Comments
 (0)