← Back to index

DOM-based test cases — Open Redirect sinks

High: 0 Medium: 0 Low: 0 Safe: 0 Total: 0

These fixtures target DOM-based open redirect flows. The default sink uses window.open; uncomment hooks inside openRedirectSink for full navigation if desired.

Use query payload

Inline scenarios

INLINE-1 (High): Query/hash → openRedirectSink
// inline-script[#1]
(function(){
  function redirect(url) {
    if (!url) return;
    openRedirectSink(url, 'inline-open-log');
  }
  const params = new URLSearchParams(location.search);
  if (params.has('payload')) redirect(params.get('payload'));
  if (location.hash) {
    try { redirect(decodeURIComponent(location.hash.slice(1))); }
    catch (err) { redirect(location.hash.slice(1)); }
  }
  window.addEventListener('hashchange', () => {
    if (!location.hash) return;
    try { redirect(decodeURIComponent(location.hash.slice(1))); }
    catch (err) { redirect(location.hash.slice(1)); }
  });
})();
Open redirect log…
INLINE-2 (High): Field → openRedirectSink
// inline-script[#2]
function inlineOpenRedirect(fieldId, logId) {
  const el = document.getElementById(fieldId);
  if (!el) return;
  openRedirectSink(el.value, logId);
}
INLINE-3 (Safe): Same-origin enforcement
// inline-script[#3]
(function(){
  const params = new URLSearchParams(location.search);
  const url = params.get('safe');
  if (!url) return;
  const res = openRedirectUtils.sameOriginGuard(url);
  document.getElementById('inline-safe-open').textContent = res.message;
})();
Waiting for payload…

External scenarios (click to run)

Direct DOM sources
onclick="extOpenRedirectFromHash()"
onclick="extOpenRedirectFromSearch()"
onclick="extOpenRedirectFromWindowName()"
onclick="extOpenRedirectFromReferrer()"
onclick="extOpenRedirectFromCookie()"
onclick="extOpenRedirectFromLocalStorage()"
onclick="extOpenRedirectFromSessionStorage()"
onclick="extOpenRedirectFromSessionStorage()"