Repository navigation
Done
Labels
area: cliFlags, exit codes, main.gogood first issueGood for newcomersseverity: mediumEdge-case bugs, degraded behavior, meaningful maintenance costtestingTest coverage and test infrastructure
Description
Summary
The fix for GHSA-3q36-5f35-4779 (write the default resume state without following a symlink) has no CLI regression test: every CLI test passes an explicit -state, so the default-path branch never runs. WriteFileNoFollow itself is tested only in a unix-tagged file, so the Windows and macOS CI jobs never run it.
Where
internal/cli/resume.go:625(if path == defaultStateFile { return output.WriteFileNoFollow(...) }: count 0)internal/output/file_unix_test.go:77(TestWriteFileNoFollowReplacesSymlink, build-tagged)internal/output/file.go:79internal/cli/resume.go:434-448(input file missing or unreadable at resume),:547,:610("saving resume state" failures)
Impact
A refactor that changes the default-path comparison, for example normalizing the state path to an absolute path so that path == defaultStateFile is false, reopens the advisory with every test green. Changing line 625 to if false { leaves go test ./... passing.
Suggested fix
- A CLI test (unix build tag) that chdirs to a temp dir, makes
subenum-resume.jsona symlink to a victim file, runs an interrupted-simulatescan without-state, and asserts the victim is unchanged and the link was replaced by a regular file. - The same with an explicit
-state link.json: the link is followed (documented behavior), pinning both sides. - Resume after deleting the wordlist named in the state: clear error, no scan.
-
-statein a read-only or missing directory: "saving resume state" error, non-zero exit, previous state untouched.
Getting started
- Relevant files:
internal/cli/resume.go,internal/cli/resume_test.go,internal/output/file.go - How to run tests:
go test ./internal/cli -run Resume(run the unix-tagged parts under WSL or Linux)
Filed by repo-audit/full-audit at a45b999. Severity: medium. Effort: S. audit-key: testing|internal/cli/resume.go|writeResumeState
Metadata
Metadata
Assignees
Labels
area: cliFlags, exit codes, main.gogood first issueGood for newcomersseverity: mediumEdge-case bugs, degraded behavior, meaningful maintenance costtestingTest coverage and test infrastructure
Activity
TMHSDigital commentedon Nov 29, 2026
Fixed in cb79aa3: new internal/cli/resume_nofollow_test.go. TestE2EDefaultStateReplacesSymlink runs an expired -simulate scan without -state (SUBENUM_STATE unset) in a temp dir whose subenum-resume.json is a symlink, and checks that the link target is untouched and the link is replaced by a regular file holding the state; with -state link.json the link is followed. It skips only when symlinks can't be created, so it runs on all three OS jobs (it ran here on Windows). TestE2EResumeStateFailures covers resuming after the wordlist was deleted (non-zero exit, error names the file, no scan, state untouched) and -state in a missing directory ("saving resume state" error, nothing created). Mutation check: changing the default-path branch to false fails the test. Gate (gofmt, vet, golangci-lint v2.15.0, full suite) passes.