Report every finding on a line in the guardrails content scan

Đang mở Phù hợp với người mới
#20,942 5 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

Chưa có ai nhận issue này.

Đá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ệ
shell
Lĩnh vực
devtools, testing

Hướng nghiên cứu

Bắt đầu trong plugins/guardrails/git-hooks/content-scan.sh và kiểm tra pipeline sort -u được cả hai lượt quét sử dụng. Sau đó đọc pre-commit-content.test.sh và pre-push-content.test.sh; thêm các trường hợp trong đó một dòng chứa GitHub PAT và đường dẫn thư mục home của Linux. Công việc hoàn tất khi cả hai phát hiện được báo cáo trong mỗi bài kiểm thử, các phát hiện trùng lặp từ hai lượt xử lý chỉ xuất hiện một lần và cả hai script kiểm thử được nêu đều chạy thành công.

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

Mô tả

Context

content_scan in plugins/guardrails/git-hooks/content-scan.sh ends with sort -u -t: -k1,1 -k2,2n. With key fields, sort -u treats two lines as duplicates when only their keys (path and line number) match. So when one line has two findings, for example a secret and a machine-specific path, or two secret patterns, only one is reported. The pre-commit and pre-push scans both use it.

This does not fail open: the line still blocks on the finding that is kept. But the author fixes one finding, commits or pushes again, and only then sees the second. Found by the review lane on #20938 (thread on content-scan.sh at the sort -u line); the same line is on main.

Proposed work

  • Sort by path and line, then remove only whole-line duplicates (for example sort -t: -k1,1 -k2,2n | uniq). Identical lines with equal keys end up next to each other, because sort compares the whole line when keys tie.
  • Add a test to pre-commit-content.test.sh and pre-push-content.test.sh: a line holding both a GitHub PAT and a Linux home path reports both findings.

Acceptance criteria

  • A line with two different findings reports both, in pre-commit and pre-push.
  • The same finding reached through two passes is still reported once.
  • pre-commit-content.test.sh and pre-push-content.test.sh pass.
Ngôn ngữ chính
Shell
Star
22
Fork
2
Merge trung bình
3 giờ 4 phút
Pull request đã merge (30 ngày)
941

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

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 melodic-software/claude-code-plugins

Tất cả issue của melodic-software/claude-code-plugins

Issue tương tự

Thêm issue về Shell/Bash

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.