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

Đang mở Phù hợp với người mới
#495 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@nova-loop đang làm issue này rồi.

Từ ngày 3/12/2026.

  • #496 của @nova-loop — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
84/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
cli, networking

Hướng nghiên cứu

Đọc internal/cli/diff.go để theo dõi ngân sách tên đã bị xóa, sau đó kiểm tra internal/output/summary.go, internal/cli/summary.go và internal/report/ptr.go để tìm nơi ghi lại số lượt quét PTR. Thêm số lượt PTR vào phép tính ngân sách cho từng mục tiêu và kiểm thử một lần chạy có đủ cả ba lượt. Chạy go test ./internal/cli/ và xác nhận việc kiểm tra tên đã bị xóa vẫn nằm trong giới hạn -max-queries.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Go
Star
1
Fork
1
Merge trung bình
10 giờ
Pull request đã merge (30 ngày)
26

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TMHSDigital/subenum

Tất cả issue của TMHSDigital/subenum

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.