Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: enable GitHub OAuth2 login by default on new deployments#16662

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hugodutka merged 7 commits intomainfromhugodutka/github-oauth2-default
Feb 25, 2025

Conversation

hugodutka
Copy link
Contributor

@hugodutkahugodutka commentedFeb 22, 2025
edited
Loading

Third and final PR to address#16230.

This PR enables GitHub OAuth2 login by default on new deployments. Combined with#16629, this will allow the first admin user to sign up with GitHub rather than email and password.

We take care not to enable the default on deployments that would upgrade to a Coder version with this change.

To disable the default provider an admin can set theCODER_OAUTH2_GITHUB_DEFAULT_PROVIDER env variable to false.

@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-default branch 7 times, most recently from66e0aff to2788eb5CompareFebruary 22, 2025 16:30
@hugodutkahugodutka marked this pull request as ready for reviewFebruary 23, 2025 18:08
@hugodutka
Copy link
ContributorAuthor

Note: before merging, I need to update the embedded GitHub Client ID. I'm still waiting for the app to be properly set up on our side.

@dannykopping
Copy link
Contributor

dannykopping commentedFeb 24, 2025
edited
Loading

Note: before merging, I need to update the embedded GitHub Client ID. I'm still waiting for the app to be properly set up on our side.

@hugodutka how will users using this embedded client ID? Each GitHub app needs a unique callback URL as far as I understand, so I'm not sure how this will work.

EDIT: nevermind, seems like theredirect URI can be customised.

@hugodutka
Copy link
ContributorAuthor

hugodutka commentedFeb 24, 2025
edited
Loading

@dannykopping we’ll be using thedevice flow here, which I implemented support for a couple of days ago:#16585. This doesn’t use a callback URL.

dannykopping reacted with thumbs up emoji

Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

The change looks OK to me mechanically, and the device flow is convenient. What happens to new deployments where GitHub is not accessible though? It looks like this will be enabled and useless to the admin.

Name: "OAuth2 GitHub Default Provider",
Description: "Enable the default GitHub OAuth2 provider managed by Coder.",
Flag: "oauth2-github-default-provider",
Env: "CODER_OAUTH2_GITHUB_DEFAULT_PROVIDER",
Copy link
Member

@johnstcnjohnstcnFeb 24, 2025
edited
Loading

Choose a reason for hiding this comment

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

nit: for consistency, this should have the_ENABLE suffix. This isnot a blocking change though.

Comment on lines 391 to 405
t.Run("NewDeployment", func(t *testing.T) {
runGitHubProviderTest(t, testCase{
githubEnabled: true,
createUserPreStart: false,
createUserPostRestart: true,
})
})

t.Run("ExistingDeployment", func(t *testing.T) {
runGitHubProviderTest(t, testCase{
githubEnabled: false,
createUserPreStart: true,
createUserPostRestart: false,
})
})
Copy link
Member

Choose a reason for hiding this comment

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

Can you also add a test case as follows:

  • GIVEN an existing deployment with 0 users andCODER_OAUTH2_GITHUB_{CLIENT_ID,CLIENT_SECRET} set
  • WHEN coder starts
  • THEN the new "default" GitHub OAuth2 provider isnot enabled

hugodutka reacted with thumbs up emoji
Copy link
Member

@johnstcnjohnstcnFeb 24, 2025
edited
Loading

Choose a reason for hiding this comment

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

I think there's also an argument to be made against enabling this by default if OIDC login is enabled.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I'd rather not make this logic dependent on OIDC config. I think it's not intuitive that setting one up would disable the other.

Copy link
Member

Choose a reason for hiding this comment

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

:D It sounds like there's an argument against then. Let's leave it out of this PR so!

cli/server.go Outdated
Comment on lines 1896 to 1898
params.clientID = "Iv23liSBHklRMBNx5lk9"
params.allowEveryone = true
params.deviceFlow = true
Copy link
Member

Choose a reason for hiding this comment

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

Can this be extracted to ahighly visible variable?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

What do you consider highly visible? Package level global constant? Just asking to avoid further back and forth on this.

Copy link
Member

Choose a reason for hiding this comment

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

Something like that, yeah. We should need to go searching to find the default client ID.
I assume OAuth2 device flow doesn't require a client secret?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

That's right, it doesn't require a client secret.

@hugodutka
Copy link
ContributorAuthor

@johnstcn

What happens to new deployments where GitHub is not accessible though?

What do you mean by not accessible? As in the deployment is airgapped?

@johnstcn
Copy link
Member

@johnstcn

What happens to new deployments where GitHub is not accessible though?

What do you mean by not accessible? As in the deployment is airgapped?

Not necessarily; there have been multiple instances in the past where state actors have blocked GitHub. Or it could be blocked at the corporate network level. What would you say is the best course of action in this case?

@hugodutka
Copy link
ContributorAuthor

@johnstcn I don't think this would be very common. I think just allowing the admins to disable the default via an env variable is enough in these cases.

Copy link
Contributor

@dannykoppingdannykopping left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

Approving pending comments regarding conditionally disabling if existing OAuth2/OIDC authn methods are configured.

@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-default branch 2 times, most recently fromeb41f65 to032150dCompareFebruary 24, 2025 16:56
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-setup branch 2 times, most recently from1a67ae7 todfd49d0CompareFebruary 24, 2025 16:59
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-default branch 2 times, most recently from9a15225 to407cdd3CompareFebruary 24, 2025 18:03
@hugodutka
Copy link
ContributorAuthor

Addressed the feedback and updated the embedded client ID. Should be ready to merge once the base branch is merged.

@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-setup branch fromdfd49d0 to3b36025CompareFebruary 24, 2025 20:37
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-default branch from407cdd3 to071d6ccCompareFebruary 24, 2025 20:37
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-default branch from071d6cc to1720441CompareFebruary 24, 2025 20:57
Base automatically changed fromhugodutka/github-oauth2-setup tomainFebruary 25, 2025 14:54
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-default branch from1720441 to297e90bCompareFebruary 25, 2025 15:16
@hugodutkahugodutka merged commitd3a56ae intomainFeb 25, 2025
33 of 35 checks passed
@hugodutkahugodutka deleted the hugodutka/github-oauth2-default branchFebruary 25, 2025 15:31
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 25, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@dannykoppingdannykoppingdannykopping approved these changes

Assignees

@hugodutkahugodutka

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@hugodutka@dannykopping@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp