function isMutatingMethod(method: string): boolean { const m = (method || "").trim().toUpperCase(); return m === "POST" || m === "PUT" || m === "PATCH" || m === "DELETE";
}
function isLoopbackUrl(value: string): boolean { const v = value.trim(); if (!v || v === "null") { returnfalse;
} try { const parsed = new URL(v); return isLoopbackHost(parsed.hostname);
} catch { returnfalse;
}
}
export function shouldRejectBrowserMutation(params: {
method: string;
origin?: string;
referer?: string;
secFetchSite?: string;
}): boolean { if (!isMutatingMethod(params.method)) { returnfalse;
}
// Strong signal when present: browser says this is cross-site. // Avoid being overly clever with "same-site" since localhost vs 127.0.0.1 may differ. const secFetchSite = normalizeLowercaseStringOrEmpty(params.secFetchSite); if (secFetchSite === "cross-site") { returntrue;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.