e3f31d626cb8

style: drop lint violations introduced by security fixes (v4.8.4)

Non-null assertions in the isPrivateIpv6 mapped-address unwrap replaced with guarded destructure (fail-closed on malformed tails); parseInt -> Number.parseInt (useNumberNamespace); test storage key as literal property. No behavior change; targeted suites re-verified 106/106.

time
2026-08-04 14:53 UTC · 2 months ago
machine
koh2
parent
7cf0e6d4b0c4
2 files src/background/messages.test.ts+1 −1src/background/messages.ts+13 −6
src/background/messages.test.ts+1 −1
@@ -1307,7 +1307,7 @@13071307     ).resolves.toMatchObject({ ok: false, error: "no_pending_request" });13081308 13091309     // Seed a background-minted pending ceremony.1310-    sessionStorage["passkey_pending_firefox"] = {1310+    sessionStorage.passkey_pending_firefox = {13111311       requestId: 123,13121312       type: "create",13131313       rpId: "example.com",

view file

src/background/messages.ts+13 −6
@@ -1778,17 +1778,24 @@17781778   // one-shot host check.17791779   const mapped = /^::ffff:(.+)$/.exec(normalized);17801780   if (mapped) {1781-    const tail = mapped[1]!;1781+    const tail = mapped[1] ?? "";17821782     if (tail.includes(".")) return isPrivateIpv4(tail);17831783     const parts = tail.split(":");1784-    if (parts.length !== 2 || parts.some((part) => !/^[0-9a-f]{1,4}$/.test(part))) {1784+    const [hi, lo] = parts;1785+    if (1786+      parts.length !== 2 ||1787+      !hi ||1788+      !lo ||1789+      !/^[0-9a-f]{1,4}$/.test(hi) ||1790+      !/^[0-9a-f]{1,4}$/.test(lo)1791+    ) {17851792       return true;17861793     }17871794     const octets = [1788-      (parseInt(parts[0]!, 16) >>> 8) & 0xff,1789-      parseInt(parts[0]!, 16) & 0xff,1790-      (parseInt(parts[1]!, 16) >>> 8) & 0xff,1791-      parseInt(parts[1]!, 16) & 0xff,1795+      (Number.parseInt(hi, 16) >>> 8) & 0xff,1796+      Number.parseInt(hi, 16) & 0xff,1797+      (Number.parseInt(lo, 16) >>> 8) & 0xff,1798+      Number.parseInt(lo, 16) & 0xff,17921799     ];17931800     return isPrivateIpv4(octets.join("."));17941801   }

view file