Repository navigation
fix: harden dns lookups for webhooks - #3588
Conversation
🔴 Tier 4 — CriticalTouches authentication, tenancy data models, the public API or shipped database config — or substantially changes the query rendering engine, background tasks, the OTel pipeline, image build, or release CI. Why this tier:
Additional context: touches background tasks or the delivery pipeline lightly (11 lines, under the 30-line bar for Tier 4) Review process: Deep review from a domain expert. Synchronous walkthrough may be required. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review
2 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 2 minor 1 posted as inline comment(s) on the changed lines. 1 listed below. Findings outside the changed lines1 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. The SSRF/DNS-rebinding hardening is sound: 🟡 P2 — recommended
🔵 P3 nitpicks (6)
Reviewers (9): correctness, security, adversarial, reliability, testing, maintainability, kieran-typescript, project-standards, previous-comments. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 465 passed • 1 skipped • 1428s
Tests ran across 4 shards in parallel. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| // private IP (e.g. 127-0-0-1.nip.io) gets through it. Checking at connect time | ||
| // also covers DNS rebinding, since the checked address is the one dialed. | ||
| // Node skips lookup for IP literals; validateWebhookUrl covers those. | ||
| export const webhookLookup: LookupFunction = (hostname, options, callback) => { |
There was a problem hiding this comment.
🔵 minor — Save and /validate still accept hostnames that every delivery will now reject
The new resolved-address check runs only at send time, through the undici dispatcher in generic.ts. WEBHOOK_CONFIG_CHECKS (validators.ts:219), which create and POST /api/v2/webhooks/validate both use, checks only the hostname string. So a URL like http://127-0-0-1.nip.io/ or an internal name that isn't allowlisted saves without error, then every alert firing fails and the problem shows up only in logs and alert history. This also breaks the invariant stated in the comment above that list. Fix: add an async resolve-and-isPrivateIp check (the same logic as webhookLookup) to the create/validate path, so these configs are rejected with a 400 when saved. Keep the connect-time check as the rebinding guard.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Summary
Hardens the webhook logic by doing an actual lookup of the DNS record and determining whether to proceed/error.
References