Skip to content

fix(security): single isPrivateAddress SSOT — the SSRF guard was forked - #549

Merged
catomean merged 1 commit into
mainfrom
fix/ssrf-guard-ssot
Aug 2, 2026
Merged

fix(security): single isPrivateAddress SSOT — the SSRF guard was forked#549
catomean merged 1 commit into
mainfrom
fix/ssrf-guard-ssot

Conversation

@catomean

@catomean catomean commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

SSOT-sweep finding #3 (HIGH, security). isPrivateAddress existed as two independently-maintained copies:

  • src/lib/security/ssrfGuard.ts (webhook endpoints)
  • src/services/cat/website-analysis.ts (Cat's analyze_website — user-supplied URLs, the highest-risk SSRF surface)

They had already drifted: the security module was missing IPv6 multicast ff00::/8, which the Cat copy blocked.

Fix: new dependency-free src/lib/security/private-address.ts = the strictest union of both (brackets, fail-closed on malformed input, ff00::/8, site-local, CGNAT, metadata range). Both former hosts import/re-export it; copies deleted. No node:net, so it stays client-bundle-safe.

Verify: all 102 ssrfGuard + website-analysis tests green · tsc + eslint clean.

🤖 Generated with Claude Code

Sweep finding #3 (HIGH): the private-address check existed as two
independently-maintained copies — lib/security/ssrfGuard.ts and
services/cat/website-analysis.ts (the user-supplied-URL surface, i.e. the
highest-risk SSRF path). A range added to one and not the other would
have opened a silent hole; they had already drifted (the security module
was MISSING IPv6 multicast ff00::/8, which the Cat copy blocked).

- New src/lib/security/private-address.ts: the single, dependency-free
  implementation (strictest union of both copies: brackets handled,
  malformed input fail-closed, ff00::/8 + site-local covered). No
  node:net import, so client-bundle-safe modules can use it too.
- ssrfGuard.ts and website-analysis.ts both import/re-export it; their
  local copies are deleted.

All 102 ssrfGuard + website-analysis tests green, tsc + eslint clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@catomean
catomean merged commit 1bf0abf into main Aug 2, 2026
4 of 5 checks passed
@catomean
catomean deleted the fix/ssrf-guard-ssot branch August 2, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant