-diff's removed-name budget ignores the names the -ptr pass tested

オープン 初心者向け
#495 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@nova-loop がすでに取り組んでいます。

2026年12月3日 から。

  • #496 @nova-loop による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go
領域
cli, networking

調査の方向性

internal/cli/diff.goを読んで削除された名前の予算を追跡し、次にinternal/output/summary.go、internal/cli/summary.go、internal/report/ptr.goを調べて、PTRスキャン数が記録される箇所を見つけてください。PTR数をターゲットごとの予算計算に加え、3つすべてのパスを実行するケースをテストで網羅してください。go test ./internal/cli/を実行し、削除された名前のチェックが-max-queries以内に収まることを確認してください。

索引モデルが issue の本文から書いたものです。

説明

area: cli bug good first issue severity: low

Summary

-diff's check of removed names spends what is left of -max-queries per target. It subtracts the names the main pass and the -permute pass tested, but not the names the -ptr pass tested, because the report has no count of them. A run with -ptr can therefore test more names than -max-queries allows.

Where

  • internal/cli/diff.go (the budget: left -= t.Processed, and t.Permutation.Processed)
  • internal/output/summary.go (TargetSummary: PTRNames counts the names to be tested, not the ones that were)

Details

left := int64(s.f.maxQueries) * int64(len(summary.Targets))
for _, t := range summary.Targets {
	left -= t.Processed
	if t.Permutation != nil {
		left -= t.Permutation.Processed
	}
}

Since #478, -max-queries is one budget for a target's passes. The PTR pass's scan is one of them, and its tested names are missing here.

Impact

With -diff -ptr -max-queries N, the removed-name check can look up as many names again as the PTR pass tested, on top of the budget. The overshoot is small (PTR passes test few names), and affects only runs where the previous results had names this run did not find.

Steps to reproduce

  1. Run a scan with -ptr -max-queries 3 whose main pass tests 1 name and whose PTR pass tests 2, with -diff against a previous run that had two more names.
  2. The removed-name check looks up both, for 5 names tested under a budget of 3.

Suggested fix

Record how many names the PTR pass's scan tested (a ptr_processed field next to ptr_names, or the pass's Processed kept on the session) and subtract it in the -diff budget. Add a test with all three passes.

Acceptance criteria

  • The removed-name check's budget is -max-queries per target less the names every pass tested.
  • A test covers a run with -ptr.

Getting started

  • Relevant files: internal/cli/diff.go, internal/cli/summary.go, internal/report/ptr.go
  • How to run tests: go test ./internal/cli/
  • Related: #478, #276

Filed by repo-audit/fix-issues at b8afd4d. Severity: low. Effort: S. audit-key: bug|internal/cli/diff.go|removed-name budget

主要言語
Go
スター
1
フォーク
1
平均マージ
10時間
マージ済み PR(30日)
26

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TMHSDigital/subenum のほかの issue

TMHSDigital/subenum の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。