Skip to content

Commit 373e9bd

Browse files
jonathantanmygitster
authored andcommitted
t5551: test that GIT_TRACE_CURL redacts password
Verify that when GIT_TRACE_CURL is set, Git prints out "Authorization: Basic <redacted>" instead of the base64-encoded authorization details. Signed-off-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b994622 commit 373e9bd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

t/t5551-http-fetch-smart.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,18 @@ test_expect_success 'redirects send auth to new location' '
185185
expect_askpass both user@host auth/smart/repo.git
186186
'
187187

188+
test_expect_success 'GIT_TRACE_CURL redacts auth details' '
189+
rm -rf redact-auth trace &&
190+
set_askpass user@host pass@host &&
191+
GIT_TRACE_CURL="$(pwd)/trace" git clone --bare "$HTTPD_URL/auth/smart/repo.git" redact-auth &&
192+
expect_askpass both user@host &&
193+
194+
# Ensure that there is no "Basic" followed by a base64 string, but that
195+
# the auth details are redacted
196+
! grep "Authorization: Basic [0-9a-zA-Z+/]" trace &&
197+
grep "Authorization: Basic <redacted>" trace
198+
'
199+
188200
test_expect_success 'disable dumb http on server' '
189201
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
190202
config http.getanyfile false

0 commit comments

Comments
 (0)