feat(protect): DNS-rebinding resistance for egress (Node http path) - #89
Merged
Merged
Conversation
|
DNS-rebinding guard is well-designed and thoroughly tested. 🎯 Quality: 100% Elite · 📦 Size: Medium 📈 This month: Your 38th PR — above team average · Averaging Excellent |
The egress guard screened outbound calls by hostname, so a name that passes the check but resolves to an internal/metadata IP (DNS rebinding, or just a hostname pointing inward) slipped through. On the Node http/https path, inject a screening DNS `lookup` into the request options: resolve the hostname, run each resolved address through the same egress predicate (so `internal_host` rules + allowlist apply to the IP too), block if any is disallowed, and pin the connection to the vetted resolution — closing the time-of-check/time-of-use gap. Only for real hostnames (literal IPs are already covered by the sync check). Default on via `screenDns` (disable with `screenDns: false`); needs node:dns/net, so it's a no-op on edge runtimes, where hostname rules still apply. Fail-open: a resolver or injection error proceeds unscreened rather than breaking the request. `lookup` is injectable for tests. The fetch/undici path is intentionally left for a follow-up. +5 tests, 495 total, typecheck (incl. template check) + build clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
patchstackdave
force-pushed
the
feat/protect-egress-dns-rebinding
branch
from
July 16, 2026 06:52
a241861 to
80e78d8
Compare
Contributor
Author
|
/review |
mariojgt
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The egress guard screened outbound calls by hostname, so a name that passes the check but resolves to an internal/metadata IP (DNS rebinding, or just a hostname pointing inward) slipped through.
On the Node http/https path, inject a screening DNS
lookupinto the request options:internal_hostrules + the allowlist apply to the resolved IP too),Only for real hostnames (literal IPs already covered by the sync check). Default on via
screenDns(disable withscreenDns: false); needsnode:dns/net, so it's a no-op on edge runtimes (hostname rules still apply). Fail-open: a resolver/injection error proceeds unscreened rather than breaking the request. The resolver is injectable for tests.The fetch/undici path is intentionally deferred (the fiddly part — needs a custom dispatcher to pin) — this is the easy, complete Node-path fix.
+5 tests. 495 pass, typecheck (incl. template check) + build clean.