From ade472cbc82ad27e6f6ccb968766a4a77c9e543c Mon Sep 17 00:00:00 2001 From: martbost Date: Sun, 15 Nov 2026 15:46:03 -0600 Subject: [PATCH] networksso e2e: tamper a middle character of the signature (the last base64url character carries only 4 bits, so A<->B could decode to the same bytes: a 6% flake seen in qa member 2026-11-15) Co-Authored-By: Claude Opus 5.5 --- qa/networksso.e2e.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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