From: M Hickford <mirth.hickford@gmail•com>
Cc: git@vger•kernel.org, derrickstolee@github•com, stolee@gmail•com
Subject: transfer.credentialsInUrl should warn about personal access tokens in user field #leftoverbits
Date: Fri, 10 Jan 2025 21:05:00 +0000 [thread overview]
Message-ID: <20250110210500.675629-1-mirth.hickford@gmail.com> (raw)
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
next reply other threads:[~2025-01-10 21:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 21:05 M Hickford [this message]
2025-01-10 21:32 ` transfer.credentialsInUrl should warn about personal access tokens in user field #leftoverbits 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250110210500.675629-1-mirth.hickford@gmail.com \
--to=mirth.hickford@gmail$(echo .)com \
--cc=derrickstolee@github$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=stolee@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox