Documentation
¶
Overview ¶
Package httputil provides shared HTTP request introspection helpers that gate the trust placed in attacker-controllable proxy headers.
ADR-0017 establishes that longue-vue reads X-Forwarded-For and X-Forwarded-Proto only when the immediate peer is in an explicit trusted-proxy CIDR list. The empty-list default ignores both headers unconditionally — that is the secure default the pentest report (AUTH-VULN-04) demands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientIP ¶
ClientIP returns the source IP for rate-limiting and audit logging.
X-Forwarded-For is honored only when the immediate peer (r.RemoteAddr) matches an entry in the trusted list. The XFF walk runs right-to-left through trusted hops and returns the first untrusted IP — the real client. Attackers can prepend arbitrary values to XFF but cannot append past trusted hops, so prepended values are unreachable.
With an empty trust list, XFF is ignored entirely. Returns nil only if r.RemoteAddr is unparseable.
Types ¶
This section is empty.