test : add unit tests for generate_finding_key in finding_intelligence

Aperta
#2,235 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

  • #2240 di @tmdeveloper007 — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
fastapi, python
Ambito
security, testing

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
36
Fork
234
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di utksh1/SecuScan

Tutte le issue di utksh1/SecuScan

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.