|
ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
|
Trusted-reverse-proxy resolution of a forwarded client address (PC_ENABLE_FORWARDED_TRUST). More...
#include "protocore_config.h"Go to the source code of this file.
Trusted-reverse-proxy resolution of a forwarded client address (PC_ENABLE_FORWARDED_TRUST).
A Forwarded (RFC 7239) / X-Forwarded-For header is CLIENT-SPOOFABLE, so the client address it carries may only be believed when the connection's real TCP peer is a reverse proxy the operator trusts. This keeps a fixed BSS table of trusted-upstream CIDRs and resolves the effective client address for the abuse-prevention layer: when the TCP peer matches a trusted CIDR and the forwarded token is a valid, specified address, the forwarded client is used; otherwise the real TCP peer is used. Fail-safe by construction - an empty table trusts no header, and a malformed / obfuscated / unspecified token falls back to the TCP peer, so a direct (untrusted) client cannot spoof its way out of, or another peer into, the auth lockout. Pure (no sockets, no heap), host-tested.
The table is a single owned instance reached only through this API (mirrors the source-IP allowlist and the auth-lockout table). Register upstreams with pc_forwarded_trust_add_cidr("10.0.0.0/8").
Definition in file forwarded_trust.h.