@aikidosec/firewall
Version:
Zen by Aikido is an embedded Web Application Firewall that autonomously protects Node.js apps against common and critical attacks
14 lines (13 loc) • 818 B
TypeScript
import { Context } from "../../agent/Context";
/**
* This function checks if the given URL is part of a redirect chain that is passed in the redirects parameter.
* It returns the origin of a redirect chain if the URL is the result of a redirect.
* The origin is the first URL in the chain, so the initial URL that was requested and redirected to the given URL
* or in case of multiple redirects the URL that was redirected to the given URL.
*
* Example:
* Redirect chain: A -> B -> C: getRedirectOrigin([A -> B, B -> C], C) => A
* : getRedirectOrigin([A -> B, B -> C], B) => A
* : getRedirectOrigin([A -> B, B -> C], D) => undefined
*/
export declare function getRedirectOrigin(redirects: Context["outgoingRequestRedirects"], url: URL): URL | undefined;