Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

credential: warn about git-credential-store [RFC] #1856

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion credential.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,13 @@ static int credential_getpass(struct repository *r, struct credential *c)
if (!c->username)
c->username = credential_ask_one("Username", c,
PROMPT_ASKPASS|PROMPT_ECHO);
if (!c->password)
if (!c->password) {
if (c->helpers.nr >= 1 && starts_with(c->helpers.items[0].string, "store"))
warning("git-credential-store saves passwords unencrypted on disk. For alternatives, see gitcredentials(7).");

c->password = credential_ask_one("Password", c,
PROMPT_ASKPASS);
}
trace2_region_leave("credential", "interactive", r);

return 0;
Expand Down
2 changes: 2 additions & 0 deletions t/lib-credential.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ reject() {
helper_test() {
HELPER=$1

# help wanted: expect warning "git-credential-store saves passwords
# unencrypted" when helper equals "store"
test_expect_success "helper ($HELPER) has no existing data" '
check fill $HELPER <<-\EOF
protocol=https
Expand Down
3 changes: 3 additions & 0 deletions t/t0302-credential-store.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ invalid_credential_test() {
password=askpass-password
--
askpass: Username for '\''https://example.com'\'':
warning: git-credential-store saves passwords unencrypted on disk. For alternatives, see gitcredentials(7) or https://git-scm.com/doc/credential-helpers.
askpass: Password for '\''https://[email protected]'\'':
--
EOF
Expand All @@ -155,6 +156,7 @@ test_expect_success 'get: credentials with DOS line endings are invalid' '
password=askpass-password
--
askpass: Username for '\''https://example.com'\'':
warning: git-credential-store saves passwords unencrypted on disk. For alternatives, see gitcredentials(7) or https://git-scm.com/doc/credential-helpers.
askpass: Password for '\''https://[email protected]'\'':
--
EOF
Expand Down Expand Up @@ -186,6 +188,7 @@ test_expect_success 'get: credentials with DOS line endings are invalid if path
password=askpass-password
--
askpass: Username for '\''https://example.com/repo.git'\'':
warning: git-credential-store saves passwords unencrypted on disk. For alternatives, see gitcredentials(7) or https://git-scm.com/doc/credential-helpers.
askpass: Password for '\''https://[email protected]/repo.git'\'':
--
EOF
Expand Down
Loading