Skip to content

Your always-on AI coworkers that move between text, calls, and Slack.

TypeScript

fix: block IPv6 documentation addresses from public fetches (#131)

sean0407b2da875685d5
diff --git a/src/browser/security.ts b/src/browser/security.ts
index 1034043..588a23d 100644
--- a/src/browser/security.ts
+++ b/src/browser/security.ts
@@ -21,6 +21,7 @@ export function isPublicAddress(address: string): boolean {
const normalized = new URL(`http://[${ip}]`).hostname.slice(1, -1);
const second = Number.parseInt(normalized.split(':')[1] || '0', 16);
if (normalized.startsWith('2001:') && second < 0x200) return false;
+ if (normalized.startsWith('3fff:') && second < 0x1000) return false;
return (
/^[23][0-9a-f]{3}:/.test(normalized) &&
!/^(2001:(0:|db8:|10:|20:)|2002:)/.test(normalized)
diff --git a/tests/security.test.ts b/tests/security.test.ts
index d8e40c2..30845be 100644
--- a/tests/security.test.ts
+++ b/tests/security.test.ts
@@ -14,6 +14,8 @@ describe('browser network boundaries', () => {
'2002:7f00:1::',
'fc00::1',
'fe80::1',
+ '3fff::1',
+ '3fff:0fff::1',
'::ffff:127.0.0.1',
'224.0.0.1',
])('rejects private or special address %s', (address) =>