Module ssrf

Module ssrf 

Source
Expand description

SSRF egress filter (SEC-13).

A configurable egress filter that rejects outbound connections to private/loopback/link-local/metadata endpoints. Applied to webhook deliveries and OPA callouts — any outbound dial the gateway makes on behalf of operator configuration that could be redirected to an internal address.

§Design

The filter is OPT-IN with an ALLOWLIST: when enabled, every resolved IP is checked against the deny set (RFC 1918, loopback, link-local, IPv6 ULA, cloud metadata endpoints). An optional allowlist exempts specific CIDRs (e.g. an internal alerting listener on 10/8).

DNS REBINDING is mitigated by checking the resolved IP at connect time, not at config compile time — the webhook deliverer resolves and checks immediately before TcpStream::connect.

The filter lives in the config domain because it uses crate::config::net IP/CIDR utilities and is a config-level policy (the deny set is config-bounded, not request-bounded).

Structs§

SsrfFilter
A compiled SSRF filter: the parsed deny set and allowlist, ready for O(1) checks at connect time. Built from SsrfFilterConfig at config compile time; the deny set is the default plus any operator additions (future), the allowlist is the parsed config entries.
SsrfFilterConfig
SSRF egress filter configuration. When enabled is true, outbound connections from webhook deliveries and OPA callouts are checked against the deny set; an IP in the deny set that is NOT in the allowlist is rejected. When enabled is false (the default), no filtering is applied (the v1 behavior — operator config is trusted).