feat(owasp): map probe datasets to the OWASP LLM Top 10 2026

This commit is contained in:
Alexander Myasoedov committed 2026-11-19 15:07:40 +02:00
1 parent 4bb7b67379
commit ca69c88138
4 files changed
+33 -33

No files matched your search

+14 -14
View File
@@ -10,21 +10,21 @@ handful of purpose-built local probes (data leak, hallucination, agentic,
malware) map to their own categories.
"""
# OWASP Top 10 for LLM Applications 2025 (https://genai.owasp.org/llm-top-10/).
# OWASP Top 10 for LLM Applications 2026 (https://genai.owasp.org/resource/owasp-genai-llm-top-10-2026/).
OWASP_LLM_TOP_10 = {
"LLM01": "Prompt Injection",
"LLM02": "Sensitive Information Disclosure",
"LLM03": "Supply Chain",
"LLM04": "Data and Model Poisoning",
"LLM05": "Improper Output Handling",
"LLM06": "Excessive Agency",
"LLM07": "System Prompt Leakage",
"LLM08": "Vector and Embedding Weaknesses",
"LLM09": "Misinformation",
"LLM10": "Unbounded Consumption",
"LLM03": "Excessive Agency",
"LLM04": "Supply Chain",
"LLM05": "Data and Model Poisoning",
"LLM06": "Unbounded Consumption",
"LLM07": "Misinformation",
"LLM08": "Hidden Context Exposure",
"LLM09": "Vector and Embedding Weaknesses",
"LLM10": "Improper Output Handling",
}
OWASP_PROJECT_URL = "https://genai.owasp.org/llm-top-10/"
OWASP_PROJECT_URL = "https://genai.owasp.org/resource/owasp-genai-llm-top-10-2026/"
_DEFAULT_CATEGORY = "LLM01"
@@ -32,10 +32,10 @@ _DEFAULT_CATEGORY = "LLM01"
# lowercased dataset name (or a substring of it).
_NAME_OVERRIDES = {
"dataleak": "LLM02",
"hallucination": "LLM09",
"malwaregen": "LLM05",
"agenticbackend": "LLM06",
"refuse-to-answer": "LLM09",
"hallucination": "LLM07",
"malwaregen": "LLM10",
"agenticbackend": "LLM03",
"refuse-to-answer": "LLM07",
}
+1 -1
View File
@@ -17,7 +17,7 @@ class Attack:
id: str
prompt: str
source: dict = field(default_factory=dict)
owasp: tuple[str, ...] = ("LLM01:2025 Prompt Injection", "ASI01 Agent Goal Hijack")
owasp: tuple[str, ...] = ("LLM01:2026 Prompt Injection", "ASI01 Agent Goal Hijack")
@dataclass(frozen=True)
+1 -1
View File
@@ -157,7 +157,7 @@ The harness does not make HTML, XML, or JUnit reports. An agent or a CI job can
A finding is a signal from the refusal classifier. A person must examine it. A finding does not prove that the attack goal was reached.
The OWASP mappings show the objective of the attack: [LLM01:2025](https://genai.owasp.org/llmrisk/llm01-prompt-injection/) and [ASI01](https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/). The harness does not test the full OWASP Top 10.
The OWASP mappings show the objective of the attack: [LLM01:2026](https://genai.owasp.org/resource/owasp-genai-llm-top-10-2026/) and [ASI01](https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/). The harness does not test the full OWASP Top 10.
## Integrations
+17 -17
View File
@@ -15,19 +15,19 @@ def test_classify_defaults_to_prompt_injection():
assert classify({}) == "LLM01"
def test_top_10_matches_2025_list():
# https://genai.owasp.org/llm-top-10/
def test_top_10_matches_2026_list():
# https://genai.owasp.org/resource/owasp-genai-llm-top-10-2026/
assert OWASP_LLM_TOP_10 == {
"LLM01": "Prompt Injection",
"LLM02": "Sensitive Information Disclosure",
"LLM03": "Supply Chain",
"LLM04": "Data and Model Poisoning",
"LLM05": "Improper Output Handling",
"LLM06": "Excessive Agency",
"LLM07": "System Prompt Leakage",
"LLM08": "Vector and Embedding Weaknesses",
"LLM09": "Misinformation",
"LLM10": "Unbounded Consumption",
"LLM03": "Excessive Agency",
"LLM04": "Supply Chain",
"LLM05": "Data and Model Poisoning",
"LLM06": "Unbounded Consumption",
"LLM07": "Misinformation",
"LLM08": "Hidden Context Exposure",
"LLM09": "Vector and Embedding Weaknesses",
"LLM10": "Improper Output Handling",
}
@@ -35,10 +35,10 @@ def test_top_10_matches_2025_list():
"dataset_name, expected_id, expected_title",
[
("DataLeak", "LLM02", "Sensitive Information Disclosure"),
("Hallucination", "LLM09", "Misinformation"),
("Malwaregen", "LLM05", "Improper Output Handling"),
("AgenticBackend", "LLM06", "Excessive Agency"),
("notrichardren/refuse-to-answer-prompts", "LLM09", "Misinformation"),
("Hallucination", "LLM07", "Misinformation"),
("Malwaregen", "LLM10", "Improper Output Handling"),
("AgenticBackend", "LLM03", "Excessive Agency"),
("notrichardren/refuse-to-answer-prompts", "LLM07", "Misinformation"),
],
)
def test_classify_overrides(dataset_name, expected_id, expected_title):
@@ -48,9 +48,9 @@ def test_classify_overrides(dataset_name, expected_id, expected_title):
def test_owasp_tag_shape():
tag = owasp_tag({"dataset_name": "Hallucination"})
assert tag["id"] == "LLM09"
assert tag["title"] == OWASP_LLM_TOP_10["LLM09"]
assert tag["url"] == "https://genai.owasp.org/llm-top-10/"
assert tag["id"] == "LLM07"
assert tag["title"] == OWASP_LLM_TOP_10["LLM07"]
assert tag["url"] == "https://genai.owasp.org/resource/owasp-genai-llm-top-10-2026/"
def test_annotate_covers_every_registry_entry():