Skip to content

A scan stopped by -max-duration or the reliability guard cannot be continued #294

Closed

Description

@TMHSDigital

Summary

Resume state is written only after a signal, so a run that ends because its time budget ran out, or because the reliability guard aborted it, leaves nothing to continue from. Time-boxed CI scans therefore test the same first part of the wordlist on every run.

Where

  • main_session.go:780
  • main_session.go:782
  • main_resume.go:130
  • internal/scan/verdict.go:44
  • action.yml:40

Details

finish saves resume state only after a signal: if s.signalCode.Load() != 0 { saveResumeState(s) } else if s.resume != nil && !s.anyFailed { os.Remove(s.resume.path) ... } (main_session.go:780-787). A run that reaches -max-duration ends "normally" with Skipped > 0 && Expired and a degraded verdict (internal/scan/verdict.go:44-45), and a reliability abort also ends without a signal, so neither writes a state file. Yet main_resume.go:130-134 already treats -max-duration as "a budget for each invocation rather than for the scan (#190)" and exempts it from the resume settings check, which only makes sense if a budgeted run can be resumed. The Action's max-duration input (action.yml:40-47) and docs/monitoring.md:119 recommend the budget for scheduled jobs. Assumption (medium confidence on this part only): a resumed run that then hits its budget is not anyFailed, so line 782 removes its state file although candidates are still untested. Checked against #73, #107, #108, #109, #156, #190, #217, #237, #255 (all closed, none cover this) and the open list.

Impact

The users who most need continuation are the ones with a time box: a CI job with a 20 minute budget over a large wordlist tests the same first N names on every run and never reaches the rest, and never produces a complete baseline (the Action only saves a baseline on complete, action.yml:210). After a guard abort, the only recovery is a full rescan.

Suggested fix

In finish, also call saveResumeState when any target's final stats have Expired set (and, as a second step, when a target ended with a resolver abort), and print the same "continue with: subenum -resume " line. Do not remove a resumed run's state when the resumed part expired again. Keep exit code 0 for expiry. Then let the Action carry the state file in the baseline artifact so each scheduled run continues where the last stopped. Open questions: whether to write the file by default or only when -state is given explicitly (a state file appearing after a normal exit may surprise scripts); -retry-inconclusive is skipped at expiry and should run at the end of the resumed run; stdin inputs still cannot be replayed.

Acceptance criteria

  • A run that ends with candidates skipped by -max-duration writes a resume state and prints how to continue
  • A resumed run that expires again keeps its state file
  • Exit code for an expired run is unchanged
  • Documented in the -max-duration and -resume help and in docs/monitoring.md

Getting started

  • Relevant files: main_session.go, main_resume.go, internal/scan/verdict.go, action.yml
  • How to run tests: make test (or go test ./...). Tests must stay hermetic: use -simulate, -simulate-zone or 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: high. Effort: M. audit-key: enhancement|main_session.go|finish.saveResumeState

Activity

  1. added
    enhancement
    help wanted
    area: cli
    severity: high
    on Nov 15, 2026
  2. TMHSDigital commented on Nov 15, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in 274df44.

    A run that -max-duration stopped with names untested, or that the reliability guard aborted, now saves its resume state to the -state file and prints continue with: subenum -resume <file>, like an interrupted run. Exit codes are unchanged. A resumed run that runs out again saves its state again, and a scan finished by a resume reports complete with nothing skipped.

    Verified with two new end-to-end tests: TestE2EMaxDurationSavesResumeState (simulation: run, resume until finished, state removed, verdict complete) and TestE2EAbortSavesResumeState (in-process DNS server: aborted run, then a resume against the healed server tests every name). go test ./... and golangci-lint run pass.

    Not included: the GitHub Action does not carry the state file between scheduled runs (docs/monitoring.md says so), and -retry-inconclusive on a resumed run does not retry names the earlier part left inconclusive.

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: clienhancementhelp wantedseverity: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions