Commit Graph

7 Commits

Author SHA1 Message Date
bolkedebruin
75ef8ce289 Require trusted-proxy CIDR allow-list for header authentication (#184)
Header auth previously trusted any request that carried the configured
user header, with no check that the request came from a known upstream
proxy. Anyone reaching rdpgw directly could mint an authenticated
session as any user by setting the header.

Add `Header.TrustedProxies` (CIDR list) checked against `RemoteAddr`
before reading the user header. Refuse the request with 401 when the
remote is outside the allow-list. Refuse to start when header
authentication is enabled but `Header.TrustedProxies` is empty.

The CIDR allow-list gates the immediate upstream only; operators must
still configure their proxy to strip duplicate inbound copies of the
user header so a client cannot smuggle one through the trusted hop.
Documented in docs/header-authentication.md.

TestHeaderAuthRequiresTrustedProxy is a 3-case table covering: no
allow-list (refused), outside allow-list (refused), inside allow-list
(allowed). Existing TestHeaderAuthenticated cases updated to declare
trust for httptest.NewRequest's default RemoteAddr (192.0.2.1).
2026-04-30 13:47:01 +02:00
Bolke de Bruin
8c4543b109 remove auto gen stuuf 2025-09-18 23:11:31 +02:00
Bolke de Bruin
866ed46fdc Extra docs 2025-09-18 23:09:40 +02:00
Bolke de Bruin
46d12c52be Add extra info on app gateway 2025-09-18 23:03:46 +02:00
Bolke de Bruin
75a7ca62a9 Add header authentication 2025-09-18 22:36:04 +02:00
Bolke de Bruin
da70e5967b Fix background 2024-03-18 11:22:30 +01:00
Bolke de Bruin
43493e9548 Add more docs 2024-03-18 11:18:44 +01:00