Repository navigation
Backlog
Labels
severity: mediumEdge-case bugs, degraded behavior, meaningful maintenance costtech-debtRefactoring and maintainability
Description
Summary
"Ask the sources and the zone, gate on -exclude, add to a candidates.Set in a fixed order, take the lists, build permutations" is written five times: CLI, TUI, library, MCP and dry run. The copies have already drifted.
Where
- CLI
scanOneTarget:internal/cli/session.go:789-835(sources, AXFR, NSEC, SRV,cands.Lists()) - TUI
loadWordlistCmd:internal/tui/model.go:233-247(sources, AXFR, NSEC,msg.cands.Entries()) - Library:
pkg/subenum/subenum.go:538-546,pkg/subenum/sources.go:70 - MCP
scanTool:internal/cli/mcp_tools.go:316-321(wraps the transfer as a fake source) - Dry run:
internal/cli/dryrun.go:110-134(recounts by hand) - The axfr Options/WalkOptions wiring and the "scanning X without a zone transfer or an NSEC walk" warning are built in four places:
internal/cli/axfr.go:61-108,internal/tui/passes.go:117-156,pkg/subenum/zone.go:84-110,internal/cli/mcp_tools.go:349.
Details
Drift found:
- The TUI takes
cands.Entries(), the whole-wordlist copy that Smaller performance costs: cap walk, wordlist copies, serial AXFR, -dL, MCP queue #365 removed from the CLI and library. - The TUI's permutation pass drops
capped(perms, tooLong, _ := candidates.Permutations(...),internal/tui/passes.go:98), so a TUI user is never told the pass stopped atMaxPermutations, which the CLI prints (internal/cli/permute.go:113). - The MCP transfer port default is a literal
"53"(internal/cli/mcp_tools.go:346), while the library uses the test-settablezonePort.
Impact
Every new candidate source (-srv #419, -nsec-walk #437 and PTR #436 were the latest) has to be threaded through each front end with its own ordering, scope gate and message. An ordering mistake breaks resume, which indexes the joined list by position. Fixes land in one front end and not the others.
Suggested fix
Each step leaves the code working:
- Tests first: run one lab scenario (sources stubbed with an httptest server, plus AXFR and NSEC) through the CLI, the TUI's
loadWordlistCmdandsubenum.Run, and assert the same candidate order and per-source counts. - Add
Assemble(ctx, Plan) (Set, []Note)ininternal/candidates(or a newinternal/prescan). It owns the order, the scope gate and the info/warning lines. - Move the zone wiring into one helper that builds Options, WalkOptions and the warning text. Switch the TUI, CLI, library and MCP to it, one commit each.
- Switch the TUI to
AssembleandLists(), and show the capped notice. - Switch the CLI, keeping resume replay of held lines.
- Have dry run count from the same Plan.
Filed by repo-audit/full-audit at a45b999. Severity: medium. Effort: M. audit-key: tech-debt|internal/cli/session.go|candidate assembly
Metadata
Metadata
Assignees
Labels
severity: mediumEdge-case bugs, degraded behavior, meaningful maintenance costtech-debtRefactoring and maintainability
Activity