diff options
| author | M Hickford <mirth.hickford@gmail.com> | 2023-06-15 19:19:32 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-06-15 13:26:39 -0700 |
| commit | aeb21ce22eec112b37975443a160cb5418c6ec22 (patch) | |
| tree | 8137c8aed31a7ee6b35c48ace8646c5e4126cfa5 /t/lib-credential.sh | |
| parent | Git 2.41 (diff) | |
| download | git-aeb21ce22eec112b37975443a160cb5418c6ec22.tar.gz git-aeb21ce22eec112b37975443a160cb5418c6ec22.zip | |
credential: avoid erasing distinct password
Test that credential helpers do not erase a password distinct from the
input. Such calls can happen when multiple credential helpers are
configured.
Fixes for credential-cache and credential-store.
Signed-off-by: M Hickford <mirth.hickford@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-credential.sh')
| -rw-r--r-- | t/lib-credential.sh | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/t/lib-credential.sh b/t/lib-credential.sh index f1ab92ba35..77baec53b6 100644 --- a/t/lib-credential.sh +++ b/t/lib-credential.sh @@ -44,6 +44,8 @@ helper_test_clean() { reject $1 https example.com user1 reject $1 https example.com user2 reject $1 https example.com user4 + reject $1 https example.com user-distinct-pass + reject $1 https example.com user-overwrite reject $1 http path.tld user reject $1 https timeout.tld user reject $1 https sso.tld @@ -167,6 +169,49 @@ helper_test() { EOF ' + test_expect_success "helper ($HELPER) overwrites on store" ' + check approve $HELPER <<-\EOF && + protocol=https + host=example.com + username=user-overwrite + password=pass1 + EOF + check approve $HELPER <<-\EOF && + protocol=https + host=example.com + username=user-overwrite + password=pass2 + EOF + check fill $HELPER <<-\EOF && + protocol=https + host=example.com + username=user-overwrite + -- + protocol=https + host=example.com + username=user-overwrite + password=pass2 + EOF + check reject $HELPER <<-\EOF && + protocol=https + host=example.com + username=user-overwrite + password=pass2 + EOF + check fill $HELPER <<-\EOF + protocol=https + host=example.com + username=user-overwrite + -- + protocol=https + host=example.com + username=user-overwrite + password=askpass-password + -- + askpass: Password for '\''https://user-overwrite@example.com'\'': + EOF + ' + test_expect_success "helper ($HELPER) can forget host" ' check reject $HELPER <<-\EOF && protocol=https @@ -221,6 +266,31 @@ helper_test() { EOF ' + test_expect_success "helper ($HELPER) does not erase a password distinct from input" ' + check approve $HELPER <<-\EOF && + protocol=https + host=example.com + username=user-distinct-pass + password=pass1 + EOF + check reject $HELPER <<-\EOF && + protocol=https + host=example.com + username=user-distinct-pass + password=pass2 + EOF + check fill $HELPER <<-\EOF + protocol=https + host=example.com + username=user-distinct-pass + -- + protocol=https + host=example.com + username=user-distinct-pass + password=pass1 + EOF + ' + test_expect_success "helper ($HELPER) can forget user" ' check reject $HELPER <<-\EOF && protocol=https |
