Skip to content

Small -max-duration budgets go to pre-scan probes; resumes make no progress #340

Closed

Description

@TMHSDigital

Summary

Each run spends its -max-duration budget on the preflight and wildcard probes before the first wordlist name, and a resumed run pays for them again, so with a low -rate and a short budget a run can test no names at all, and resuming it repeats that forever.

Where

  • internal/scan/runner.go (preflight and wildcard probes run before the dispatcher, under the same deadline)
  • internal/cli/lab_test.go (TestE2EMaxDuration)

Details

Since #294 a run stopped by -max-duration saves its state and prints continue with: subenum -resume. The deadline covers the whole run, including the probes made before any candidate is tested. With -rate 10 -max-duration 1s on lab 1, 0 of 30 words were tested ("skipped 30 additional jobs"), and each -resume starts the same probes again under a fresh 1 s budget. TestE2EMaxDuration passes with zero names tested, so nothing catches it.

Impact

A scheduled job that resumes with a small time budget loops without ever finishing the wordlist. Larger budgets are only slowed, not stuck.

Steps to reproduce

  1. subenum -rate 10 -max-duration 1s -w examples/labs/words.txt -simulate-zone examples/labs/lab1-first-scan.zone -state s.json lab.example
  2. subenum -resume s.json (repeat): the resume point does not advance.

Suggested fix

Either start the -max-duration clock after the pre-scan probes, or let a resumed run reuse the saved wildcard verdict instead of probing again (the state already records the target), and warn when the budget ran out before any candidate was tested. Make TestE2EMaxDuration require at least one tested name.

Acceptance criteria

  • A resumed run with a small budget advances its resume point
  • A run whose budget ran out before any candidate says so
  • TestE2EMaxDuration fails when no name was tested

Getting started

  • 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/fix-issues at 637a950. Severity: medium. Effort: M. audit-key: bug|internal/scan/runner.go|maxDurationPreflight

Activity

  1. added
    bug
    area: cli
    severity: medium
    on Nov 15, 2026
  2. TMHSDigital commented on Nov 15, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in 96a04d5: scan.Run moves the -max-duration deadline forward by the time the preflight and wildcard probes took (unless the budget was already spent when the target started), and the time-budget notice says when no name was tested. Verified: TestE2EMaxDuration failed before the change (0 of 30 names tested) and now requires names tested on the first run and fewer skipped on a -resume; full build, vet, golangci-lint v2.15.0 and go test ./... pass.

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: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions