Skip to content

chore: external auth validate response "Forbidden" should return invalid, not an error #13446

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 4 commits into from
Jun 3, 2024

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jun 3, 2024

Problem

User reported unable to delete a workspace because idp was returning a 403 on external auth Validate.

What this does

Prior to this change a 401 (unauthorized) yields an invalid token. 403s (forbidden) were counted as errors. Now both 401 and 403 yield unauthorized.

Not other 400 status codes would still yield an error and fail the workspace build.

@@ -218,7 +218,7 @@ func (c *Config) ValidateToken(ctx context.Context, link *oauth2.Token) (bool, *
return false, nil, err
}
defer res.Body.Close()
if res.StatusCode == http.StatusUnauthorized {
if res.StatusCode == http.StatusUnauthorized || res.StatusCode == http.StatusForbidden {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the fix. Everything else is just unit testing

@Emyrk Emyrk merged commit 27f2691 into main Jun 3, 2024
26 checks passed
@Emyrk Emyrk deleted the stevenmasley/suspended_user_delete_workspace branch June 3, 2024 18:16
@github-actions github-actions bot locked and limited conversation to collaborators Jun 3, 2024
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