File size: 502 Bytes
6c3043e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Severity weights and category metadata for aggregation."""

SEVERITY_WEIGHT: dict[str, float] = {
    "critical": 1.0,
    "high": 0.75,
    "medium": 0.5,
    "low": 0.25,
}

DEFAULT_CATEGORIES: tuple[str, ...] = (
    "prompt_injection",
    "tool_output_injection",
    "retrieval_poisoning",
    "memory_poisoning",
    "secret_exfiltration",
    "unauthorized_action",
)


def severity_weight(severity: str) -> float:
    return SEVERITY_WEIGHT.get(severity.lower(), SEVERITY_WEIGHT["medium"])