Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

412 B
Raw Blame
/**
 * Sanitizes the URL from malicious payloads.
 * Prevents open redirects such as //example.com/path
 * and prevents XSS such as javascript:().
 * Returns / as a default or when unsafe.
 * @param url The URL to sanitize
 */
export const sanitizeRedirectionUrl = (url?: string) => {
  if (url && url.startsWith("/") && !url.startsWith("//")) {
    return url;
  } else {
    return "/"; // Safe default
  }
};