fix(dns): enforce a timeout floor alongside the resolver pool#365
Open
TBX3D wants to merge 4 commits into
Open
fix(dns): enforce a timeout floor alongside the resolver pool#365TBX3D wants to merge 4 commits into
TBX3D wants to merge 4 commits into
Conversation
DNS modules were a stub that returned the unsupported sentinel. Implement
the executor: resolve the configured name and record type, then run the
module's matchers and extractors against the answer. A matcher targets a
part, either the record set (answer), the response status (rcode), or the
full response (default), so a status like NXDOMAIN is matchable directly.
A name's {{FQDN}} resolves to the target host. The record type and matcher
types are validated at parse time so a bad module fails to load rather than
silently matching nothing. Promotes miekg/dns to a direct dependency for the
record type codes.
the dns executor built its resolver over a hardcoded public pool and ignored the -resolvers flag, so dns modules could never target an internal or authoritative resolver and could not be exercised without external egress. thread the parsed resolver list through Options into newDNSResolver, falling back to the bundled pool when none is given.
first shipped type: dns module: resolves the target's txt records, reports its spf policy and extracts the sender set and enforcement qualifier.
opts.Timeout <= 0 reached retryabledns as a literal zero, and retryabledns applies no default of its own, so a black-hole or non-responsive resolver blocked the query forever. floor it to defaultDNSTimeout before building the client, mirroring the tcp executor's existing floor.
pr summary10 files changed (+856 -35)
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #365 +/- ##
=======================================
Coverage ? 55.52%
=======================================
Files ? 82
Lines ? 7000
Branches ? 0
=======================================
Hits ? 3887
Misses ? 2843
Partials ? 270 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 resolver pool change let a caller-supplied timeout of zero (or unset) slip through uncapped, so a hung resolver could block a scan indefinitely. enforce a minimum floor regardless of what the caller passes.