test : add unit tests for generate_finding_key in finding_intelligence

Đang mở
#2,235 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

  • #2240 của @tmdeveloper007 — đã đóng, không merge

Đá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
35/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
fastapi, python
Lĩnh vực
security, testing

Hướng nghiên cứu

Read backend/secuscan/finding_intelligence.py to inspect generate_finding_key and the existing tests for its component functions. Then create testing/backend/unit/test_finding_intelligence_key.py and cover determinism, differing plugin_id, target, and owner_id values, missing fields, and the specified group:<16-character-hex-digest> format. The issue notes that a linked pull request exists and says the work is being handled by tmdeveloper007.

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

Mô tả

Summary of What Needs to be Done:
The backend/secuscan/finding_intelligence.py module exposes a generate_finding_key function that produces a stable deduplication key for a finding. The function is responsible for consistent identification of the same vulnerability across different scan tasks. It is currently not directly unit tested — only its component functions (_issue_signature, _guess_asset_ref, _stable_id) have isolated tests.

Changes that Need to be Made:
Create testing/backend/unit/test_finding_intelligence_key.py with tests for generate_finding_key:

  • Returns a string starting with "group:"
  • Same inputs produce the same output (deterministic)
  • Different plugin_id values produce different outputs
  • Different target values produce different outputs
  • Different owner_id values produce different outputs
  • Missing/None fields in the finding dict are handled gracefully
  • The key format matches the pattern "group:<16-char-hex-digest>"

Impact that it would Provide:

  • Directly tests the finding deduplication key generation used for deduplication across tasks
  • Documents the expected stable key format for maintainers
  • Ensures the function is deterministic and handles edge-case inputs
  • Complements existing tests for _issue_signature and _stable_id

Note: This task is being handled by tmdeveloper007 — please assign to that account when picking it up.

Ngôn ngữ chính
Python
Star
36
Fork
234
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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 utksh1/SecuScan

Tất cả issue của utksh1/SecuScan

Issue tương tự

Thêm issue về Python

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.