A scanner that fails but prints parseable JSON is reported as a clean run

Đang mở
#180 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

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
65/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
security, testing-qa

Hướng nghiên cứu

Read internal/seed/external.go around Run and semgrepReport, then inspect internal/seed/subprocess_test.go and the recorded fixture under internal/seed/testdata/real/. Add the missing valid-empty-report/non-zero-exit case and cover Semgrep error entries and its findings-present exit code. Run make test-short (or .\make.ps1 test-short on Windows) and make lint; done means all acceptance criteria pass.

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

Mô tả

help wanted reliability severity: medium

Summary

The external scanner adapter looks at the exit status only when the report cannot be decoded. A scanner that exits with a fatal error while still printing an empty, valid report is recorded as available with zero leads and no error.

Where

  • internal/seed/external.go:382-392 (Run: runErr dropped when the report decodes)
  • internal/seed/external.go:628-649 (semgrepReport decodes only results)
  • internal/seed/subprocess_test.go:88 (no case for non-zero exit with a valid empty report)

Details

The comment says scanners exit non-zero when they find something, so the exit status is only consulted when the report cannot be read. When the report decodes, the run error is dropped whatever the exit code. Semgrep's top-level errors array (present in the recorded fixture under internal/seed/testdata/real/) is not read.

Assumption (not run during the audit): on a fatal error such as a rule pack that cannot be downloaded or a rule file that does not parse, semgrep prints a report with errors and empty results and exits with a failure code.

Impact

Spackle records semgrep: available, leads 0 with no error, which reads exactly like a scan that found nothing. Per-file scanner errors (timeouts, parse failures) are lost the same way. This contradicts the adapter's own stated rule that dropping results is reported, never silent. Any adapter whose tool exits non-zero for a real failure while writing an empty report has the same hole.

Suggested fix

Give each adapter the exit codes that mean "ran to the end" and return an error, with the scrubbed stderr, for any other code even when stdout decodes. Decode semgrep's errors and count them in the parse statistics so partial failures appear in the seeder note.

Acceptance criteria

  • Each adapter declares its success exit codes
  • Table case: valid empty report with a failure exit code returns an error
  • Semgrep errors entries appear in the seeder note
  • A scanner that exits with its "findings present" code still succeeds

Related: #95, #39

Getting started

  • Relevant files: internal/seed/external.go, internal/seed/subprocess_test.go
  • How to run tests: make test-short (Unix) or .\make.ps1 test-short (Windows PowerShell); make lint before you call it done
  • Related docs: CONTRIBUTING.md, docs/ARCHITECTURE.md

Filed by repo-audit/full-audit at 50e92ec. Severity: medium. Effort: M. audit-key: reliability|internal/seed/external.go|external.Run-exit-status

Ngôn ngữ chính
Go
Star
0
Fork
1
Merge trung bình
8 giờ 14 phút
Pull request đã merge (30 ngày)
3

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/Spackle

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

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.