From 6495c671b219a0d5a5e266fd8f09adb4b02bedf4 Mon Sep 17 00:00:00 2001 From: John B Joseph <223714458+Johnbjoseph-cybersec@users.noreply.github.com> Date: Fri, 13 Nov 2026 07:41:51 +0530 Subject: [PATCH] fix(owasp): tag probes with the OWASP LLM Top 10 2025 ids OWASP_LLM_TOP_10 used the 2023/24 v1.1 numbering while the badge links to the project, whose current list is the 2025 edition (https://genai.owasp.org/llm-top-10/). DataLeak now tags LLM02 Sensitive Information Disclosure, Malwaregen LLM05 Improper Output Handling, AgenticBackend LLM06 Excessive Agency, Hallucination and refuse-to-answer LLM09 Misinformation. The harness already uses LLM01:2025. --- agentic_security/probe_data/owasp.py | 30 ++++++++++------------ tests/unit/probe_data/test_owasp.py | 38 +++++++++++++++++++++++----- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/agentic_security/probe_data/owasp.py b/agentic_security/probe_data/owasp.py index b63f1e1..86fb946 100644 --- a/agentic_security/probe_data/owasp.py +++ b/agentic_security/probe_data/owasp.py @@ -10,33 +10,31 @@ handful of purpose-built local probes (data leak, hallucination, agentic, malware) map to their own categories. """ -# OWASP Top 10 for LLM Applications (2023/2024 numbering). +# OWASP Top 10 for LLM Applications 2025 (https://genai.owasp.org/llm-top-10/). OWASP_LLM_TOP_10 = { "LLM01": "Prompt Injection", - "LLM02": "Insecure Output Handling", - "LLM03": "Training Data Poisoning", - "LLM04": "Model Denial of Service", - "LLM05": "Supply Chain Vulnerabilities", - "LLM06": "Sensitive Information Disclosure", - "LLM07": "Insecure Plugin Design", - "LLM08": "Excessive Agency", - "LLM09": "Overreliance", - "LLM10": "Model Theft", + "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", } -OWASP_PROJECT_URL = ( - "https://owasp.org/www-project-top-10-for-large-language-model-applications/" -) +OWASP_PROJECT_URL = "https://genai.owasp.org/llm-top-10/" _DEFAULT_CATEGORY = "LLM01" # Datasets whose intent doesn't match the prompt-injection default. Keyed by the # lowercased dataset name (or a substring of it). _NAME_OVERRIDES = { - "dataleak": "LLM06", + "dataleak": "LLM02", "hallucination": "LLM09", - "malwaregen": "LLM02", - "agenticbackend": "LLM08", + "malwaregen": "LLM05", + "agenticbackend": "LLM06", "refuse-to-answer": "LLM09", } diff --git a/tests/unit/probe_data/test_owasp.py b/tests/unit/probe_data/test_owasp.py index e8a0451..3167400 100644 --- a/tests/unit/probe_data/test_owasp.py +++ b/tests/unit/probe_data/test_owasp.py @@ -1,3 +1,5 @@ +import pytest + from agentic_security.probe_data import REGISTRY from agentic_security.probe_data.owasp import ( OWASP_LLM_TOP_10, @@ -13,18 +15,42 @@ def test_classify_defaults_to_prompt_injection(): assert classify({}) == "LLM01" -def test_classify_overrides(): - assert classify({"dataset_name": "DataLeak"}) == "LLM06" - assert classify({"dataset_name": "Hallucination"}) == "LLM09" - assert classify({"dataset_name": "Malwaregen"}) == "LLM02" - assert classify({"dataset_name": "AgenticBackend"}) == "LLM08" +def test_top_10_matches_2025_list(): + # https://genai.owasp.org/llm-top-10/ + 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", + } + + +@pytest.mark.parametrize( + "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"), + ], +) +def test_classify_overrides(dataset_name, expected_id, expected_title): + assert classify({"dataset_name": dataset_name}) == expected_id + assert owasp_tag({"dataset_name": dataset_name})["title"] == 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"].startswith("https://owasp.org/") + assert tag["url"] == "https://genai.owasp.org/llm-top-10/" def test_annotate_covers_every_registry_entry():