Skip to content

fix: stop forwarding client Authorization header to downstream apps#1042

Open
b1ume wants to merge 1 commit into
tinyauthapp:mainfrom
b1ume:fix/auth-header-leak
Open

fix: stop forwarding client Authorization header to downstream apps#1042
b1ume wants to merge 1 commit into
tinyauthapp:mainfrom
b1ume:fix/auth-header-leak

Conversation

@b1ume

@b1ume b1ume commented Jul 25, 2026

Copy link
Copy Markdown

setHeaders was piping the client's Authorization header straight through to the downstream app on every request. if someone auths via Basic Auth their creds end up in the backend. even with session-based auth, any Authorization header the client sent gets leaked.

the configured Basic Auth passthrough from ACLs is untouched, it still sets its own header separately.

Summary by CodeRabbit

  • Bug Fixes
    • Prevented incoming authorization credentials from being exposed in proxy responses.
    • Responses now include only configured access-control headers and applicable authentication headers.

setHeaders was passing the incoming Authorization header straight
through to the backend on every proxy request. If someone uses Basic
Auth their creds end up forwarded. The Basic Auth passthrough from
ACLs config still works.
Copilot AI review requested due to automatic review settings July 25, 2026 17:29
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 25, 2026
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9120e1af-b104-44bd-9018-e322e0327aae

📥 Commits

Reviewing files that changed from the base of the PR and between c7077a7 and 25cc1ec.

📒 Files selected for processing (1)
  • internal/controller/proxy_controller.go
💤 Files with no reviewable changes (1)
  • internal/controller/proxy_controller.go

📝 Walkthrough

Walkthrough

The proxy controller no longer copies the incoming Authorization header to responses. Response headers now come from ACL configuration, with an early return when ACLs are absent.

Changes

Proxy header handling

Layer / File(s) Summary
ACL-derived response headers
internal/controller/proxy_controller.go
setHeaders stops propagating the incoming Authorization header and applies only ACL-derived headers, including optional Basic Auth. It returns immediately when ACLs are nil.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: stopping client Authorization headers from being forwarded downstream.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Stops leaking client-provided Authorization headers to downstream apps by removing automatic passthrough behavior in the proxy controller’s response-header handling.

Changes:

  • Removed forwarding of the incoming request’s Authorization header in setHeaders.
  • Kept configured Basic Auth passthrough behavior via ACLs (still explicitly sets its own Authorization response header when configured).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 307 to 310
func (controller *ProxyController) setHeaders(c *gin.Context, acls *model.App) {
c.Header("Authorization", c.Request.Header.Get("Authorization"))

if acls == nil {
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants