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

Cannot resume GitHub operations when SAML SSO auth is required on PATs #133

Closed
mjcheetham opened this issue Jun 11, 2020 · 2 comments
Closed
Assignees
Labels
bug A bug in Git Credential Manager host:github Specific to the GitHub host provider

Comments

@mjcheetham
Copy link
Collaborator

When an organisation has enabled and requires SAML SSO in order to access their repos, and we are using PATs, it is not possible to use the generated PAT because it is lost/never stored by GCM Core.

Normally we'd expect Git to tell us explicitly if a given PAT should be stored or erased after we return from a get.
However when a PAT requires SSO be enabled manually on the web, GitHub returns a 403 to which Git does nothing except print the remote: SSO required message.

Ideally we would want Git to tell us about the 403 and that the PAT was for a valid user, but lacked the specific permissions. That way we could store it and direct the user to update/change the PAT permissions, or even fix them automatically for them.

In the meantime, to workaround this we should store the PAT once we generate it. This means that when users who hit this scenario, they can come back and retry with the same PAT after enabling SSO permissions.

This workaround does break another scenario however - if the user has manually changed the permissions of the generated PAT in the web, then GCM will not prompt to generate another PAT since it always finds the existing 'bad' PAT and Git never tells us to erase it. Since this is a scenario where the user has 'done the wrong thing', it is a smaller and more unlikely situation than a user needing the SAML SSO approve their PATs.

@mjcheetham mjcheetham added bug A bug in Git Credential Manager host:github Specific to the GitHub host provider labels Jun 11, 2020
@mjcheetham mjcheetham self-assigned this Jun 11, 2020
mjcheetham added a commit to mjcheetham/git-credential-manager that referenced this issue Jun 11, 2020
In order to allow a user that requires SAML SSO to be manually enabled
on their newly generated PATs to access org repos, we must store the PAT
as soon as we generate it. This then allows the user the ability to
visit the web UI, enable SSO, and then repeat their Git operation using
the _same PAT_.

Workaround for issue: git-ecosystem#133
@mjcheetham
Copy link
Collaborator Author

It should also be mentioned that using the OAuth route does not have the same issues, once OAuth is ready for primetime.

@mjcheetham
Copy link
Collaborator Author

We've hacked around this by storing the PAT on get when we know the PAT is good (even if not SSO enabled). This means that the PAT is not lost before the user does the manual interaction to enable SSO.

Since the 'better' fix here is actually just moving to OAuth as the preferred/default authentication mechanism, I'll close this issue.

imgbot bot pushed a commit to Jeverett3000/Git-Credential-Manager-Core that referenced this issue Nov 2, 2022
In order to allow a user that requires SAML SSO to be manually enabled
on their newly generated PATs to access org repos, we must store the PAT
as soon as we generate it. This then allows the user the ability to
visit the web UI, enable SSO, and then repeat their Git operation using
the _same PAT_.

Workaround for issue: git-ecosystem#133
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in Git Credential Manager host:github Specific to the GitHub host provider
Projects
None yet
Development

No branches or pull requests

1 participant