fix(security): single isPrivateAddress SSOT — the SSRF guard was forked - #549
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SSOT-sweep finding #3 (HIGH, security).
isPrivateAddressexisted 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. Nonode:net, so it stays client-bundle-safe.Verify: all 102 ssrfGuard + website-analysis tests green · tsc + eslint clean.
🤖 Generated with Claude Code