Skip to content

fix(server): ignore Basic auth header when AUTH_ENABLED=true - #9147

Open
celeronsx wants to merge 2 commits into
apache:mainfrom
celeronsx:fix/9146-basic-auth-when-auth-enabled
Open

celeronsx wants to merge 2 commits into
apache:mainfrom
celeronsx:fix/9146-basic-auth-when-auth-enabled

Conversation

@celeronsx

@celeronsx celeronsx commented Sep 17, 2026

Copy link
Copy Markdown

⚠️ Pre Checklist

  • I have read through the Contributing Documentation.
  • I have added relevant tests.
  • I have added relevant documentation.
  • I will add labels to the PR, such as pr-type/bug-fix, pr-type/feature-development, etc.

Summary

OAuth2ProxyAuthentication turns any Authorization: Basic user:pass into common.USER without checking the password. That was the contract of the nginx era: config-ui verified the credentials against ADMIN_USER/ADMIN_PASS and the lake kept the username for audit fields. #8854 put auth.RequireAuth() behind that middleware, so with AUTH_ENABLED=true the unverified username now passes the terminal gate and any user:pass reaches every non-public route on a directly exposed lake. #8880 fixed the sibling X-Forwarded-User branch with FORWARDED_USER_SECRET but left this one.

The change gates the Basic branch on AUTH_ENABLED being off (mirroring oidchelper.LoadConfig: unset counts as off). With AUTH_ENABLED=true the accepted callers are the ones auth.go already logs as supported: session cookie, API key, forwarded headers with the shared secret. Legacy deployments without AUTH_ENABLED keep the Basic username exactly as before.

Does this close any open issues?

Closes #9146

Other Information

Tests. middlewares_basicauth_test.go: Basic header is ignored with AUTH_ENABLED=true, and is still taken as the user with AUTH_ENABLED unset or false. newProxyAuthRouter in the existing forward-secret test gained a WithConfig variant so both files share the router. The new bypass test fails on main without the change. go build, go vet and go test ./server/api/ are clean after make mock. Running as a local patch on our v1.0.3-beta17 instance since 2026-09-17: Basic returns 401, OIDC sign-in and API-key callers unaffected.

Behaviour change. A deployment that sets AUTH_ENABLED=true and still relies on config-ui nginx Basic auth for the lake will start getting 401 on the API. That combination was never a verified path (the lake trusted the header blindly); FORWARDED_USER_SECRET from #8880 is the supported way to pass a proxy-verified identity.

Labels. I do not have permission to set them; this is pr-type/bug-fix.

OAuth2ProxyAuthentication turns any "Authorization: Basic user:pass"
header into a user without checking the password. That was fine while
nginx in config-ui verified the credentials against ADMIN_USER/ADMIN_PASS
before proxying, and the lake only kept the username for audit fields.

apache#8854 put auth.RequireAuth behind it. With AUTH_ENABLED=true that gate now
accepts the unverified Basic user, so any username:password pair reaches
every non-public endpoint (blueprints, connections, pipelines) on a lake
that is exposed directly. apache#8880 closed the same hole for X-Forwarded-User
with FORWARDED_USER_SECRET but left the Basic branch untouched.

Only consult the Basic header when AUTH_ENABLED is off, which is the
legacy nginx mode. With AUTH_ENABLED the lake authenticates callers
itself: session cookie, API key, or forwarded headers with the shared
secret, exactly what auth.go already logs as the supported set.

Upstream: not yet submitted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][server] Any Basic credentials pass RequireAuth when AUTH_ENABLED=true: OAuth2ProxyAuthentication never verifies the password

1 participant