git-commit-vandalism/Documentation/config
Derrick Stolee 6dcbdc0d66 remote: create fetch.credentialsInUrl config
Users sometimes provide a "username:password" combination in their
plaintext URLs. Since Git stores these URLs in plaintext in the
.git/config file, this is a very insecure way of storing these
credentials. Credential managers are a more secure way of storing this
information.

System administrators might want to prevent this kind of use by users on
their machines.

Create a new "fetch.credentialsInUrl" config option and teach Git to
warn or die when seeing a URL with this kind of information. The warning
anonymizes the sensitive information of the URL to be clear about the
issue.

This change currently defaults the behavior to "allow" which does
nothing with these URLs. We can consider changing this behavior to
"warn" by default if we wish. At that time, we may want to add some
advice about setting fetch.credentialsInUrl=ignore for users who still
want to follow this pattern (and not receive the warning).

An earlier version of this change injected the logic into
url_normalize() in urlmatch.c. While most code paths that parse URLs
eventually normalize the URL, that normalization does not happen early
enough in the stack to avoid attempting connections to the URL first. By
inserting a check into the remote validation, we identify the issue
before making a connection. In the old code path, this was revealed by
testing the new t5601-clone.sh test under --stress, resulting in an
instance where the return code was 13 (SIGPIPE) instead of 128 from the
die().

However, we can reuse the parsing information from url_normalize() in
order to benefit from its well-worn parsing logic. We can use the struct
url_info that is created in that method to replace the password with
"<redacted>" in our error messages. This comes with a slight downside
that the normalized URL might look slightly different from the input URL
(for instance, the normalized version adds a closing slash). This should
not hinder users figuring out what the problem is and being able to fix
the issue.

As an attempt to ensure the parsing logic did not catch any
unintentional cases, I modified this change locally to to use the "die"
option by default. Running the test suite succeeds except for the
explicit username:password URLs used in t5550-http-fetch-dumb.sh and
t5541-http-push-smart.sh. This means that all other tested URLs did not
trigger this logic.

The tests show that the proper error messages appear (or do not
appear), but also count the number of error messages. When only warning,
each process validates the remote URL and outputs a warning. This
happens twice for clone, three times for fetch, and once for push.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-06-06 09:32:32 -07:00
..
add.txt Start to implement a built-in version of git add --interactive 2019-11-14 11:10:04 +09:00
advice.txt sequencer: advise if skipping cherry-picked commit 2021-08-30 16:35:36 -07:00
alias.txt
am.txt
apply.txt
blame.txt blame: correct name of config option in docs 2021-06-28 10:05:13 -07:00
branch.txt Merge branch 'js/branch-track-inherit' 2022-01-10 11:52:54 -08:00
browser.txt
checkout.txt parallel-checkout: add configuration options 2021-04-19 11:57:05 -07:00
clean.txt
clone.txt builtin/clone.c: add --reject-shallow option 2021-04-01 12:58:58 -07:00
color.txt Merge branch 'hm/paint-hits-in-log-grep' 2021-11-01 13:48:08 -07:00
column.txt
commit.txt
commitgraph.txt commit-graph: use config to specify generation type 2021-02-25 15:10:41 -08:00
completion.txt
core.txt Merge branch 'ew/decline-core-abbrev' 2021-01-15 15:20:28 -08:00
credential.txt crendential-store: use timeout when locking file 2020-11-25 12:30:18 -08:00
diff.txt rename: bump limit defaults yet again 2021-07-15 16:54:34 -07:00
difftool.txt
extensions.txt
fastimport.txt
feature.txt
fetch.txt remote: create fetch.credentialsInUrl config 2022-06-06 09:32:32 -07:00
filter.txt
fmt-merge-msg.txt
format.txt Merge branch 'jc/format-patch-name-max' 2020-11-21 15:14:38 -08:00
fsck.txt
gc.txt gc docs: change --keep-base-pack to --keep-largest-pack 2020-11-21 11:39:55 -08:00
gitcvs.txt
gitweb.txt
gpg.txt Merge branch 'gh/gpg-doc-markup-fix' 2022-01-05 14:01:30 -08:00
grep.txt grep: clarify what grep.patternType=default means 2021-12-05 12:26:43 -08:00
gui.txt docs: use "character encoding" to refer to commit-object encoding 2021-08-27 12:45:45 -07:00
guitool.txt
help.txt help.c: help.autocorrect=prompt waits for user action 2021-08-14 11:20:49 -07:00
http.txt doc: fix some typos 2021-01-04 11:27:48 -08:00
i18n.txt
imap.txt
index.txt sparse-index: add index.sparse config option 2021-03-30 12:57:47 -07:00
init.txt clone: respect remote unborn HEAD 2021-02-05 13:49:55 -08:00
instaweb.txt
interactive.txt
log.txt diff-merges: introduce log.diffMerges config variable 2021-04-16 23:38:35 -07:00
lsrefs.txt ls-refs: report unborn targets of symrefs 2021-02-05 13:49:53 -08:00
mailinfo.txt
mailmap.txt
maintenance.txt maintenance: incremental strategy runs pack-refs weekly 2021-02-09 23:09:29 -08:00
man.txt
merge.txt update documentation for new zdiff3 conflictStyle 2021-12-01 14:45:59 -08:00
mergetool.txt mergetool: do not enable hideResolved by default 2021-03-13 15:30:29 -08:00
notes.txt
pack.txt midx.c: respect 'pack.writeBitmapHashcache' when writing bitmaps 2021-09-14 16:34:18 -07:00
pager.txt
pretty.txt
protocol.txt
pull.txt pull: remove support for --rebase=preserve 2021-09-07 21:45:32 -07:00
push.txt Merge branch 'fc/push-simple-updates' 2021-07-13 16:52:49 -07:00
rebase.txt rebase: remove transitory rebase.useBuiltin setting & env 2021-03-23 14:05:58 -07:00
receive.txt
remote.txt
remotes.txt
repack.txt
rerere.txt
reset.txt
safe.txt setup: opt-out of check with safe.directory=* 2022-04-13 12:42:51 -07:00
sendemail.txt send-email: remove non-working support for "sendemail.smtpssl" 2021-05-28 18:38:07 +09:00
sequencer.txt
showbranch.txt
splitindex.txt
ssh.txt
stash.txt stash show: use stash.showIncludeUntracked even when diff options given 2021-05-22 17:56:46 +09:00
status.txt
submodule.txt doc: clarify description of 'submodule.recurse' 2021-07-20 14:57:43 -07:00
tag.txt
tar.txt
trace2.txt doc: fix some typos 2021-01-04 11:27:48 -08:00
transfer.txt docs: clarify the interaction of transfer.hideRefs and namespaces 2021-09-01 07:54:30 -07:00
uploadarchive.txt
uploadpack.txt list-objects: implement object type filter 2021-04-19 14:09:11 -07:00
url.txt
user.txt ssh signing: support non ssh-* keytypes 2021-11-19 09:05:25 -08:00
versionsort.txt
web.txt
worktree.txt