Skip to content

fix(api): prevent DNS rebinding SSRF in URL fetching - #162

Merged
SashankBhamidi merged 1 commit into
mainfrom
fix/dns-rebinding-ssrf-70
Sep 12, 2026
Merged

SashankBhamidi merged 1 commit into
mainfrom
fix/dns-rebinding-ssrf-70

Conversation

@SashankBhamidi

Copy link
Copy Markdown
Member

/fetch and /fernet/{token} validated a URL's hostname before resolving DNS, so an attacker's domain could pass validation with a public IP and then resolve to a private one for the actual request.

Every hop now resolves DNS once, checks every address it returns, and pins the connection to one of them. New module webapp/_ssrf.py holds this logic; both endpoints share one fetch_with_pinned_redirects() helper instead of duplicating it. Address validation switched from a hand-maintained block list to an allowlist based on ip.is_global, since the old list missed IPv4-mapped IPv6 and a few other non-routable ranges.

Closes #70

@SashankBhamidi
SashankBhamidi requested a lite review from Copilot September 12, 2026 01:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

@read-the-docs-community

read-the-docs-community Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 icalendar-anonymizer | 🛠️ Build #34520457 | 📁 Comparing 4592956 against latest (ebdf1e0)

  🔍 Preview build  

3 files changed
± 404.html
± changelog.html
± _static/webpack-macros.html

@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.47909% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/icalendar_anonymizer/webapp/_ssrf.py 95.45% 3 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@SashankBhamidi
SashankBhamidi force-pushed the fix/dns-rebinding-ssrf-70 branch from 92d293c to 4592956 Compare September 12, 2026 01:20
@SashankBhamidi
SashankBhamidi merged commit 820a4cf into main Sep 12, 2026
15 checks passed
@SashankBhamidi
SashankBhamidi deleted the fix/dns-rebinding-ssrf-70 branch September 12, 2026 04:34
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.

Enhance SSRF protection against DNS rebinding attacks

2 participants