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 <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Tan committed
May 11, 2020 at 10:43 UTC
373e9bd66e2ba468f490e5e4ec1ccbe47853f8cd
1 file changed
+12
t/t5551-http-fetch-smart.sh
+12
@@ -185,6 +185,18 @@ test_expect_success 'redirects send auth to new location' '
185
expect_askpass both user@host auth/smart/repo.git
186
'
187
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
+
200
test_expect_success 'disable dumb http on server' '
201
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
202
config http.getanyfile false