Repository navigation
Description
Summary
Three smaller defects on the resume path, grouped because they share the area: a resumed recursive scan does not re-expand parents that came from multi-label entries; a resumed -dL run drops the permutation, source and AXFR details of targets that finished before the interrupt; and -retry-inconclusive never retries names that failed before the interrupt.
Resume derives a parent's depth from its label count, so multi-label entries are not re-expanded
Where
internal/scan/dispatcher.go:75-84internal/scan/dispatcher.go:183-185internal/wordlist/reader.go:47-51internal/passive/passive.go:94-105
Details
In a live scan depth is the recursion level: every root candidate is depth 1 whatever its label count (dispatcher.go:183 if e.depth == 1 { root = e.next - 1 }, expansion {parent: cfg.Domain, depth: 1} at :66), and wordlist entries may hold several labels ("Multi-label prefixes such as "dev.api" are kept", reader.go:50; -sources ct merges names such as dev.api into the entries, passive.go:94-105). On resume the depth is recomputed from dots: if depth := strings.Count(p, ".") + 1 - rootLabels; depth >= 1 && depth < maxDepth (dispatcher.go:81). A name found at level 1 through a two-label entry counts as depth 2, so with -depth 2 it fails depth < maxDepth and is never expanded, and with a larger depth its subtree is cut one level short.
Impact
After an interrupt, a resumed -recursive scan silently skips the children of found names that came from multi-label entries (common with -sources ct), although an uninterrupted run tests them. The resumed run still reports itself complete.
Steps to reproduce
Confirmed with a scratch test (not in the repository) (go test -run TestResumeMultiLabelParentDepth). Zone: dev.api.example.com A, x.dev.api.example.com A. Entries dev.api, x; Recursive, Depth 2. Fresh run: [dev.api.example.com x.dev.api.example.com]. With ResumeFrom 2 and ResumeParents [dev.api.example.com]: [].
Suggested fix
Carry the recursion level instead of inferring it: store each result's depth in the resume state and pass it with the parent (for example ResumeParents []struct{Name string; Depth int}), or, when only names are available, find the level by matching the name's prefix against Entries and already-known parents.
Resumed -dL run drops the permutation, source and AXFR details of targets finished before the interrupt
Where
main_session.go:636-652main_session.go:657-666main_summary.go:37-50main_resume.go:367-371
Details
For a target the state marks done, scanOneTarget stores s.results[i] = targetResult{done: true, final: mainSaved.event()} and returns (main_session.go:659-665). permutation, sources and axfr stay zero, although sourceInfo and axfrInfo were just rebuilt a few lines above (636-652) and the state holds the pass in saved.Permute. targetSummary reads exactly those fields (main_summary.go:37-50), so the final report of the resumed run has no permutation, sources, ct_names, axfr_allowed, axfr_names or zone_denial for that target. If the resumed run is interrupted again, saveResumeState writes the target back with Sources: savedSources(nil) and AXFRDone: false (main_resume.go:367-371), so a third run fetches the passive sources and attempts the zone transfer again for a target that is already finished (the calls at 636 and 647 run before the saved.Done check).
Impact
The -stats file and jsonl summary of a resumed multi-target run under-report the finished targets: an allowed zone transfer (a finding the report exists to carry) and the -permute pass disappear from them. After a second interrupt, finished targets cause needless HTTPS requests and AXFR attempts.
Steps to reproduce
Reproduced with the simulation only (WSL, a local script): subenum -simulate -seed 7 -hit-rate 50 -w words.txt -dL targets.txt -permute -rate 60 -t 4 -stats s1.json -state st.json with two targets, SIGINT after 7 s (a.example done, b.example in its permutation pass). s1.json then has permutation: {seeds 3, candidates 271, found 119, verdict complete} for a.example. After subenum -resume st.json (exit 0) the rewritten s1.json has no permutation object for a.example, only for b.example.
Suggested fix
In the saved.Done branch fill the result from the state: permutation from saved.Permute and the restored permutation hits, sources: sourceInfo, axfr: axfrInfo. Move the saved.Done check (or a guard on it) before passiveNames and zoneTransfer so finished targets never trigger new lookups when the state lacks their saved names.
-retry-inconclusive never retries names that failed before an interrupt
Where
internal/scan/runner.go:639-641internal/scan/runner.go:956-959main.go:676-678main_resume.go:308main_session.go:714-729
Details
The retry pass does not run after an interrupt: if ctx.Err() != nil || s.stats.aborted.Load() || s.cfg.pastDeadline() { return } (runner.go:956-959). The names stay in Stats.Inconclusive, which is saved in the resume state. On resume, scanOptions sets RetryInconclusive: f.retryIncon with the comment "The retry pass belongs to the scan, so a resumed scan runs it too" (main.go:676-678), but the resumed scan starts with an empty pending list and receives only ResumeFrom and ResumeParents; the saved names are merely appended to the final list by mergeStats (a.Inconclusive = append(append([]string(nil), a.Inconclusive...), b.Inconclusive...), main_resume.go:308). So the retry pass of the resumed run covers only names that failed after the resume.
Impact
A run with -retry-inconclusive that is interrupted and resumed leaves every pre-interrupt timeout, refusal and failure unretried: the names end up in the -inconclusive file and lower the verdict, although the flag promises that every such name is looked up once more. The user has to rescan them by hand.
Steps to reproduce
subenum -retry-inconclusive -w words.txt -dns-server <a resolver that drops some queries> <domain>, Ctrl+C mid-scan, subenum -resume subenum-resume.json: the report's retried counts only post-resume names, and the names listed under Inconclusive in the state file are in the final -inconclusive output without having been retried. Not run (needs a failing resolver); established by reading the path.
Suggested fix
Pass the saved pass's Stats.Inconclusive into the resumed scan (a ResumePending []string option that seeds scanState.pending with their saved outcome class, or simply as extra retry candidates) so retryPending covers them, and drop them from the merged list when the retry settles them.
Acceptance criteria
- A resumed recursive scan expands parents found through multi-label entries exactly as an uninterrupted run does
- The report of a resumed
-dLrun keeps permutation, source and AXFR details of finished targets, and finished targets trigger no new lookups - Names that were inconclusive before the interrupt are retried by the resumed run's retry pass
- Each item has a regression test
Getting started
- Relevant files:
internal/scan/dispatcher.go,internal/wordlist/reader.go,internal/passive/passive.go,main_session.go - How to run tests:
make test(orgo test ./...). Tests must stay hermetic: use-simulate,-simulate-zoneor the local DNS test server, never a live domain. - Related docs:
docs/DEVELOPER_GUIDE.md,docs/ARCHITECTURE.md
Filed by repo-audit/full-audit at d0c56f0. Severity: low. Effort: M. audit-key: bug|internal/scan/dispatcher.go|newDispatcher.depth
Activity
Fix two resume edge cases: parent depth and finished targets (#315)
TMHSDigital commentedon Nov 15, 2026
Partly done in 8999003; leaving this open for the third item.
1. Multi-label parents: fixed. A resumed recursive scan now works out each saved parent's level by matching it against the wordlist entries and the other saved parents, instead of counting dots, so
dev.apifrom a multi-label entry keeps the right depth.TestResumeMultiLabelParentDepth(depth 2 and 3) failed before: the resumed run missedx.dev.apiandx.x.dev.api.2. Finished
-dLtargets: fixed. A target that had finished before the interrupt is restored with its sources, zone transfer and permutation details, its passive sources and transfer are not asked again, and a second interrupt keeps them.TestResumeFinishedTargetKeepsDetailsfailed before (no transfer data or permutation in the report, and an extra NS query).3. Names left inconclusive before the interrupt are not retried: still open. A proper fix needs the state to record each such name with its outcome class (timeout, refused or other), and the scan to accept them as pending retries. Without
-inconclusivethe names are not saved at all since #300.go test ./...andgolangci-lint runpass; the new tests pass with-race -count=5.TMHSDigital commentedon Nov 15, 2026
Item 3 fixed in 416499e: with
-retry-inconclusive, the names the stopped run's retry pass never got to are saved (with their outcome) underpendingin the state file and handed to the resumed pass's retry pass; ones that answer are reported and leave the-inconclusivelist. Verified: newTestE2EResumeRetriesEarlierInconclusive(a name times out, the run is interrupted, the name then answers) fails without the hand-over and passes 5 runs in a row;TestResumeStateKeyspins the new keys;go test -race ./...and golangci-lint v2.15.0 pass. All three items of this issue are now done.Retry names left inconclusive before a resume (TMHSDigital#315)