Skip to content

Commit 9a1c759

Browse files
authored
Update origin verification and return fixed hostname
1 parent 16a64d2 commit 9a1c759

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

worker/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,15 @@ async function verifyCoseSignature(coseKey, data, signature) {
441441
// ════════════════════════════════════════════════════════════════
442442

443443
function getRpId(request) {
444-
return new URL(request.url).hostname;
444+
return 'cardex.tjm.sk'; // ← your Pages hostname
445445
}
446446

447447
function verifyOrigin(origin, request) {
448-
const expected = new URL(request.url).origin;
449-
return origin === expected;
448+
const allowed = [
449+
'https://cardex.tjm.sk',
450+
'http://localhost:8787', // for local wrangler dev
451+
];
452+
return allowed.includes(origin);
450453
}
451454

452455
async function getAndDeleteChallenge(env, token) {

0 commit comments

Comments
 (0)