Skip to content

fix(alert): harden webhook SSRF filter (#333) - #349

Merged
ajianaz merged 3 commits into
developfrom
fix/333-webhook-ssrf
Oct 13, 2026
Merged

ajianaz merged 3 commits into
developfrom
fix/333-webhook-ssrf

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #333

What

  • Resolve DNS once, reject the webhook if ANY record is non-public, and pin the connection to the vetted addresses (resolve_to_addrs). Redirects stay disabled.
  • ip_is_private covers IPv4-mapped IPv6, ULA, fec0::/10, 64:ff9b::/96, multicast, 0.0.0.0/8, 192.0.0.0/24, 198.18.0.0/15, broadcast, 240/4.
  • Uses url::Host so bracketed IPv6 and decimal/hex/octal literals are judged correctly; blocks localhost aliases and userinfo URLs.
  • Webhook URL is validated at rule creation (400 on failure).
  • Logs host only, never the full URL.

Why

The SSRF filter was bypassable via DNS rebinding/TOCTOU, mixed public/private records, IPv4-mapped/ULA addresses and missing creation-time validation (issue #333). Full URLs (often containing tokens) were also logged.

Testing

New unit tests for ranges, literal encodings, URL validation and mixed-record rejection. cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace all pass.

Deferred: no rule-update endpoint exists; per-request client drops connection pooling.

🤖 Generated with Claude Code

ajianaz and others added 3 commits October 13, 2026 08:35
Resolve DNS once, reject if any record is non-public, pin the connection to
the vetted addresses (closes rebinding/TOCTOU). Cover IPv4-mapped IPv6, ULA,
site-local, NAT64, 0/8, 192.0.0/24, 198.18/15, multicast, broadcast, reserved.
Use url::Host so bracketed/decimal/hex/octal literals are judged correctly,
block localhost aliases and userinfo. Validate webhook URL at rule creation
(400). Log host only, not the full URL (may contain tokens).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ajianaz
ajianaz merged commit e74c5b0 into develop Oct 13, 2026
16 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.

security: webhook SSRF filter bypassable (follow-up to #295, #202)

1 participant