git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* transfer.credentialsInUrl should warn about personal access tokens in user field #leftoverbits
@ 2025-01-10 21:05 M Hickford
  2025-01-10 21:32 ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: M Hickford @ 2025-01-10 21:05 UTC (permalink / raw)
  Cc: git, derrickstolee, stolee

Assuming config key transfer.credentialsInUrl is set to "warn", Git warns about "plaintext credentials" if the user includes a password in the remote URL. https://git-scm.com/docs/git-config#Documentation/git-config.txt-transfercredentialsInUrl . This is implemented in remote.c

    $ git clone https://tim:hunter2@example.com/example.git
    warning: URL 'https://tim:<redacted>@example.com/example.git' uses plaintext credentials

It would be neat to warn similarly if the user includes a personal access token in the *user* field of the remote URL:

    git clone https://<pat>@github.com/...

This is a popular practice according to StackOverflow https://stackoverflow.com/a/70320541/284795 (800k views).

GitHub personal access tokens are easily recognised by their prefixes "ghp_" and "github_pat_" https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-authentication-to-github#githubs-token-formats 

#leftoverbits

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-01-18 20:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-10 21:05 transfer.credentialsInUrl should warn about personal access tokens in user field #leftoverbits M Hickford
2025-01-10 21:32 ` Junio C Hamano
2025-01-10 22:06   ` brian m. carlson
2025-01-10 22:51     ` Junio C Hamano
2025-01-11  0:08       ` brian m. carlson
2025-01-11  0:45         ` Junio C Hamano
2025-01-11  1:01           ` rsbecker
2025-01-18 20:33     ` M Hickford
2025-01-10 22:10   ` rsbecker
2025-01-10 23:36   ` Randall Becker
2025-01-10 23:44     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).