add failsafe

This commit is contained in:
velzie 2024-08-02 14:23:11 -04:00
parent b8334993ae
commit 3826197093
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
2 changed files with 12 additions and 0 deletions

View file

@ -45,6 +45,11 @@ export async function swfetch(
try {
const url = new URL(decodeUrl(request.url));
if (url.origin == new URL(request.url).origin) {
throw new Error(
"attempted to fetch from same origin - this means the site has obtained a reference to the real origin, aborting"
);
}
const headers = new Headers();
for (const [key, value] of request.headers.entries()) {