Skip to content

Make the TUI wordlist optional: an empty field scans with the bundled list - #291

Open
bfs2021 wants to merge 1 commit into
TMHSDigital:mainfrom
bfs2021:fix/tui-wordlist-default
Open

bfs2021 wants to merge 1 commit into
TMHSDigital:mainfrom
bfs2021:fix/tui-wordlist-default

Conversation

@bfs2021

@bfs2021 bfs2021 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Problem

Fixes #288. The TUI form pre-fills examples/sample_wordlist.txt and rejects an empty Wordlist field, but that path only exists inside a checkout: subenum -tui from go install, a release archive or the Docker image fails on the first ctrl+r with cannot read wordlist: open examples/sample_wordlist.txt. The command line has no such requirement — a missing -w scans with the bundled top-5000 list — so the TUI could not reach the default list the CLI uses.

Root cause

formFields[fieldWordlist] carried def: "examples/sample_wordlist.txt" and validate returned "Wordlist path is required" for an empty value, while loadWordlistCmd only ever called wordlist.LoadWordlist(path, domain), which opens a file. Nothing in the TUI could produce the bundled list, so an installed binary had no way to scan without a wordlist file of its own.

Fix

  • The Wordlist field is optional: validate keeps the stdin rejection (- would read the stdin Bubble Tea owns) and drops the empty rejection.
  • loadWordlist (new, in model.go) reads the file named on the form, or, when the field is empty, walks data.Subdomains5k through wordlist.NewPreparer/EachLine — the same path prepareWordlist uses for a missing -w, so normalization, dedupe and the per-domain length clamp match the CLI.
  • beginScan adds the CLI's notice (using the bundled top-5000 list), so the scan view says which list ran.
  • The field loses the repo-relative default and its required marker; the placeholder is empty = bundled top-5000 list. README's TUI section and the CHANGELOG say the wordlist is optional.

Testing

  • New TestEmptyWordlistUsesBundledList starts a scan from an empty Wordlist field in simulation mode and asserts the loaded entries come from the bundled list and the scan view names it. Before the fix it fails with the issue's own symptom: form error: Wordlist path is required.
  • TestNewFormModelDefaults and TestFormViewRows pin the empty default and the new row/placeholder.
  • go test ./... — all packages pass (root 10.9s, internal/tui, internal/scan, pkg/subenum included).
  • gofmt -l internal/tui — clean.
  • golangci-lint run — could not run locally: this machine's golangci-lint was built against an older Go (export-data version 5 vs 2), so it refuses to typecheck go1.27 packages. Lint is left to CI.
  • Not covered: an interactive render of the form inside an installed binary; the field value and the scan notice are asserted in the tests above.

The TUI form pre-filled examples/sample_wordlist.txt and rejected an empty
field, so a binary run outside a checkout failed on ctrl+r with "cannot read
wordlist: open examples/sample_wordlist.txt", and the bundled top-5000 list
the command line falls back to was unreachable from the TUI.

The Wordlist field is now optional: validate no longer rejects an empty
value, and loadWordlist reads the bundled list through the same
Preparer/EachLine path prepareWordlist uses for a missing -w. beginScan adds
the CLI's notice, so the scan view names the list that ran. The field loses
its repo-relative default and its required marker, with a placeholder that
says what empty means.

Tests: TestEmptyWordlistUsesBundledList starts a scan from an empty field and
checks the loaded entries and the notice (it fails before the fix with the
issue's "Wordlist path is required"); TestNewFormModelDefaults and
TestFormViewRows pin the empty default. go test ./... passes, gofmt clean.

Refs TMHSDigital#288
@bfs2021
bfs2021 force-pushed the fix/tui-wordlist-default branch from efc5920 to 73aeca2 Compare November 15, 2026 01:36
@bfs2021

bfs2021 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (d0c56f0) to clear the conflict with the new TUI fields from #274/#262; the empty-wordlist behaviour and its row pin are unchanged, go test ./... is green again.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI requires a wordlist file and defaults to a path that only exists in a repo checkout

1 participant