Harden scraper against SSRF, add search autocomplete and email copy button - #16
Merged
Merged
Conversation
…utton Discovery URLs (search results, RSS feeds) are untrusted content; the scraper now resolves every hostname — the initial URL and each redirect hop — and refuses to fetch anything that resolves to a private, loopback, link-local, or otherwise non-public address (e.g. a cloud metadata endpoint), closing the original SSRF finding from the security review. Also adds the two smaller frontend polish items: a debounced autocomplete dropdown on the header search box backed by a new /opportunities/suggest endpoint, and a one-click copy button for the community-submission email in the footer (native Clipboard API, no new dependency). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Umy9bW14TMbzW2QD7eLt3
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.
Summary
base_scraper.pynow resolves every hostname it's about to fetch — the initial discovery URL and every redirect hop — viasocket.getaddrinfo, and refuses to fetch anything that resolves to a private, loopback, link-local, multicast, or otherwise non-public address (e.g. the169.254.169.254cloud metadata endpoint). Redirects are now followed manually (allow_redirects=False) so each hop can be checked before it's requested.GET /opportunities/suggestendpoint (distinct, publicly-visible titles matching the query).hello@globalopportunities.appaddress in the footer, using the native Clipboard API (no new frontend dependency).Test plan
backend/tests/test_base_scraper.py: rejects unresolvable/private/loopback/link-local hosts, accepts public ones, rejects a redirect chain that leads to a private address, rejects the initial URL up front, fetches a normal page successfully, and bails out after too many redirects.backend/tests/test_suggest.py: rejects too-short queries, returns matches, excludes pending/rejected and expired opportunities, respectslimit.ruff checkclean.Generated by Claude Code