Skip to content

outposts/proxy: use HTTP/1.1 for OAuth backchannel requests - #26422

Merged
BeryJu merged 3 commits into
goauthentik:mainfrom
jsachs:bug/proxy-backchannel-http1
Sep 29, 2026
Merged

BeryJu merged 3 commits into
goauthentik:mainfrom
jsachs:bug/proxy-backchannel-http1

Conversation

@jsachs

@jsachs jsachs commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Details

  • Introduce a dedicated backchannel client that enforces HTTP/1.1 for authorization-code exchange, client-credentials exchange, token introspection, and JWKS retrieval.
  • Preserve standalone TLS validation settings and embedded Unix-socket transport.
  • Keep the authenticated API client separate and retain its existing protocol negotiation.
  • Correct comments about HTTP/2 Host and :authority handling.
  • Add seven transport-level regression tests.

Why is this change needed?

When AUTHENTIK_HOST and AUTHENTIK_HOST_BROWSER differ, the outpost connects to the internal token endpoint but overrides Host with the browser-facing authority so that the returned token has the expected public issuer.

With HTTP/2, the transport also sends :authority derived from the internal request URL. This can produce conflicting values:

:authority: auth.internal.example
host: auth.example.com

RFC 9113 §8.3.1 prohibits clients from sending conflicting Host and :authority values and requires recipients to use :authority when determining the target URI. A receiving proxy can therefore reject the request or forward the internal authority, causing authentik to issue a token with an unexpected issuer.

The outpost correctly rejects that token with InvalidIssuer, then restarts authentication, producing a redirect loop. Restricting the backchannel client to HTTP/1.1 preserves the intended host override.

How was this tested?

New tests use a local HTTPS server that advertises both HTTP/2 and HTTP/1.1. A control test confirms that an unrestricted client actually negotiates HTTP/2.

Regression coverage includes:

  • Authorization-code and client-credentials exchanges, with token issuers derived from the authority received by the server and checked by the production token verifier.
  • Introspection request headers and form fields.
  • Different hostnames, differing ports, non-default public ports, and matching authorities.
  • JWKS retrieval, cleartext HTTP backchannels, and embedded Unix sockets.

As a mutation check, temporarily removing .http1_only() reproduced InvalidIssuer in both token-exchange tests and caused the protocol assertions for introspection and JWKS retrieval to fail.

Linked issues

Addresses the demonstrated HTTP/2 failure in #26280. The original report's cleartext-HTTP failure has not been independently established to have the same cause.

Keep browser-facing Host overrides effective by giving OAuth backchannel operations a dedicated HTTP/1.1-only client. Preserve standalone TLS settings and embedded Unix-socket transport.

Add wire-level tests against an HTTP/2-capable TLS peer for token issuers, grant and introspection requests, authority variations, JWKS, cleartext HTTP, and Unix sockets. Removing the restriction reproduces InvalidIssuer.

Addresses the demonstrated HTTP/2 defect in goauthentik#26280.

AI assistance: implementation and tests developed with OpenCode (OpenAI).
@netlify

netlify Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 52166cc
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6abb9595bf8f890009417c19
😎 Deploy Preview https://deploy-preview-26422--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.56522% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.19%. Comparing base (6f93463) to head (52166cc).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/outpost/proxy/auth.rs 0.00% 3 Missing ⚠️
src/outpost/proxy/backchannel.rs 84.21% 0 Missing and 3 partials ⚠️
src/outpost/proxy/application/handlers/mod.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26422      +/-   ##
==========================================
+ Coverage   92.14%   92.19%   +0.05%     
==========================================
  Files        1179     1179              
  Lines       77363    77374      +11     
  Branches     4118     4129      +11     
==========================================
+ Hits        71285    71334      +49     
+ Misses       6025     5974      -51     
- Partials       53       66      +13     
Flag Coverage Δ
conformance 33.20% <ø> (+<0.01%) ⬆️
e2e 37.94% <ø> (+<0.01%) ⬆️
integration 29.53% <ø> (-0.44%) ⬇️
rust 46.45% <69.56%> (+1.69%) ⬆️
unit 93.64% <ø> (+<0.01%) ⬆️
unit-migrate 93.65% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@rissson rissson self-assigned this Sep 28, 2026
@rissson rissson added area:backend backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8 labels Sep 28, 2026
@jsachs
jsachs marked this pull request as ready for review September 29, 2026 10:44
@jsachs
jsachs requested a review from a team as a code owner September 29, 2026 10:44
@BeryJu
BeryJu merged commit a618bb5 into goauthentik:main Sep 29, 2026
137 of 139 checks passed
@authentik-cherry-pick

Copy link
Copy Markdown
Contributor

⚠️ Cherry-pick to version-2026.8 has conflicts: #26537

rissson added a commit that referenced this pull request Sep 29, 2026
…ick #26422 to version-2026.8) (#26537)

* Cherry-pick #26422 to version-2026.8 (with conflicts)

This cherry-pick has conflicts that need manual resolution.

Original PR: #26422
Original commit: a618bb5

* fix conflicts

Signed-off-by: Marc 'risson' Schmitt <[email protected]>

---------

Signed-off-by: Marc 'risson' Schmitt <[email protected]>
Co-authored-by: Jacob Sachs <[email protected]>
Co-authored-by: Marc 'risson' Schmitt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants