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

Removing oauthClientSecret from .gitconfig #73

Open
EML-github opened this issue Feb 13, 2025 · 1 comment
Open

Removing oauthClientSecret from .gitconfig #73

EML-github opened this issue Feb 13, 2025 · 1 comment

Comments

@EML-github
Copy link

A question, rather than an issue. I have a generic remote repo which is implemented with Apache, mod_oauth2, and Keycloak, with 2FA. This all works (thanks - great work). The .gitconfig is:

[credential "https://example.com"]
  helper            = cache --timeout 7200
  helper            = "oauth -verbose"
  oauthClientId     = openid-cli
  oauthScopes       = "openid email"
  oauthAuthURL      = ...
  oauthTokenURL     = ...
  oauthRedirectUri  = http://127.0.0.1
  oauthClientSecret = ...

[user]
  name  = ...
  email = ...

However, there's a problem - the .gitconfig contains the client secret. Is there some way I can manually enter the secret once, and leave it out of the config file?

@hickford
Copy link
Owner

hickford commented Feb 13, 2025

I'm not familiar with mod_oauth2. Does it support OAuth public clients?

For a native app such as git-credential-oauth, it's expected that the client credentials are non confidential https://datatracker.ietf.org/doc/html/rfc6749#section-2.1

It is assumed that any client authentication credentials included in the application can be extracted

GitLab supports OAuth public clients. https://docs.gitlab.com/ee/api/oauth2.html

The Authorization code with PKCE flow, PKCE for short, makes it possible to securely perform the OAuth exchange of client credentials for access tokens on public clients without requiring access to the Client Secret at all. This makes the PKCE flow advantageous for single page JavaScript applications or other client side apps where keeping secrets from the user is a technical impossibility.

In the source of this project, you'll see that gitlab.com has no OAuth client secret

"gitlab.com": {
ClientID: "10bfbbf46e5b760b55ce772a262d7a0205eacc417816eb84d37d0fb02c89bb97",
Endpoint: endpoints.GitLab,
Scopes: []string{"read_repository", "write_repository"}},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants