Skip to content

fix: add SSRF protection to link preview fetching#22

Merged
j4rviscmd merged 1 commit intomainfrom
fix/ssrf-protection
Mar 23, 2026
Merged

fix: add SSRF protection to link preview fetching#22
j4rviscmd merged 1 commit intomainfrom
fix/ssrf-protection

Conversation

@j4rviscmd
Copy link
Copy Markdown
Owner

Summary

  • Block requests to private/reserved IP addresses (loopback, private ranges, link-local, cloud metadata) by resolving the hostname before fetching
  • Validate redirect targets via a custom reqwest redirect policy
  • Cover both IPv4 and IPv6 link-local ranges

Test plan

  • Paste http://127.0.0.1 → blocked (URL displayed as-is)
  • Paste http://localhost → blocked
  • Paste http://192.168.x.x → blocked
  • Paste http://169.254.169.254 → blocked (cloud metadata)
  • Paste a normal URL (e.g. https://github.com) → title fetched successfully

🤖 Generated with Claude Code

Block requests to private/reserved IP addresses (loopback, private
ranges, link-local, cloud metadata) by resolving the hostname before
fetching. Redirect targets are also validated via a custom redirect
policy. Covers both IPv4 and IPv6 link-local ranges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@j4rviscmd j4rviscmd merged commit 6677b07 into main Mar 23, 2026
@j4rviscmd j4rviscmd deleted the fix/ssrf-protection branch March 23, 2026 00:26
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