Resumed -follow-records hits come back with source wordlist

未关闭
#441 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@bfs2021 已经在做这个了。

开始于 2026年11月21日。

  • #442 来自 @bfs2021 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
go
领域
backend, cli

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Go
星标
1
派生
1
平均合并
8 小时 3 分钟
30 天内合并 PR
31

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/subenum 的其他 Issue

查看 TMHSDigital/subenum 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。