Skip to content

feat: support auto wildcard detection across multiple domains#960

Open
supreme2580 wants to merge 4 commits intoprojectdiscovery:devfrom
supreme2580:issue-924
Open

feat: support auto wildcard detection across multiple domains#960
supreme2580 wants to merge 4 commits intoprojectdiscovery:devfrom
supreme2580:issue-924

Conversation

@supreme2580
Copy link

@supreme2580 supreme2580 commented Mar 13, 2026

Description

This PR implements automatic wildcard detection and filtering, similar to the functionality in PureDNS. It allows dnsx to automatically identify the base domain for each input host and perform wildcard probing/filtering across multiple domains in a single run.

Key Changes

  • New Flag: Introduced --auto-wildcard (-aw) to enable automatic base domain extraction and wildcard verification.
  • Dynamic Wildcard Logic: Updated the wildcard detection in wildcard.go to dynamically resolve the base domain for each host when the auto mode is active.
  • Multi-Domain Support: Modified runner.go to handle the post-scan filtering flow when multiple domains are involved.
  • Improved Extraction: Enhanced the extractDomain utility in util.go to accurately identify base domains (e.g., a.b.example.com -> example.com) for both URL and raw string inputs.
  • Maintenance: Updated .gitignore to exclude local build binaries.

Usage

# Detect and filter wildcards automatically for all domains in a list
dnsx -l hosts.txt -aw -json

# Combine with other flags
cat subdomains.txt | dnsx -aw -resp

This feature is fully optional and ensures that existing workflows using -wd or standard resolution remain unaffected.

/claim #924

closes: #924

Summary by CodeRabbit

  • New Features

    • New --auto-wildcard (-aw) flag to enable dynamic wildcard subdomain handling.
  • Improvements

    • Enhanced domain extraction to better determine base domains for wildcard detection and matching.
    • Wildcard handling now supports deriving wildcard domains dynamically when enabled.
  • Tests

    • Added unit tests covering domain extraction behavior.
  • Chores

    • Updated ignore rules and refreshed dependency/toolchain declarations.

Introduce auto-wildcard flag to enable automatic wildcard detection based on domain extraction. Modify extractDomain function to handle both URLs and plain domains, extracting base domain (e.g., sub.example.com -> example.com). This eliminates the need to manually specify wildcard domain when processing mixed input formats.
@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Walkthrough

Adds an optional --auto-wildcard flag and wiring to derive wildcard domains from hosts at runtime; enhances extractDomain to return eTLD+1 with fallbacks; updates wildcard detection/handling across runner/worker; adds tests; updates go.mod and .gitignore.

Changes

Cohort / File(s) Summary
Ignore file
/.gitignore
Added ignore entries for dnsx artifacts (dnsx, cmd/dnsx/dnsx).
CLI / Options
internal/runner/options.go
Introduced exported AutoWildcard bool and CLI flag --auto-wildcard (-aw).
Runner & worker flow
internal/runner/runner.go, internal/runner/wildcard.go
Wildcard handling now optionally derives wildcardDomain via AutoWildcard; updated matching, host generation, filtering, and storage points to use resolved domain.
Domain util & tests
internal/runner/util.go, internal/runner/util_test.go
extractDomain() enhanced to accept hosts/URLs, trim trailing dots, and return eTLD+1 using publicsuffix with a fallback; added TestExtractDomain.
Module deps
go.mod
Updated multiple dependency versions and added indirect deps (including golang.org/x/net / publicsuffix-related changes).

Sequence Diagram(s)

sequenceDiagram
  participant CLI as CLI (flag)
  participant Runner as Runner
  participant Extractor as DomainExtractor
  participant Worker as DNSWorker
  participant Store as ResultStore

  CLI->>Runner: start with --auto-wildcard
  Runner->>Runner: set AutoWildcard = true
  Runner->>Worker: dispatch lookup request (host)
  alt AutoWildcard enabled
    Worker->>Extractor: extractDomain(host)
    Extractor-->>Worker: wildcardDomain (eTLD+1)
  else AutoWildcard disabled
    Worker-->>Worker: use configured WildcardDomain
  end
  Worker->>Worker: perform DNS query
  Worker-->>Runner: return answers + wildcardDomain
  Runner->>Runner: filter results by wildcardDomain
  Runner->>Store: persist non-wildcard results
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I hop through hosts in moonlit code,
I trim the dots and chase the core,
A flag unfurls to find the lair,
I name the root where wildcards roar,
Then skip the noise and bound for more 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main feature: adding auto wildcard detection support across multiple domains, which is the core objective of this PR.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #924: auto wildcard flag, dynamic base-domain extraction for each host, automatic filtering, and optional behavior without affecting existing workflows.
Out of Scope Changes check ✅ Passed The PR includes .gitignore updates for build binaries and dependency version adjustments that are reasonable supporting changes; all core modifications directly support the auto-wildcard feature.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
internal/runner/options.go (1)

309-311: Consider adding stream mode validation for AutoWildcard.

WildcardDomain is explicitly blocked in stream mode (line 309-310), but AutoWildcard isn't checked. Since wildcard filtering requires post-scan processing that runStream() doesn't perform, enabling --auto-wildcard with --stream would silently have no effect.

💡 Proposed fix
 		if options.WildcardDomain != "" {
 			gologger.Fatal().Msgf("wildcard not supported in stream mode")
 		}
+		if options.AutoWildcard {
+			gologger.Fatal().Msgf("auto-wildcard not supported in stream mode")
+		}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/runner/options.go` around lines 309 - 311, The stream mode
validation currently blocks options.WildcardDomain but misses
options.AutoWildcard; update the validation in the same place where
options.WildcardDomain is checked to also detect options.AutoWildcard and abort
with the same fatal-style message (e.g., call gologger.Fatal().Msgf("wildcard
not supported in stream mode")) so that enabling --auto-wildcard with
runStream() fails loudly; reference the options.AutoWildcard field and the
runStream() context when adding this check.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/runner/util.go`:
- Around line 46-65: The current last-two-labels heuristic in the
domain-extraction logic (used in functions around util.go that parse
URL/hostname before wildcard trimming) fails for multi-part TLDs and
trailing-dot hostnames; replace that logic to use
golang.org/x/net/publicsuffix.EffectiveTLDPlusOne: first normalize the input by
trimming any trailing dot(s), if the input is not a full URL keep treating it as
a hostname, parse URL when needed to get u.Hostname(), then call
publicsuffix.EffectiveTLDPlusOne(hostname) and return that result; if
EffectiveTLDPlusOne returns an error or empty string, fall back to a safe join
of the last two labels of the cleaned hostname as before; add the import for
golang.org/x/net/publicsuffix and ensure all calls reference the same helper
function (e.g., your domain-extraction function) so downstream code like
TrimSuffix in wildcard.go and comparisons in runner.go use the corrected value.

---

Nitpick comments:
In `@internal/runner/options.go`:
- Around line 309-311: The stream mode validation currently blocks
options.WildcardDomain but misses options.AutoWildcard; update the validation in
the same place where options.WildcardDomain is checked to also detect
options.AutoWildcard and abort with the same fatal-style message (e.g., call
gologger.Fatal().Msgf("wildcard not supported in stream mode")) so that enabling
--auto-wildcard with runStream() fails loudly; reference the
options.AutoWildcard field and the runStream() context when adding this check.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7f9571f0-13d3-4d49-8b19-1027c637f1d7

📥 Commits

Reviewing files that changed from the base of the PR and between fe80b18 and 17191a6.

📒 Files selected for processing (5)
  • .gitignore
  • internal/runner/options.go
  • internal/runner/runner.go
  • internal/runner/util.go
  • internal/runner/wildcard.go

Replace manual domain parsing with golang.org/x/net/publicsuffix.EffectiveTLDPlusOne
for accurate eTLD+1 extraction. This correctly handles complex TLDs like .co.uk and
.com.au. Add comprehensive test cases to validate the behavior.

Update Go version to 1.25.0 and bump dependency versions accordingly.
Downgrade Go version from 1.25.0 to 1.24.0 with toolchain 1.24.5 to maintain compatibility with the ecosystem. Update multiple projectdiscovery dependencies to older versions and adjust transitive dependencies accordingly. Add missing golang.org/x/net and google.golang.org/protobuf dependencies that are required by the downgraded dependency graph.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@go.mod`:
- Line 125: Update the golang.org/x/oauth2 module from v0.11.0 to v0.27.0:
change the require entry for golang.org/x/oauth2 to v0.27.0 (or run `go get
golang.org/x/oauth2@v0.27.0`) and then regenerate the module graph by running
`go mod tidy` (or `go get` followed by `go mod tidy`) to update go.sum and
dependencies; ensure CI builds to verify no breakages where oauth2 is used.
- Line 122: Update the golang.org/x/crypto module reference from v0.31.0 to
v0.45.0 (or later) in go.mod to mitigate the listed CVEs; run `go get
golang.org/x/crypto@v0.45.0` (or `go get -u golang.org/x/crypto`), then run `go
mod tidy` to update go.sum, and run the test suite/build to verify nothing
breaks (look for the dependency entry "golang.org/x/crypto" in go.mod to
change).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6a517248-cf68-4df1-ae68-befb38cef363

📥 Commits

Reviewing files that changed from the base of the PR and between 7b718df and 58f8584.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • go.mod

Update several golang.org/x/* modules to newer versions:
- golang.org/x/net from v0.33.0 to v0.47.0
- golang.org/x/crypto from v0.31.0 to v0.45.0
- golang.org/x/sys from v0.28.0 to v0.38.0
- golang.org/x/text from v0.21.0 to v0.31.0
- golang.org/x/mod from v0.18.0 to v0.29.0
- golang.org/x/tools from v0.22.0 to v0.38.0
- golang.org/x/sync from v0.10.0 to v0.18.0
- golang.org/x/term from v0.27.0 to v0.37.0
- golang.org/x/oauth2 from v0.11.0 to v0.27.0

Remove unused github.com/golang/protobuf, google.golang.org/appengine, and google.golang.org/protobuf dependencies to keep the dependency tree clean.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@go.mod`:
- Line 111: The go.mod downgrade of github.com/weppos/publicsuffix-go to v0.30.1
is inconsistent with the new extractDomain change that relies on publicsuffix
logic; update the go.mod to a current compatible version (e.g. v0.40.x) or
remove the explicit older indirect requirement so the module graph resolves the
newer publicsuffix implementation, then run go mod tidy to refresh sums; ensure
extractDomain references the golang.org/x/net/publicsuffix behavior you expect
after the dependency change.
- Line 20: Review the commit or dependency changes that replaced
github.com/projectdiscovery/retryabledns v1.0.111 with v1.0.102: check the
go.sum/history/replace directives, module upgrades in nearby commits, and
CI/build logs for errors; verify differences between v1.0.111 and v1.0.102 by
inspecting the upstream changelog/commit history for retryabledns and confirm
any behavioral/regression reasons for pinning, focusing on the Options struct
and NewWithOptions() API, and then either restore the newer version (v1.0.111+)
if safe or add a concise comment/PR note explaining the explicit downgrade and
the rationale (including any observed bug/regression) so future reviewers
understand why v1.0.102 was chosen.
- Around line 12-24: The go.mod changes show unintended downgrades of several
projectdiscovery/* modules; verify whether these version changes are intentional
and either pin the intended versions or document the rationale: inspect and
update go.mod to the correct versions for
github.com/projectdiscovery/{cdncheck,gologger,hmap,mapcidr,ratelimit,retryabledns,utils}
(or add a clear commit message/CHANGELOG entry explaining the downgrade), run
`go get`/`go mod tidy` to lock them, then run full tests and static checks to
confirm API compatibility with code that imports utils subpackages (fileutil,
iputil, mapsutil, sliceutil) and with retryabledns.CheckInternalIPs and the
retryabledns.DNSData unmarshalling; if incompatibilities are found, either
restore newer versions or adapt call sites accordingly and document the
decision.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 772728c2-6fa5-445c-8cf7-3b47ee17790b

📥 Commits

Reviewing files that changed from the base of the PR and between 58f8584 and 9ba00e5.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • go.mod

Comment on lines +12 to +24
github.com/projectdiscovery/cdncheck v1.1.36
github.com/projectdiscovery/clistats v0.1.1
github.com/projectdiscovery/goconfig v0.0.1
github.com/projectdiscovery/goflags v0.1.74
github.com/projectdiscovery/gologger v1.1.62
github.com/projectdiscovery/hmap v0.0.98
github.com/projectdiscovery/mapcidr v1.1.97
github.com/projectdiscovery/ratelimit v0.0.82
github.com/projectdiscovery/retryabledns v1.0.111
github.com/projectdiscovery/utils v0.7.3
github.com/projectdiscovery/gologger v1.1.56
github.com/projectdiscovery/hmap v0.0.90
github.com/projectdiscovery/mapcidr v1.1.34
github.com/projectdiscovery/ratelimit v0.0.81
github.com/projectdiscovery/retryabledns v1.0.102
github.com/projectdiscovery/utils v0.4.20
github.com/rs/xid v1.5.0
github.com/stretchr/testify v1.11.1
golang.org/x/net v0.47.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

❓ Verification inconclusive

Script executed:

#!/bin/bash
# Check git history for these dependency versions to determine if this is a revert

echo "=== Checking cdncheck version history ==="
git log --all --oneline -S 'github.com/projectdiscovery/cdncheck v1.1.36' -- go.mod | head -5

echo ""
echo "=== Checking utils version history ==="
git log --all --oneline -S 'github.com/projectdiscovery/utils v0.4.20' -- go.mod | head -5

echo ""
echo "=== Checking retryabledns version history ==="
git log --all --oneline -S 'github.com/projectdiscovery/retryabledns v1.0.102' -- go.mod | head -5

echo ""
echo "=== Checking recent go.mod changes on dev branch ==="
git log --oneline origin/dev -- go.mod | head -10

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Script execution failed with error: Request timed out after 120000ms (requestId=bf2c281a-5658-4f18-8353-f4f4ae26df0e)


Script executed:

# First, let's read the go.mod file to confirm the versions
head -30 go.mod

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0

stdout:

module github.com/projectdiscovery/dnsx

go 1.24.0

toolchain go1.24.5

require (
	github.com/logrusorgru/aurora v2.0.3+incompatible
	github.com/miekg/dns v1.1.62
	github.com/pkg/errors v0.9.1
	github.com/projectdiscovery/asnmap v1.1.1
	github.com/projectdiscovery/cdncheck v1.1.36
	github.com/projectdiscovery/clistats v0.1.1
	github.com/projectdiscovery/goconfig v0.0.1
	github.com/projectdiscovery/goflags v0.1.74
	github.com/projectdiscovery/gologger v1.1.56
	github.com/projectdiscovery/hmap v0.0.90
	github.com/projectdiscovery/mapcidr v1.1.34
	github.com/projectdiscovery/ratelimit v0.0.81
	github.com/projectdiscovery/retryabledns v1.0.102
	github.com/projectdiscovery/utils v0.4.20
	github.com/rs/xid v1.5.0
	github.com/stretchr/testify v1.11.1
	golang.org/x/net v0.47.0
)

require (
	aead.dev/minisign v0.2.0 // indirect
	github.com/Masterminds/semver/v3 v3.2.1 // indirect
	github.com/Mzack9999/gcache v0.0.0-20230410081825-519e28eab057 // indirect

Script executed:

# Check the full go.mod file to see all dependencies
wc -l go.mod

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0

stdout:

134 go.mod

Script executed:

# Search for usage of the key downgraded libraries in the codebase
rg "github.com/projectdiscovery/utils" --type go -A 2 | head -30

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0

stdout:

internal/runner/banner.go:	"github.com/projectdiscovery/utils/auth/pdcp"
internal/runner/banner.go:	updateutils "github.com/projectdiscovery/utils/update"
internal/runner/banner.go-)
internal/runner/banner.go-
--
internal/runner/util.go:	fileutil "github.com/projectdiscovery/utils/file"
internal/runner/util.go-	"golang.org/x/net/publicsuffix"
internal/runner/util.go-)
--
internal/runner/runner_test.go:	stringsutil "github.com/projectdiscovery/utils/strings"
internal/runner/runner_test.go-	"github.com/stretchr/testify/require"
internal/runner/runner_test.go-)
--
internal/runner/runner.go:	fileutil "github.com/projectdiscovery/utils/file"
internal/runner/runner.go:	iputil "github.com/projectdiscovery/utils/ip"
internal/runner/runner.go:	mapsutil "github.com/projectdiscovery/utils/maps"
internal/runner/runner.go:	sliceutil "github.com/projectdiscovery/utils/slice"
internal/runner/runner.go-)
internal/runner/runner.go-
--
internal/runner/options.go:	"github.com/projectdiscovery/utils/auth/pdcp"
internal/runner/options.go:	"github.com/projectdiscovery/utils/env"
internal/runner/options.go:	fileutil "github.com/projectdiscovery/utils/file"
internal/runner/options.go:	updateutils "github.com/projectdiscovery/utils/update"
internal/runner/options.go-)
internal/runner/options.go-
--
internal/runner/healthcheck.go:	fileutil "github.com/projectdiscovery/utils/file"
internal/runner/healthcheck.go-)
internal/runner/healthcheck.go-

Script executed:

# Check for usage of retryabledns
rg "retryabledns" --type go -B 2 -A 2 | head -30

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0

stdout:

internal/runner/options.go-	options := &Options{}
internal/runner/options.go-	flagSet := goflags.NewFlagSet()
internal/runner/options.go:	flagSet.SetDescription(`dnsx is a fast and multi-purpose DNS toolkit allow to run multiple probes using retryabledns library.`)
internal/runner/options.go-
internal/runner/options.go-	flagSet.CreateGroup("input", "Input",
--
internal/runner/options.go-		}
internal/runner/options.go-		options.Response = true
internal/runner/options.go:		// the ANY query type is not supported by the retryabledns library,
internal/runner/options.go-		// thus it's hard to filter the results when it's used in combination with other query types
internal/runner/options.go-		options.ExcludeType = append(options.ExcludeType, "any")
--
internal/runner/runner.go-	"github.com/projectdiscovery/mapcidr/asn"
internal/runner/runner.go-	"github.com/projectdiscovery/ratelimit"
internal/runner/runner.go:	"github.com/projectdiscovery/retryabledns"
internal/runner/runner.go-	fileutil "github.com/projectdiscovery/utils/file"
internal/runner/runner.go-	iputil "github.com/projectdiscovery/utils/ip"
--
internal/runner/runner.go-
internal/runner/runner.go-func New(options *Options) (*Runner, error) {
internal/runner/runner.go:	retryabledns.CheckInternalIPs = true
internal/runner/runner.go-
internal/runner/runner.go-	dnsxOptions := dnsx.DefaultOptions
--
internal/runner/runner.go-		// prepare in memory structure similarly to shuffledns
internal/runner/runner.go-		r.hm.Scan(func(k, v []byte) error {
internal/runner/runner.go:			var dnsdata retryabledns.DNSData
internal/runner/runner.go-			if err := json.Unmarshal(v, &dnsdata); err != nil {
internal/runner/runner.go-				// the item has no record - ignore
--

Script executed:

# Look for any PR description or comments explaining the downgrades
find . -name "*.md" -type f -exec grep -l "downgrade\|version\|dependency" {} \; | head -10

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0

stdout:

./.github/ISSUE_TEMPLATE/issue-report.md
./README.md

Script executed:

# Check the current branch and recent commits
git status
git log -5 --oneline

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0

stdout:

HEAD detached at FETCH_HEAD
nothing to commit, working tree clean
9ba00e5 build: update Go dependencies to newer versions

Script executed:

# Check if there's a PR template or description
find . -name "*.md" -type f | xargs grep -l "auto wildcard\|publicsuffix" 2>/dev/null | head -5

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0


Script executed:

# Check the actual PR or branch information
git log --all --oneline --graph | head -20

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0

stdout:

* 9ba00e5 build: update Go dependencies to newer versions
* fe80b18 version update
*   b05668c Merge pull request `#916` from projectdiscovery/fix/omit-raw-flag
|\  
| * 00c85d3 fix: remove RawResp from JSON output completely
* | 62d3a7a chore(deps): bump the modules group with 8 updates
* | 31932fd chore(deps): bump the modules group with 8 updates (`#922`)
* | 3ba9878 chore(deps): bump the modules group across 1 directory with 8 updates
* | 8c02098 chore(deps): bump the modules group with 4 updates (`#915`)
|/  
* 6aaab05 chore(deps): bump the modules group with 6 updates
* d2f53f4 chore(deps): bump the modules group across 1 directory with 9 updates
*   037e267 Merge pull request `#903` from jjhwan-h/fix/wd
|\  
| *   44a9b20 Merge branch 'dev' into pr/903
| |\  
| |/  
|/|   
* |   31d97f2 Merge pull request `#907` from geeknik/dev
|\ \  

Script executed:

# Look for any comments in go.mod about version choices
cat go.mod | grep -A 2 -B 2 "utils\|retryabledns\|cdncheck"

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0

stdout:

	github.com/pkg/errors v0.9.1
	github.com/projectdiscovery/asnmap v1.1.1
	github.com/projectdiscovery/cdncheck v1.1.36
	github.com/projectdiscovery/clistats v0.1.1
	github.com/projectdiscovery/goconfig v0.0.1
--
	github.com/projectdiscovery/mapcidr v1.1.34
	github.com/projectdiscovery/ratelimit v0.0.81
	github.com/projectdiscovery/retryabledns v1.0.102
	github.com/projectdiscovery/utils v0.4.20
	github.com/rs/xid v1.5.0
	github.com/stretchr/testify v1.11.1

Script executed:

# Check if there's a go.sum that might give us hints about why these versions were chosen
grep "github.com/projectdiscovery/utils" go.sum | head -10

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0

stdout:

github.com/projectdiscovery/utils v0.4.20 h1:7Fmjb+4YZJSzn7bL21sjF3wAR53eSi7VdAfDkDBUUwY=
github.com/projectdiscovery/utils v0.4.20/go.mod h1:RnC23+hI8j4drZFHQpMX92hV9++9d/yBeNr1pzcbF7Y=

Script executed:

# Show the previous version of go.mod to see what was before
git show HEAD~1:go.mod | grep -E "utils|retryabledns|cdncheck" | head -10

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0

stderr:

fatal: invalid object name 'HEAD~1'.

Script executed:

# Check git blame or history for when these were last downgraded
git log --all --oneline --follow -- go.mod | head -20

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0

stdout:

9ba00e5 build: update Go dependencies to newer versions
62d3a7a chore(deps): bump the modules group with 8 updates
31932fd chore(deps): bump the modules group with 8 updates (`#922`)
3ba9878 chore(deps): bump the modules group across 1 directory with 8 updates
8c02098 chore(deps): bump the modules group with 4 updates (`#915`)
6aaab05 chore(deps): bump the modules group with 6 updates
d2f53f4 chore(deps): bump the modules group across 1 directory with 9 updates
da2aebb chore(deps): bump the modules group across 1 directory with 6 updates
92dbe0b bump
ed433b2 chore(deps): bump the modules group across 1 directory with 8 updates
16bbeb8 bump retryabledns
cfdced5 chore(deps): bump the modules group with 9 updates
a596d0e bump go
ea44ab2 chore(deps): bump the modules group across 1 directory with 10 updates
f3d64a4 chore(deps): bump github.com/projectdiscovery/gologger
54cae21 chore(deps): bump github.com/projectdiscovery/retryablehttp-go
48bb5be chore(deps): bump github.com/projectdiscovery/fastdialer
b3309b6 chore(deps): bump github.com/projectdiscovery/hmap from 0.0.75 to 0.0.77
06e3a34 chore(deps): bump github.com/projectdiscovery/retryabledns
870631b chore(deps): bump github.com/projectdiscovery/fastdialer

Script executed:

# Show detailed diff of the go.mod changes in this commit
git show HEAD -- go.mod | head -80

Repository: projectdiscovery/dnsx


Repository: projectdiscovery/dnsx
Exit code: 0

stdout:

commit 9ba00e52ebc1f20d5ed1bcb683bd93767a8ebcc8
Author: supreme2580 <victoromorogbe69@gmail.com>
Date:   Fri Mar 13 12:07:14 2026 +0100

    build: update Go dependencies to newer versions
    
    Update several golang.org/x/* modules to newer versions:
    - golang.org/x/net from v0.33.0 to v0.47.0
    - golang.org/x/crypto from v0.31.0 to v0.45.0
    - golang.org/x/sys from v0.28.0 to v0.38.0
    - golang.org/x/text from v0.21.0 to v0.31.0
    - golang.org/x/mod from v0.18.0 to v0.29.0
    - golang.org/x/tools from v0.22.0 to v0.38.0
    - golang.org/x/sync from v0.10.0 to v0.18.0
    - golang.org/x/term from v0.27.0 to v0.37.0
    - golang.org/x/oauth2 from v0.11.0 to v0.27.0
    
    Remove unused github.com/golang/protobuf, google.golang.org/appengine, and google.golang.org/protobuf dependencies to keep the dependency tree clean.

diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..a3b6d60
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,134 @@
+module github.com/projectdiscovery/dnsx
+
+go 1.24.0
+
+toolchain go1.24.5
+
+require (
+	github.com/logrusorgru/aurora v2.0.3+incompatible
+	github.com/miekg/dns v1.1.62
+	github.com/pkg/errors v0.9.1
+	github.com/projectdiscovery/asnmap v1.1.1
+	github.com/projectdiscovery/cdncheck v1.1.36
+	github.com/projectdiscovery/clistats v0.1.1
+	github.com/projectdiscovery/goconfig v0.0.1
+	github.com/projectdiscovery/goflags v0.1.74
+	github.com/projectdiscovery/gologger v1.1.56
+	github.com/projectdiscovery/hmap v0.0.90
+	github.com/projectdiscovery/mapcidr v1.1.34
+	github.com/projectdiscovery/ratelimit v0.0.81
+	github.com/projectdiscovery/retryabledns v1.0.102
+	github.com/projectdiscovery/utils v0.4.20
+	github.com/rs/xid v1.5.0
+	github.com/stretchr/testify v1.11.1
+	golang.org/x/net v0.47.0
+)
+
+require (
+	aead.dev/minisign v0.2.0 // indirect
+	github.com/Masterminds/semver/v3 v3.2.1 // indirect
+	github.com/Mzack9999/gcache v0.0.0-20230410081825-519e28eab057 // indirect
+	github.com/Mzack9999/go-http-digest-auth-client v0.6.1-0.20220414142836-eb8883508809 // indirect
+	github.com/STARRY-S/zip v0.2.1 // indirect
+	github.com/VividCortex/ewma v1.2.0 // indirect
+	github.com/akrylysov/pogreb v0.10.1 // indirect
+	github.com/alecthomas/chroma/v2 v2.14.0 // indirect
+	github.com/andybalholm/brotli v1.1.1 // indirect
+	github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
+	github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
+	github.com/aymerick/douceur v0.2.0 // indirect
+	github.com/bodgit/plumbing v1.3.0 // indirect
+	github.com/bodgit/sevenzip v1.6.0 // indirect
+	github.com/bodgit/windows v1.0.1 // indirect
+	github.com/charmbracelet/glamour v0.8.0 // indirect
+	github.com/charmbracelet/lipgloss v0.13.0 // indirect
+	github.com/charmbracelet/x/ansi v0.3.2 // indirect
+	github.com/cheggaaa/pb/v3 v3.1.4 // indirect
+	github.com/cloudflare/circl v1.6.1 // indirect
+	github.com/cnf/structhash v0.0.0-20201127153200-e1b16c1ebc08 // indirect
+	github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
+	github.com/dimchansky/utfbom v1.1.1 // indirect
+	github.com/dlclark/regexp2 v1.11.5 // indirect
+	github.com/docker/go-units v0.5.0 // indirect
+	github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect
+	github.com/fatih/color v1.15.0 // indirect
+	github.com/gaissmai/bart v0.26.0 // indirect

Undocumented dependency downgrades: Verify these versions are intentional and compatible.

This commit updates golang.org/x modules to newer versions but simultaneously downgrades 7 projectdiscovery/* packages without documentation:

  • cdncheck: v1.2.13 → v1.1.36
  • gologger: v1.1.62 → v1.1.56
  • hmap: v0.0.98 → v0.0.90
  • mapcidr: v1.1.97 → v1.1.34
  • ratelimit: v0.0.82 → v0.0.81
  • retryabledns: v1.0.111 → v1.0.102
  • utils: v0.7.3 → v0.4.20

The commit message only mentions golang.org/x updates and does not explain these downgrades. They appear to be unintentional side effects from Go's dependency resolver. Confirm that these downgraded versions are:

  1. Intentional, with documented rationale
  2. API-compatible with code that imports utils subpackages (fileutil, iputil, mapsutil, sliceutil), calls retryabledns.CheckInternalIPs, and unmarshals retryabledns.DNSData
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` around lines 12 - 24, The go.mod changes show unintended downgrades
of several projectdiscovery/* modules; verify whether these version changes are
intentional and either pin the intended versions or document the rationale:
inspect and update go.mod to the correct versions for
github.com/projectdiscovery/{cdncheck,gologger,hmap,mapcidr,ratelimit,retryabledns,utils}
(or add a clear commit message/CHANGELOG entry explaining the downgrade), run
`go get`/`go mod tidy` to lock them, then run full tests and static checks to
confirm API compatibility with code that imports utils subpackages (fileutil,
iputil, mapsutil, sliceutil) and with retryabledns.CheckInternalIPs and the
retryabledns.DNSData unmarshalling; if incompatibilities are found, either
restore newer versions or adapt call sites accordingly and document the
decision.

github.com/projectdiscovery/hmap v0.0.90
github.com/projectdiscovery/mapcidr v1.1.34
github.com/projectdiscovery/ratelimit v0.0.81
github.com/projectdiscovery/retryabledns v1.0.102
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check retryabledns Options struct and NewWithOptions in v1.0.102

echo "=== Cloning retryabledns v1.0.102 ==="
git clone --depth 1 --branch v1.0.102 https://github.com/projectdiscovery/retryabledns /tmp/retryabledns-v1.0.102 2>/dev/null

if [ -d /tmp/retryabledns-v1.0.102 ]; then
  echo ""
  echo "Checking Options struct fields:"
  rg -A 20 'type Options struct' /tmp/retryabledns-v1.0.102
  
  echo ""
  echo "Checking NewWithOptions function signature:"
  rg -B 2 -A 5 'func NewWithOptions' /tmp/retryabledns-v1.0.102
  
  rm -rf /tmp/retryabledns-v1.0.102
fi

Repository: projectdiscovery/dnsx

Length of output: 4247


Investigate why retryabledns was downgraded from v1.0.111 to v1.0.102.

The downgrade spans 9 patch versions, which could revert bug fixes. API compatibility has been confirmed—v1.0.102 includes all required Options struct fields (BaseResolvers, MaxRetries, Hostsfile, Proxy, Timeout) and the NewWithOptions() function signature. However, the downgrade itself is unusual and suggests either a regression in v1.0.103+ or a workaround. Clarify the reason for this change to avoid introducing unforeseen issues or technical debt.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` at line 20, Review the commit or dependency changes that replaced
github.com/projectdiscovery/retryabledns v1.0.111 with v1.0.102: check the
go.sum/history/replace directives, module upgrades in nearby commits, and
CI/build logs for errors; verify differences between v1.0.111 and v1.0.102 by
inspecting the upstream changelog/commit history for retryabledns and confirm
any behavioral/regression reasons for pinning, focusing on the Options struct
and NewWithOptions() API, and then either restore the newer version (v1.0.111+)
if safe or add a concise comment/PR note explaining the explicit downgrade and
the rationale (including any observed bug/regression) so future reviewers
understand why v1.0.102 was chosen.

github.com/ulikunitz/xz v0.5.15 // indirect
github.com/weppos/publicsuffix-go v0.40.3-0.20250408071509-6074bbe7fd39 // indirect
github.com/ulikunitz/xz v0.5.12 // indirect
github.com/weppos/publicsuffix-go v0.30.1 // indirect
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Inconsistent: Downgrading publicsuffix-go while adding publicsuffix-based feature.

This PR enhances extractDomain to use eTLD+1 resolution via golang.org/x/net/publicsuffix (line 24), yet downgrades the indirect publicsuffix-go dependency from v0.40.x to v0.30.1. While publicsuffix-go is indirect, downgrading a domain-suffix library during a feature that relies on public suffix logic is inconsistent and warrants explanation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@go.mod` at line 111, The go.mod downgrade of
github.com/weppos/publicsuffix-go to v0.30.1 is inconsistent with the new
extractDomain change that relies on publicsuffix logic; update the go.mod to a
current compatible version (e.g. v0.40.x) or remove the explicit older indirect
requirement so the module graph resolves the newer publicsuffix implementation,
then run go mod tidy to refresh sums; ensure extractDomain references the
golang.org/x/net/publicsuffix behavior you expect after the dependency change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support auto wildcard detection similar to PureDNS

1 participant