Refuse private targets on the audit's page fetch - #232
Merged
Merged
Conversation
CodeQL flagged the paying fetch in #231 as server-side request forgery, and it was right about the shape if not the novelty: the audit fetches whatever URL a customer submits, and nothing checked where that resolved. A submitted http://169.254.169.254/ would have read the cloud metadata service from our server. The old fetch(url) in smartFetch had the same hole; the wrapper only made the flow visible. lib/net-guard.ts resolves the host and refuses any private, loopback, link-local, CGNAT or multicast answer — the same rules outreach's mailbox discovery applies — before the request, and again on the final URL after redirects. CRAWLPROOF_ALLOW_PRIVATE_TARGETS=1 turns it off for auditing a local server in development. Link-status probes and uptime pings remain on the plain fetch as before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NSGS7Sy3QmEgTNZDg4eq7g
ThreatCrush Security Scan39 finding(s) HIGH/CRITICAL: 2 | MEDIUM: 28 | LOW: 9
Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
Follow-up to #231, whose CodeQL run flagged the paying fetch as SSRF. The audit fetches customer-submitted URLs with no address check (the pre-existing
fetch(url)had the same hole).lib/net-guard.tsresolves the host and refuses private/loopback/link-local/CGNAT/multicast answers before the request and on the final URL after redirects.CRAWLPROOF_ALLOW_PRIVATE_TARGETS=1disables it for local development. 5 new tests; tsc clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01NSGS7Sy3QmEgTNZDg4eq7g