feat: allow oauth* config values to be shell commands - #119
feat: allow oauth* config values to be shell commands#119andrew-grechkin wants to merge 1 commit into
Conversation
Any `credential.<url>.oauth*` value wrapped in backticks is now executed
via the user's default shell (`$SHELL` on Unix, `%COMSPEC%` on Windows,
with `/bin/sh` and `cmd.exe` as fallbacks) and its trimmed STDOUT is
used in place of the literal value.
Motivation: OAuth client secrets sitting plaintext in `~/.gitconfig` are
awkward to protect. This lets users source them from a password manager
or keychain via a pipeline, e.g.
oauthClientSecret = `pass show secret/some-site.com/oauth-client-secret | head -1`
Only the `oauth*` keys this helper reads are evaluated; other git config
values are untouched. Pipes and other shell features are supported since
execution goes through the shell rather than a direct exec.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
I am not associated with this project, this is just some random guys opinion. Using backticks inside the gitconfig seems somewhat unconventional and my cause issues when using the git command line to set configuration options. In this case I would personally prefer using an additional configuration option for supplying a command instead of the value. That said it's also disputable if the oauth client secret needs to be encrypted at all, take a look in #73 (comment). |
Any `credential.<url>.oauth*` value wrapped in backticks is now executed
via the user's default shell (`$SHELL` on Unix, `%COMSPEC%` on Windows,
with `/bin/sh` and `cmd.exe` as fallbacks) and its trimmed STDOUT is
used in place of the literal value.
Motivation: OAuth client secrets sitting plaintext in `~/.gitconfig` are
awkward to protect. This lets users source them from a password manager
or keychain via a pipeline, e.g.
oauthClientSecret = `pass show secret/some-site.com/oauth-client-secret | head -1`
Only the `oauth*` keys this helper reads are evaluated; other git config
values are untouched. Pipes and other shell features are supported since
execution goes through the shell rather than a direct exec.
PS:
Starting my own fork because my [PRs](hickford#119) will never be merged into upstream
1. I'm never going to sign `CLI`
2. Project is ill of the same open-source decease - decision making stupor
Any
credential.<url>.oauth*value wrapped in backticks is now executed via the user's default shell ($SHELLon Unix,%COMSPEC%on Windows, with/bin/shandcmd.exeas fallbacks) and its trimmed STDOUT is used in place of the literal value.Motivation: OAuth client secrets sitting plaintext in
~/.gitconfigare awkward to protect. This lets users source them from a password manager or keychain via a pipeline, e.g.Only the
oauth*keys this helper reads are evaluated; other git config values are untouched. Pipes and other shell features are supported since execution goes through the shell rather than a direct exec.