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

Commita8433b1

Browse files
authored
fix: Prevent infinite redirects on oidc errors (#6550)
* fix: Prevent infinite redirects on bad oidc scopes* Show oidc errors
1 parent4a07fcd commita8433b1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎coderd/httpmw/oauth2.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,28 @@ func ExtractOAuth2(config OAuth2Config, client *http.Client) func(http.Handler)
5656
return
5757
}
5858

59+
// OIDC errors can be returned as query parameters. This can happen
60+
// if for example we are providing and invalid scope.
61+
// We should terminate the OIDC process if we encounter an error.
62+
oidcError:=r.URL.Query().Get("error")
63+
errorDescription:=r.URL.Query().Get("error_description")
64+
errorURI:=r.URL.Query().Get("error_uri")
65+
ifoidcError!="" {
66+
// Combine the errors into a single string if either is provided.
67+
iferrorDescription==""&&errorURI!="" {
68+
errorDescription=fmt.Sprintf("error_uri: %s",errorURI)
69+
}elseiferrorDescription!=""&&errorURI!="" {
70+
errorDescription=fmt.Sprintf("%s, error_uri: %s",errorDescription,errorURI)
71+
}
72+
oidcError=fmt.Sprintf("Encountered error in oidc process: %s",oidcError)
73+
httpapi.Write(ctx,rw,http.StatusBadRequest, codersdk.Response{
74+
Message:oidcError,
75+
// This message might be blank. This is ok.
76+
Detail:errorDescription,
77+
})
78+
return
79+
}
80+
5981
code:=r.URL.Query().Get("code")
6082
state:=r.URL.Query().Get("state")
6183

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp