Files
Pulse/scripts
rcourtman 8fd81efd3c Tighten local-client trust and forwarded client addresses (#4355)
Local-client trust (no-auth access, recovery tokens and sessions,
unauthenticated config transfer, the loopback rate-limit exemption) now
requires, besides a loopback peer:

- no reverse-proxy forwarding header;
- a `Host` of `localhost`, `*.localhost` or a loopback address;
- a browser request that is same-origin by Fetch Metadata, or names
exactly this origin. Requests with no browser metadata (curl) are
unchanged.

`GetClientIP` now takes the right-most `X-Forwarded-For` hop that is not
in `PULSE_TRUSTED_PROXY_CIDRS`, reading every header line and accepting
entries with ports, instead of the first entry. Lockout, rate limits,
audit addresses and recovery-token binding use it.

Behaviour changes for existing setups:
- A single proxy that replaces or appends the header: unchanged client
address.
- Multi-hop chains where only the last proxy is trusted and it appends:
Pulse now sees the upstream hop. `docs/REVERSE_PROXY.md` explains
listing upstream hops or having the final proxy replace the header.
- A browser on the Pulse host using the machine's hostname instead of
`localhost` no longer counts as local.

Tests: `loopback_trust_test.go`, `client_ip_test.go`; existing loopback
fixtures now set a local `Host`. Full `internal/api` package passes.
2026-11-13 23:27:22 +00:00
..
2025-10-11 23:29:47 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-03-18 16:06:30 +00:00
2026-11-11 21:38:44 +00:00
2025-10-22 10:46:18 +00:00
2026-03-18 16:06:30 +00:00