Skip to content

Default resume state no-follow write (GHSA-3q36) has no CLI regression test #469

Done

Description

@TMHSDigital

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:79
  • internal/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.json a symlink to a victim file, runs an interrupted -simulate scan 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.
  • -state in 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

Activity

  1. added
    good first issue
    area: cli
    testing
    severity: medium
    on Nov 29, 2026
  2. TMHSDigital commented on Nov 29, 2026

    @TMHSDigital
    OwnerAuthor

    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.

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: cligood first issueseverity: mediumtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions