Skip to content

Harden scraper against SSRF, add search autocomplete and email copy button - #16

Merged
adab-tech merged 1 commit into
mainfrom
claude/globalopportunities-deploy-yukhn1
Aug 28, 2026
Merged

Harden scraper against SSRF, add search autocomplete and email copy button#16
adab-tech merged 1 commit into
mainfrom
claude/globalopportunities-deploy-yukhn1

Conversation

@adab-tech

Copy link
Copy Markdown
Owner

Summary

  • Closes the SSRF finding from the earlier security review: base_scraper.py now resolves every hostname it's about to fetch — the initial discovery URL and every redirect hop — via socket.getaddrinfo, and refuses to fetch anything that resolves to a private, loopback, link-local, multicast, or otherwise non-public address (e.g. the 169.254.169.254 cloud metadata endpoint). Redirects are now followed manually (allow_redirects=False) so each hop can be checked before it's requested.
  • Adds a debounced autocomplete dropdown on the header search box, backed by a new GET /opportunities/suggest endpoint (distinct, publicly-visible titles matching the query).
  • Adds a one-click "Copy" button next to the hello@globalopportunities.app address in the footer, using the native Clipboard API (no new frontend dependency).

Test plan

  • New 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.
  • New backend/tests/test_suggest.py: rejects too-short queries, returns matches, excludes pending/rejected and expired opportunities, respects limit.
  • Full backend suite (313 tests) passes; ruff check clean.
  • Verified the autocomplete dropdown and copy button manually in a headless browser (Playwright) against a local backend with real dev data — both work end-to-end.

Generated by Claude Code

…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
Copilot AI lite review requested due to automatic review settings August 28, 2026 03:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@adab-tech
adab-tech merged commit ebbee53 into main Aug 28, 2026
4 checks passed
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.

3 participants