Skip to content

packages/ak-axum/extract/client_ip: use the leftmost X-Forwarded-For IP - #26353

Merged
rissson merged 2 commits into
mainfrom
ak-axum-client-ip-leftmost-xff
Sep 22, 2026
Merged

rissson merged 2 commits into
mainfrom
ak-axum-client-ip-leftmost-xff

Conversation

@rissson

@rissson rissson commented Sep 22, 2026

Copy link
Copy Markdown
Member

closes #25811

@rissson rissson self-assigned this Sep 22, 2026
@rissson
rissson requested a review from a team as a code owner September 22, 2026 15:32
@rissson rissson added area:backend backport/version-2026.8 Add this label to PRs to backport changes to version-2026.8 labels Sep 22, 2026
@rissson
rissson enabled auto-merge (squash) September 22, 2026 15:33
@netlify

netlify Bot commented Sep 22, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 436d8f5
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6ab29f94f4670f0008cc13f5
😎 Deploy Preview https://deploy-preview-26353--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.

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

codecov Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.07%. Comparing base (f859467) to head (bdb44e6).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26353      +/-   ##
==========================================
- Coverage   92.11%   92.07%   -0.04%     
==========================================
  Files        1175     1175              
  Lines       76724    76724              
  Branches     4121     4121              
==========================================
- Hits        70672    70647      -25     
- Misses       5999     6024      +25     
  Partials       53       53              
Flag Coverage Δ
conformance 33.35% <ø> (+<0.01%) ⬆️
e2e 38.14% <ø> (+<0.01%) ⬆️
integration 29.65% <ø> (-0.45%) ⬇️
rust 44.79% <ø> (ø)
unit 93.61% <ø> (+<0.01%) ⬆️
unit-migrate 93.62% <ø> (+<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.

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in authentik Core Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Playwright e2e

Download this run's HTML report, traces and server logs, then open the report:

gh run download 35748633301 -D playwright-artifacts
npx playwright show-report playwright-artifacts/playwright-report

Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-bdb44e6656c5b242c3ab2b709e52143829cc61cd
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-bdb44e6656c5b242c3ab2b709e52143829cc61cd

Afterwards, run the upgrade commands from the latest release notes.

@rissson
rissson merged commit 449f299 into main Sep 22, 2026
145 checks passed
@rissson
rissson deleted the ak-axum-client-ip-leftmost-xff branch September 22, 2026 16:11
@github-project-automation github-project-automation Bot moved this from In Progress to Done in authentik Core Sep 22, 2026
@authentik-cherry-pick

Copy link
Copy Markdown
Contributor

🍒 Cherry-pick to version-2026.8 created: #26356

rissson added a commit that referenced this pull request Sep 22, 2026
…IP (cherry-pick #26353 to version-2026.8) (#26356)

Co-authored-by: Marc 'risson' Schmitt <[email protected]>
Signed-off-by: Marc 'risson' Schmitt <[email protected]>
cypr0 added a commit to cypr0/k8s-ops that referenced this pull request Oct 17, 2026
…able (#203)

authentik 2026.8.4 (live since 2026-10-17) takes the leftmost
X-Forwarded-For entry whenever its peer is a trusted proxy
(goauthentik/authentik#26353; reported upstream as #26941). Cloudflare
keeps a client-supplied XFF and only appends the real IP. authentik
therefore received "<forged>,<real>,<cloudflared pod>" and recorded the
forged IP. Verified live: an internet request through Cloudflare with
"X-Forwarded-For: 192.0.2.21" was logged as remote=192.0.2.21.

That IP feeds events, the reputation policy, ak_client_ip expression
policies and GeoIP. 2026.8.3 already got the LAN-direct case wrong:
authentik trusts 192.168.0.0/16 by default and skipped the LAN peer
that Envoy appended.

The authentik route now overwrites X-Forwarded-For with
%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%. That is the client IP Envoy
already resolves via the ClientTrafficPolicy (trustedCIDRs
10.42.0.0/16), so authentik gets a single, correct entry whatever
selection rule it uses. Validated on envoy distroless-v1.39.1 (same as
live) with a replica of the live listener config: forged, normal, IPv6
and LAN-direct requests all yield the real client IP. Envoy Gateway
v1.9.2 passes the value through verbatim, and a server-side dry-run
accepts the route.

Co-authored-by: cypr0 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
codec added a commit to codec/authentik-nix that referenced this pull request Oct 27, 2026
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.

Cloudflare IPs are not trusted proxies.

2 participants