summaryrefslogtreecommitdiff
path: root/t/t5541-http-push-smart.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-07-13 23:36:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-07-14 16:23:20 (GMT)
commit882d49ca5cb6a584a37ab0266b8720b5b0bf2101 (patch)
tree212c066ae080bb18d488a2ee864eee6a0f572fe0 /t/t5541-http-push-smart.sh
parent765428699a5381f113d19974720bc91b5bfeaf1d (diff)
downloadgit-882d49ca5cb6a584a37ab0266b8720b5b0bf2101.zip
git-882d49ca5cb6a584a37ab0266b8720b5b0bf2101.tar.gz
git-882d49ca5cb6a584a37ab0266b8720b5b0bf2101.tar.bz2
push: anonymize URL in status output
Commit 47abd85 (fetch: Strip usernames from url's before storing them, 2009-04-17) taught fetch to anonymize URLs. The primary purpose there was to avoid sticking passwords in merge-commit messages, but as a side effect, we also avoid printing them to stderr. The push side does not have the merge-commit problem, but it probably should avoid printing them to stderr. We can reuse the same anonymizing function. Note that for this to come up, the credentials would have to appear either on the command line or in a git config file, neither of which is particularly secure. So people _should_ be switching to using credential helpers instead, which makes this problem go away. But that's no excuse not to improve the situation for people who for whatever reason end up using credentials embedded in the URL. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5541-http-push-smart.sh')
-rwxr-xr-xt/t5541-http-push-smart.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
index fd7d06b..8d08e06 100755
--- a/t/t5541-http-push-smart.sh
+++ b/t/t5541-http-push-smart.sh
@@ -368,5 +368,12 @@ test_expect_success GPG 'push with post-receive to inspect certificate' '
test_cmp expect "$HTTPD_DOCUMENT_ROOT_PATH/push-cert-status"
'
+test_expect_success 'push status output scrubs password' '
+ test_commit scrub &&
+ git push --porcelain "$HTTPD_URL_USER_PASS/smart/test_repo.git" >status &&
+ # should have been scrubbed down to vanilla URL
+ grep "^To $HTTPD_URL/smart/test_repo.git" status
+'
+
stop_httpd
test_done