Class TrustedProxies
java.lang.Object
org.alfresco.module.aosmodule.util.TrustedProxies
An allowlist of trusted reverse proxies, parsed from a comma-separated list of IP
addresses and/or CIDR ranges (IPv4 and IPv6). Used to decide whether the forwarded
headers of an incoming request may be trusted.
An empty allowlist means "no restriction configured"; callers treat that as the historical, backward-compatible behavior of trusting the fronting proxy. Malformed entries are ignored so a single bad token cannot disable the whole allowlist.
Addresses are parsed with Guava's InetAddresses.forString(String) (see
parseLiteral(String)), which accepts only IP literals and never performs name
resolution: non-literal values (host names) are rejected rather than resolved, so neither
configuration parsing nor per-request matching ever triggers a DNS lookup. This both avoids
allowing host names where only IP/CIDR are expected and removes a potential latency/DoS
vector on the unauthenticated request path.
-
Method Summary
-
Method Details
-
parse
Parses a comma-separated list of IP addresses and CIDR ranges. Returns an empty (nevernull) allowlist whenconfigisnullor blank. -
isEmpty
public boolean isEmpty() -
isTrusted
Returns whether the given remote address matches any configured exact address or CIDR range. Returnsfalsefor anull, blank or non-IP-literal address (host names are never resolved, avoiding DNS).
-