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

Add basic validation of stored credentials #268

Open
mjcheetham opened this issue Jan 18, 2021 · 2 comments · May be fixed by #1464
Open

Add basic validation of stored credentials #268

mjcheetham opened this issue Jan 18, 2021 · 2 comments · May be fixed by #1464
Labels
enhancement New feature or request
Milestone

Comments

@mjcheetham
Copy link
Collaborator

Right now GCM Core always returns any stored credentials for a request without any validation.

We cannot ever 100% validate that a credential is "good" for the particular Git command/request because the remote Git server can reject the credentials based on the content of the pack during a push, for example.

We can however validate if a stored a credential is expired or not, such as a PAT or OAuth JWT token that have expiration dates.

To do this we need to extend the credential store API and platform implementations to support reading/writing expiry metadata.

In the event the metadata is missing or the credentials have no expiry we should optimistically return them - assume they are good. This would mean we only reject definitely bad credentials (expired) and avoid false negatives.

@mjcheetham mjcheetham added the enhancement New feature or request label Jan 18, 2021
@hickford
Copy link
Contributor

hickford commented Apr 13, 2022

extend the credential store API and platform implementations to support reading/writing expiry metadata

This would also work nicely for refresh tokens -- and a more elegant solution than storing under a distinct host.

I believe https://git-scm.com/docs/git-credential supports storing arbitrary key value pairs. [correction: it does not]

@hickford
Copy link
Contributor

hickford commented Nov 1, 2023

It would be neat to store Git's password_expiry_utc attribute https://git-scm.com/docs/git-credential#Documentation/git-credential.txt-codepasswordexpiryutccode

Currently GitLabHostProvider makes a HTTP request to check expiration. This would no longer be necessary. GenericHostProvider is unable to store expiry, so does OAuth refresh every time.

@hickford hickford linked a pull request Nov 3, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@hickford @mjcheetham @ldennington and others