Skip to content

fix: allow orgs with default github provider (cherry-pick #16755) #16784

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

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

gcp-cherry-pick-bot[bot]
Copy link

Cherry-picked fix: allow orgs with default github provider (#16755)

This PR fixes 2 bugs:

Problem 1

The server would fail to start when the default github provider was
configured and the flag --oauth2-github-allowed-orgs was set. The
error was

error: configure github oauth2: allow everyone and allowed orgs cannot be used together

This PR fixes it by enabling "allow everone" with the default provider
only if "allowed orgs" isn't set.

Problem 2

The default github provider uses the device flow to authorize users, and
that's handled differently by our web UI than the standard oauth flow.
In particular, the web UI only handles JSON responses rather than HTTP
redirects. There were 2 code paths that returned redirects, and the PR
changes them to return JSON messages instead if the device flow is
configured.

This PR fixes 2 bugs:

## Problem 1

The server would fail to start when the default github provider was
configured and the flag `--oauth2-github-allowed-orgs` was set. The
error was

```
error: configure github oauth2: allow everyone and allowed orgs cannot be used together
```

This PR fixes it by enabling "allow everone" with the default provider
only if "allowed orgs" isn't set.

## Problem 2

The default github provider uses the device flow to authorize users, and
that's handled differently by our web UI than the standard oauth flow.
In particular, the web UI only handles JSON responses rather than HTTP
redirects. There were 2 code paths that returned redirects, and the PR
changes them to return JSON messages instead if the device flow is
configured.
@stirby stirby merged commit 6da3c9d into release/2.20 Mar 3, 2025
32 checks passed
@stirby stirby deleted the cherry-pick-537e9b-release/2.20 branch March 3, 2025 23:49
@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants