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

"[oauth2_client] OPENID_CONNECT_SCOPES" can make "Additional Scopes" of "Authentication Source" useless #33413

Open
CrimsonEdgeHope opened this issue Jan 27, 2025 · 0 comments

Comments

@CrimsonEdgeHope
Copy link
Contributor

Description

Our Gitea instance connects to an external identity provider for unified identity management. I was adding a custom scope and a claim field to OIDC to let accounts in a certain OIDC group have Gitea instance administrator privilege. In "Edit Authentication Source" page I filled:

  • "Additional Scopes"
  • "Required Claim Name"
  • "Required Claim Value"
  • "Claim name providing group names for this source"
  • "Group Claim value for administrator users"
  • "Group Claim value for restricted users"

However, I noticed that OAuth url generated by Gitea wasn't including the custom scope, without which led to login prohibited by Gitea, as a result of absence of the custom claim field, which in turn was a result of absence of the custom scope, no matter how I modified "Additional Scopes". Troubleshot for hours long, I finally found that "OPENID_CONNECT_SCOPES" (https://github.com/go-gitea/gitea/blob/main/services/auth/source/oauth2/providers_openid.go#L37) will override "Additional Scopes" (https://github.com/go-gitea/gitea/blob/main/routers/web/admin/auths.go#L184) set in "Edit Authentication Source", making it literally useless before I removed the config item.

No error log.

Similar issue I looked at: #31612

Gitea Version

6ca91f5

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

Image

Image

Image

Git Version

No response

Operating System

No response

How are you running Gitea?

Docker compose

Database

PostgreSQL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants