Package com.sun.identity.common
Class SsrfUrlValidator
- java.lang.Object
-
- com.sun.identity.common.SsrfUrlValidator
-
public final class SsrfUrlValidator extends Object
Validates that a (client-supplied) URL is safe for the server to fetch, to prevent server-side request forgery (SSRF).A URL is considered safe only when it uses the
httporhttpsscheme (which rules outfile://,ftp://,gopher://and similar variants) and none of the host's resolved addresses point at a loopback, wildcard, link-local (incl. cloud metadata169.254.0.0/16), private/site-local, multicast or IPv6 unique-local address.This class is intentionally free of any configuration/framework dependency so it can be reused from any module; callers that need a runtime "allow any URL" escape hatch should read their own system property and short-circuit before calling
isSafeRemoteUrl(String).
-
-
Method Detail
-
isSafeRemoteUrl
public static boolean isSafeRemoteUrl(String url)
- Parameters:
url- the URL to check.- Returns:
trueif the URL is safe for the server to fetch,falseotherwise.
-
-