Skip to content

-max-queries is a per-pass cap on the CLI but a run total in MCP #478

Backlog

Description

@TMHSDigital

Summary

On the command line, -max-queries is handed in full to every pass (main, -permute, the PTR lookups, the PTR name scan, the NSEC walk). The MCP server's permutation pass instead gets what the scan left. The same option means a per-pass cap in one front end and a run total in the other, and the README describes it both ways.

Where

  • internal/cli/session.go:835 (main pass), internal/cli/permute.go:124, internal/cli/ptr.go:104, :224, internal/cli/axfr.go:83 (each gets s.f.maxQueries)
  • internal/cli/mcp_report.go:189 (budget := cfg.MaxQueries - int(report.stats.Total()))
  • internal/cli/cli.go:263 (help: "Max candidate names to test")
  • README.md:437 ("-max-queries covers the whole scan") vs README.md:547 (the permutation pass applies -max-queries itself)

Impact

-max-queries 1000 -permute -ptr -nsec-walk can test about 4000 names plus 1000 PTR queries. Users who set it as a politeness or cost cap send several times what they expected. Behavior learned in MCP is wrong on the CLI, and Action users passing -max-queries in args get the per-pass meaning.

Steps to reproduce

subenum -simulate -max-queries 50 -permute -w <100 entries> -stats s.json example.com: processed is 50 for the main pass, and up to 50 more appear under permutation.processed.

Suggested fix

Pick one meaning. Either make the CLI budget run-wide per target (pass max - spent from pass to pass, as MCP and resume's remainingBudget already do), or keep per-pass and say so in the help text, README and docs/cli.md, and align MCP. Add a test asserting total processed across passes under the chosen rule.

Getting started

  • Relevant files: internal/cli/session.go, internal/cli/permute.go, internal/cli/ptr.go, internal/cli/mcp_report.go

Filed by repo-audit/full-audit at a45b999. Severity: low. Effort: M. audit-key: bug|internal/cli/session.go|maxQueries

Activity

  1. added
    bug
    area: cli
    severity: low
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: clibugseverity: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions