Sync with Git 2.47.2
Git 2.47.2 # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEE4fA2sf7nIh/HeOzvsLXohpav5ssFAmdkT1sACgkQsLXohpav # 5svdhRAAq0WoZIg+33vYNNVSTm3Ux9RJslmXs3lQuhuUJ61hK/28drSLU29GH7x7 # 3nmmjp1cegnXRVLBAfoYDdzPprNNrQFQEHQEzgG/GDZw0OXn+WTZuNyrrUYoa+sd # QSLlElRj2qrpHIMOsMIBKBSNB+qjJHOMGdxcBAS768TfnQpGIpc1KJa24TxsVBzC # ScP4uvrFfPyQrqFUgiUhCeqLnO/6T5i/QAn/8cS5a1+zor5ZHSlw28TZTOxN2odo # Rulp/FtehiDEzmRowgD3M4fImAPY6Ib6VORCYASqpJFFla30tu2bQqEi6raOMTec # hg5Ibkmj6fHFONaYvoTMRkYHmtUnNgIPU/CYPwswNk8w1+PPQfJ+TYjBXOQgdTLW # F0azHBHh7NRmEHVydiF9CqjgNVRzjO4IEZfGqXNFPPMvR6UUzDaIkrpYbwXBFMin # GNPV3QISeXj9ROjJoCv0nclXETwWemykjZlD6b5krXn5TaJlFb+69qJvXrCLq5WY # EoevSqKkB9HVK9si7P8Sh1cPGOr3kfiFPmMNKFVI8l0+iDFgBywOomWNS/JEzqu1 # nN142DKdL1W/rkeMUhbX2h11CZNvHKIOy3iaA4MTOing8/eMzyUUQ73Ck7odYs4f # rZ0tTXKJhxojPvBpTxYe9SxM0bDLREiOv0zX76+sIuhbAQCmk0o= # =MNNf # -----END PGP SIGNATURE----- # gpg: Signature made Thu 19 Dec 2024 08:52:43 AM PST # gpg: using RSA key E1F036B1FEE7221FC778ECEFB0B5E88696AFE6CB # gpg: Good signature from "Junio C Hamano <gitster@pobox.com>" [ultimate] # gpg: aka "Junio C Hamano <junio@pobox.com>" [ultimate] # gpg: aka "Junio C Hamano <jch@google.com>" [ultimate] * tag 'v2.47.2': Git 2.47.2 Git 2.46.3 Git 2.45.3 Git 2.44.3 Git 2.43.6 Git 2.42.4 Git 2.41.3 Git 2.40.4 credential: disallow Carriage Returns in the protocol by default credential: sanitize the user prompt credential_format(): also encode <host>[:<port>] t7300: work around platform-specific behaviour with long paths on MinGW compat/regex: fix argument order to calloc(3) mingw: drop bogus (and unneeded) declaration of `_pgmptr` ci: remove 'Upload failed tests' directories' step from linux32 jobs
This commit is contained in:
@ -76,6 +76,10 @@ test_expect_success 'setup helper scripts' '
|
||||
test -z "$pexpiry" || echo password_expiry_utc=$pexpiry
|
||||
EOF
|
||||
|
||||
write_script git-credential-cntrl-in-username <<-\EOF &&
|
||||
printf "username=\\007latrix Lestrange\\n"
|
||||
EOF
|
||||
|
||||
PATH="$PWD:$PATH"
|
||||
'
|
||||
|
||||
@ -696,6 +700,19 @@ test_expect_success 'match percent-encoded values in username' '
|
||||
EOF
|
||||
'
|
||||
|
||||
test_expect_success 'match percent-encoded values in hostname' '
|
||||
test_config "credential.https://a%20b%20c/.helper" "$HELPER" &&
|
||||
check fill <<-\EOF
|
||||
url=https://a b c/
|
||||
--
|
||||
protocol=https
|
||||
host=a b c
|
||||
username=foo
|
||||
password=bar
|
||||
--
|
||||
EOF
|
||||
'
|
||||
|
||||
test_expect_success 'fetch with multiple path components' '
|
||||
test_unconfig credential.helper &&
|
||||
test_config credential.https://example.com/foo/repo.git.helper "verbatim foo bar" &&
|
||||
@ -885,6 +902,22 @@ test_expect_success 'url parser rejects embedded newlines' '
|
||||
test_cmp expect stderr
|
||||
'
|
||||
|
||||
test_expect_success 'url parser rejects embedded carriage returns' '
|
||||
test_config credential.helper "!true" &&
|
||||
test_must_fail git credential fill 2>stderr <<-\EOF &&
|
||||
url=https://example%0d.com/
|
||||
EOF
|
||||
cat >expect <<-\EOF &&
|
||||
fatal: credential value for host contains carriage return
|
||||
If this is intended, set `credential.protectProtocol=false`
|
||||
EOF
|
||||
test_cmp expect stderr &&
|
||||
GIT_ASKPASS=true \
|
||||
git -c credential.protectProtocol=false credential fill <<-\EOF
|
||||
url=https://example%0d.com/
|
||||
EOF
|
||||
'
|
||||
|
||||
test_expect_success 'host-less URLs are parsed as empty host' '
|
||||
check fill "verbatim foo bar" <<-\EOF
|
||||
url=cert:///path/to/cert.pem
|
||||
@ -994,4 +1027,20 @@ test_expect_success 'credential config with partial URLs' '
|
||||
test_grep "skipping credential lookup for key" stderr
|
||||
'
|
||||
|
||||
BEL="$(printf '\007')"
|
||||
|
||||
test_expect_success 'interactive prompt is sanitized' '
|
||||
check fill cntrl-in-username <<-EOF
|
||||
protocol=https
|
||||
host=example.org
|
||||
--
|
||||
protocol=https
|
||||
host=example.org
|
||||
username=${BEL}latrix Lestrange
|
||||
password=askpass-password
|
||||
--
|
||||
askpass: Password for ${SQ}https://%07latrix%20Lestrange@example.org${SQ}:
|
||||
EOF
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Reference in New Issue
Block a user