Resumed -follow-records hits come back with source wordlist

Aperta
#441 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@bfs2021 ci sta già lavorando.

Dal 21/11/2026.

  • #442 di @bfs2021 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
go
Ambito
backend, cli

Direzione di ricerca

Read internal/cli/session.go around restoreTarget and emitFrom, then review the resume tests in internal/cli. Add a hermetic resume test for a -follow-records hit and run go test ./internal/cli. Done means resumed results report records and records_found matches an uninterrupted run; pull request #442 is already open against this issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: cli bug good first issue severity: low

Summary

When a run with -follow-records is resumed, results that the record-follow step found come back with sources: ["wordlist"] instead of ["records"]. The results file, -stats (records_found), and the source breakdown then disagree with the uninterrupted run.

Where

  • internal/cli/session.go:908 (restoreTarget)
  • internal/cli/session.go:653 (emitFrom)
  • internal/candidates/candidates.go:126 (SourcesOf)

Details

restoreTarget re-emits each saved result as scan.Event{Result: r.Result}. Only -ptr hits get their saved sources back (ptrHit, added in #436). For everything else emitFrom works out the sources again:

case ev.Followed:
	res.Sources = candidates.FromRecords
case !permutation:
	res.Sources = s.cands.SourcesOf(res.Subdomain)

The restored event never has Followed set, and a record-follow target is not in the candidate set, so SourcesOf falls back to FromWordlist. s.foundBy then counts it under wordlist, not records.

Impact

For resumed -follow-records scans, results files and -stats report record-follow hits as wordlist hits. -diff against an uninterrupted run's file can also differ in sources. Low severity: the names themselves are correct.

Steps to reproduce

  1. Run a lab scan with -follow-records and -resume state.json against a zone where a CNAME, MX or NS target is a new in-scope name.
  2. Interrupt it after that name is found, then resume.
  3. In the JSON output, the followed name has "sources": ["wordlist"].

Suggested fix

In restoreTarget, pass the saved r.Sources to emitFrom whenever they are present, as the -ptr branch already does, instead of recomputing them. Add a resume test that covers a -follow-records hit.

Acceptance criteria

  • A resumed run reports record-follow hits with source records, and records_found matches the uninterrupted run
  • A test covers it

Getting started

  • Relevant files: internal/cli/session.go, internal/cli/resume.go, the existing resume tests in internal/cli
  • How to run tests: go test ./internal/cli (tests must stay hermetic: use -simulate, a lab zone or internal/dnstest)
  • Related: #432, #436

Filed by repo-audit/fix-issues at 2fb80e4. Severity: low. Effort: S. audit-key: bug|internal/cli/session.go|restoreTarget-sources

Lingua principale
Go
Stelle
1
Fork
1
Merge medio
8h 3m
PR unite (30g)
31

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/subenum

Tutte le issue di TMHSDigital/subenum

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.