Merge branch 'tb/credential-long-lines'
The implementation of credential helpers used fgets() over fixed size buffers to read protocol messages, causing the remainder of the folded long line to trigger unexpected behaviour, which has been corrected. * tb/credential-long-lines: contrib/credential: embiggen fixed-size buffer in wincred contrib/credential: avoid fixed-size buffer in libsecret contrib/credential: .gitignore libsecret build artifacts contrib/credential: remove 'gnome-keyring' credential helper contrib/credential: avoid fixed-size buffer in osxkeychain t/lib-credential.sh: ensure credential helpers handle long headers credential.c: store "wwwauth[]" values in `credential_read()`
This commit is contained in:
@ -270,6 +270,35 @@ helper_test() {
|
||||
password=
|
||||
EOF
|
||||
'
|
||||
|
||||
: ${GIT_TEST_LONG_CRED_BUFFER:=1024}
|
||||
# 23 bytes accounts for "wwwauth[]=basic realm=" plus NUL
|
||||
LONG_VALUE_LEN=$((GIT_TEST_LONG_CRED_BUFFER - 23))
|
||||
LONG_VALUE=$(perl -e 'print "a" x shift' $LONG_VALUE_LEN)
|
||||
|
||||
test_expect_success "helper ($HELPER) not confused by long header" '
|
||||
check approve $HELPER <<-\EOF &&
|
||||
protocol=https
|
||||
host=victim.example.com
|
||||
username=user
|
||||
password=to-be-stolen
|
||||
EOF
|
||||
|
||||
check fill $HELPER <<-EOF
|
||||
protocol=https
|
||||
host=badguy.example.com
|
||||
wwwauth[]=basic realm=${LONG_VALUE}host=victim.example.com
|
||||
--
|
||||
protocol=https
|
||||
host=badguy.example.com
|
||||
username=askpass-username
|
||||
password=askpass-password
|
||||
wwwauth[]=basic realm=${LONG_VALUE}host=victim.example.com
|
||||
--
|
||||
askpass: Username for '\''https://badguy.example.com'\'':
|
||||
askpass: Password for '\''https://askpass-username@badguy.example.com'\'':
|
||||
EOF
|
||||
'
|
||||
}
|
||||
|
||||
helper_test_timeout() {
|
||||
|
Reference in New Issue
Block a user