diff --git a/qa/networksso.e2e.mjs b/qa/networksso.e2e.mjs index ab13808..451403d 100644 --- a/qa/networksso.e2e.mjs +++ b/qa/networksso.e2e.mjs @@ -190,7 +190,7 @@ try { const old = N.mint({ iss: 'iap', aud: 'linkspin', email: A, st: st2, to: '/ads', now: Date.now() - 120000 }); await hop(LS + '/sso/in?t=' + old); ok(!(await meOf(ctx, LS)).signedIn && /refused: expired/.test(logs.ls), 'an expired token is refused'); - const forged = N.mint({ iss: 'iap', aud: 'linkspin', email: A, st: st2, to: '/ads' }).replace(/.$/, c => c === 'A' ? 'B' : 'A'); + const forged = N.mint({ iss: 'iap', aud: 'linkspin', email: A, st: st2, to: '/ads' }).replace(/^(.*)(.)(.{10})$/, (m, h, c, t) => h + (c === 'A' ? 'Q' : 'A') + t); // a middle character: the last one carries 4 bits, so A<->B could decode the same (a 6% flake) await ctx.addCookies([{ name: 'nsso.st', value: st2, domain: 'localhost', path: '/' }]); await hop(LS + '/sso/in?t=' + forged); ok(!(await meOf(ctx, LS)).signedIn && /refused: signature/.test(logs.ls), 'a tampered token is refused'); // open redirect: an off-site path never leaves the site