Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xSteph Pentest ai FindingDeduplicator fingerprint

From Leeroopedia
Knowledge Sources
Domains Security_Testing, Data_Management
Last Updated 2026-10-23 12:00 GMT

Overview

Concrete deduplication engine that fingerprints findings using composite SHA-256 hashes of normalized target, category, and sorted title tokens, with fuzzy matching and CWE/OWASP enrichment.

Description

The FindingDeduplicator class provides three capabilities:

  • fingerprint: SHA-256 hash of `normalize(target)|normalize(category)|sorted_title_tokens` — first 16 hex chars. Normalization: lowercase, strip scheme/port/path for target; lowercase for category; lowercase + strip non-alphanumeric + sort unique tokens for title.
  • is_duplicate: Checks if a fingerprint has been seen before; returns (bool, existing_id)
  • check_fuzzy_duplicate: Levenshtein ratio > 0.85 catches near-duplicates with slightly different titles from different tools
  • enrich: Maps finding title+category to CWE ID and OWASP category using regex patterns, and attaches the fingerprint

Usage

Import this when you need to:

  • Deduplicate findings across multiple tools
  • Compute stable fingerprints for finding comparison
  • Enrich findings with CWE/OWASP mappings

Code Reference

Source Location

Signature

class FindingDeduplicator:
    def __init__(self) -> None:

    def fingerprint(self, finding: dict[str, Any]) -> str:
        """SHA-256 of normalized target|category|sorted_title_tokens (16 chars)."""

    def is_duplicate(self, finding: dict[str, Any]) -> tuple[bool, str]:
        """Check if fingerprint seen. Returns (is_dup, existing_id)."""

    def check_fuzzy_duplicate(
        self, finding: dict[str, Any], existing_findings: list[dict[str, Any]]
    ) -> str | None:
        """Levenshtein ratio > 0.85 match. Returns existing_id or None."""

    def enrich(self, finding: dict[str, Any]) -> dict[str, Any]:
        """Add cwe_id, owasp_category, fingerprint to finding."""

Import

from engine.dedup import FindingDeduplicator

I/O Contract

Inputs

Name Type Required Description
finding dict[str, Any] Yes Finding dict with target, category, title
existing_findings list[dict] Findings to compare against

Outputs

Name Type Description
fingerprint returns str 16-char SHA-256 hex
is_duplicate returns tuple[bool, str] (is_dup, existing_id)
check_fuzzy_duplicate returns None existing_id or None
enrich returns Finding with cwe_id, owasp_category, fingerprint added

Usage Examples

Deduplicating Findings

from engine.dedup import FindingDeduplicator

dedup = FindingDeduplicator()
for finding in all_findings:
    is_dup, existing_id = dedup.is_duplicate(finding)
    if is_dup:
        print(f"Duplicate of {existing_id}: {finding['title']}")
        continue
    # Enrich with CWE/OWASP and store
    enriched = dedup.enrich(finding)
    await db.add_finding(enriched)

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment