fix(config): default trusted_proxy_hops to 2, the measured chain length #32
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-trusted-proxy-hops"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The constant, which is the half that lives here. The manifest override is
platform's.The number, measured in this pod rather than borrowed
v0.2.1has been logging the entry count since16:22Zon 2026-08-26. Eleven hours:Unanimous, no distribution to interpret. Corroborated independently from
oddie-apps/edge-config, which shares no instrument with the pod: the edge configures notrusted_proxiesso Caddy replaces the header with its peer, and Cilium runsgateway-api-xff-num-trusted-hops: 0so Envoy appends the downstream address. Client → Caddy edge → Cilium gateway → pod.Both values were wrong, in opposite directions
The manifest is the only reason this service has been on the recoverable side. A
"0"sitting in a manifest reads exactly like a leftover, and deleting it to tidy up would have inherited the 1 and made the audit trail worse while making the config look cleaner.With the constant at 2 the override becomes redundant rather than load-bearing, and deleting it is then correct. That is a change in
platform.The comment names the topology, not a product
A constant encoding another system's behaviour is worthless without that system beside it. A sibling service documented its own as
Default 1 (Traefik)and there is no Traefik on this cluster at all. Of the four backends carrying this setting, the one nobody flagged is the one that wrote# edge Caddy + Cilium gatewaynext to the number.The doc comment also says that a deployment not behind that edge must override: the
homegateway is LAN-only, so a backend there sees one entry, and a service moving between the two changes its own correct value with nothing reporting it.Wrongness is asymmetric and the default now errs the recoverable way
parse_client_ipreturnsNonewhen the chain is shorter than the hop count, so 2 against a one-entry chain blanks the field. Too low does not blank it: it selects a proxy and writes a well-formed address identifying the wrong party into the record an incident reads.Verified by mutation, including one that found a useless pair of tests
len < hopsguard removed)a_chain_shorter_than_the_hop_count_blanks_rather_than_guessesand the existingparse_client_ip_returns_none_when_chain_shorter_than_trustReverting the constant killed no test. Every existing test passed a hop count explicitly, so none exercised the value the deployment actually uses, and the change I was making was invisible to the suite.
trusted_proxy_hops_defaults_to_the_deployed_chain_lengthandinitialize_quota_defaults_are_the_shipped_onespin the constructor's own values; with them, both reversions die and nothing else does.Gates
cargo fmt --check,cargo clippy -D warnings,cargo test --all-features(122 + 9),cargo audit,cargo deny check bans licenses sources— green onrustc 1.98.0.