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

Don't require signin for OPTIONS requests #33759

Open
mattfysh opened this issue Mar 1, 2025 · 1 comment
Open

Don't require signin for OPTIONS requests #33759

mattfysh opened this issue Mar 1, 2025 · 1 comment
Labels

Comments

@mattfysh
Copy link

mattfysh commented Mar 1, 2025

Description

Hi there, I'm running git-wasm in a web app which is why I need to get the CORS settings right. In my helm chart settings I have:

repository:
  ACCESS_CONTROL_ALLOW_ORIGIN: http://web.app.url
service:
  REQUIRE_SIGNIN_VIEW: true

The issue is that any incoming OPTIONS requests sent by the browser during preflight are being denied by this piece of logic:

func addOwnerRepoGitHTTPRouters(m *web.Router) {
reqGitSignIn := func(ctx *context.Context) {
if !setting.Service.RequireSignInView {
return
}
// rely on the results of Contexter

Browser typically will not send authorization headers with a preflight OPTIONS request, and they will not process any returned 'www-authenticate' header instructions, so this prevents any git-over-http requests from succeeding in the browser

The only workaround currently is to set REQUIRE_SIGNIN_VIEW to false

Gitea Version

1.24.0+dev-342-gead716d204

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Via the helm chart provided here https://gitea.com/gitea/helm-chart

Database

None

@lunny
Copy link
Member

lunny commented Mar 1, 2025

I don't think this is the right place to ignore the OPTIONS. The authentication is in the middleware. Search buildAuthGroup.

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

No branches or pull requests

2 participants