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

[RFC] Passwordless authentication for Git repositories #4114

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aryan9600
Copy link
Member

@aryan9600 aryan9600 commented Jul 31, 2023

This RFC proposes adding support for passwordless authentication for Git repositories on Git SaaS platforms and cloud providers using methods like OIDC, OAuth2 and IAM.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
@aryan9600 aryan9600 marked this pull request as draft July 31, 2023 18:45
@aryan9600 aryan9600 requested a review from a team August 1, 2023 06:41
Copy link
Member

@makkes makkes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the general approach here. What I missed while reading the RFC is the handling of token lifetime. How is an expired token refreshed?

Comment on lines +57 to +59
* `azure`
* `github`
* `gcp`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not OIDC? OIDC should be independent of any specific implementation/provider and provides proper discovery endpoints. This would open up many more integrations with the likes of Keycloak or Auth0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which Git SaaS uses OIDC? GCP and AWS they don’t even support workload identity, GH uses the property GH App API.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@makkes the goal here is to not support OIDC providers. the goal is to provide platform/cloud provider native auth mechanisms as an alternative to regular passwords.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you feel the RFC was not clear about this, kindly recommend suggestions that will make it clearer.

Copy link
Member

@hiddeco hiddeco Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GH uses the property GH App API

GitHub Apps is pretty much just an OAuth 2.0 (i.e. RFC 8628) mechanism.

This was a bit too simplified: https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/differences-between-github-apps-and-oauth-apps

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One example: Gitea can act as an OAuth2 provider. During bootstrap the Flux CLI can redirect the user to the authentication page (pretty much like kubelogin does. That would allow Flux to support a much broader set of Git hosting implementations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub Apps is pretty much just an OAuth 2.0 (i.e. RFC 8628) mechanism.

umm as far as i understand not quite. RFC 8628 requires the end user to navigate to a URL on the authorization server and enter a code presented by the client, an OTP of sorts. GitHub Apps just requires you to send a unique identifier, which is the JWT generated using the private key associated with the GitHub App to a URI for your installation ID which is (i assume) the client_id.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@makkes i'm sorry if you misunderstood but this RFC is not about the CLI at all. its about users not having to put passwords in the cluster and having to manage them. adding support for OAuth2 as a part of the bootstrap process lies completely outside the scope of this RFC. out of the three providers this RFC proposes, only one (GitHub) is actually supported by bootstrap.

@aryan9600
Copy link
Member Author

I like the general approach here. What I missed while reading the RFC is the handling of token lifetime. How is an expired token refreshed?

@makkes see the "Caching" section at the bottom. do you feel like that section does not contain enough info about handling of expiring tokens? what more would you like to see in the section?

Comment on lines +57 to +59
* `azure`
* `github`
* `gcp`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One example: Gitea can act as an OAuth2 provider. During bootstrap the Flux CLI can redirect the user to the authentication page (pretty much like kubelogin does. That would allow Flux to support a much broader set of Git hosting implementations.

rfcs/0006-git-repo-passwordless-auth/README.md Outdated Show resolved Hide resolved
Comment on lines 191 to 194
To avoid calling the upstream API for a token during every reconciliation, Flux
controllers shall cache the token after fetching it. Since GitHub and GCP tokens
self-expire, the cache shall automatically evict the token after it has expired,
triggering a fetch of a fresh token.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make use of a refresh token here? Do the SaaS providers mentioned throughout this RFC support that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the mentioned providers support the refresh_token attribute.

@aryan9600 aryan9600 added area/git Git related issues and pull requests area/rfc Feature request proposals in the RFC format area/security Security related issues and pull requests labels Aug 1, 2023
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
@pjbgf pjbgf changed the title [RFC] Passswordless authentication for Git repositories [RFC] Passwordless authentication for Git repositories Aug 3, 2023
@Poltergeisen
Copy link

Is this still being planned? I'm very interested in being able to use managed identities for git instead of a manual step right now of adding a secret to my clusters.

@schdief
Copy link

schdief commented Feb 7, 2024

would also be interested in using Azure DevOps managed identities/service principals

@bavneetsingh16
Copy link

Would any of the maintainers sponsor this RFC? I would like to start making progress on this.

@souleb
Copy link
Member

souleb commented Apr 25, 2024

Would any of the maintainers sponsor this RFC? I would like to start making progress on this.

Thanks for stepping up @bavneetsingh16. I volunteer to sponsor this RFC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/git Git related issues and pull requests area/rfc Feature request proposals in the RFC format area/security Security related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants