{
  "schema": "keryn.dev/result/v1",
  "assessment": {
    "schema": "keryn.dev/assessment/v1",
    "headline": "Keryn — Checks passed (Go)",
    "states": {
      "analysis": "complete",
      "policy": "checks passed",
      "approval": "not recorded",
      "dependencyAdvisories": "not applicable"
    },
    "comparison": "not compared: no finding baseline supplied",
    "revision": {
      "base": "not recorded",
      "analyzed": "0000000"
    },
    "metrics": {
      "contract": 1,
      "comparison": {
        "contract": 1,
        "base": null,
        "analyzed": {
          "revision": "0000000",
          "library": "0.8.0",
          "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
          "complete": true
        },
        "validity": "no-baseline",
        "reasons": [
          "no baseline was supplied"
        ],
        "cases": null
      },
      "coverage": [
        {
          "capability": "pattern-rules",
          "unit": "rule",
          "planned": 1598,
          "completed": 1598,
          "unsupported": 0,
          "excluded": 0,
          "unknown": 0,
          "ratio": 1,
          "state": "complete"
        },
        {
          "capability": "files",
          "unit": "file",
          "planned": 3,
          "completed": 3,
          "unsupported": 0,
          "excluded": 0,
          "unknown": 0,
          "ratio": 1,
          "state": "complete"
        },
        {
          "capability": "cross-file",
          "unit": "flow-dependent pattern finding",
          "planned": 9,
          "completed": 9,
          "unsupported": 0,
          "excluded": 0,
          "unknown": 0,
          "ratio": 1,
          "state": "complete"
        },
        {
          "capability": "known-fix",
          "unit": "file",
          "planned": 3,
          "completed": 3,
          "unsupported": 0,
          "excluded": 0,
          "unknown": 0,
          "ratio": 1,
          "state": "complete"
        }
      ]
    },
    "reasons": [],
    "failureReason": null,
    "counts": {
      "current": 7,
      "new": 0,
      "existing": 0,
      "unclassified": 7,
      "clearedPrevious": null,
      "newlyBlocking": null,
      "displayed": 7,
      "omitted": {
        "displayLimit": 0
      },
      "recordedRuleHits": 32,
      "contributingRules": 14,
      "nonCaseObservations": 25,
      "suppressedRuleHits": 0,
      "failedChecks": 0
    },
    "cases": [
      {
        "id": "sha256:61dedc32607fae20a29bad35697c505ba7119b6cd124de61de2c63c8f1e01843",
        "title": "Model Output Streamed or Rendered as Unsanitized HTML",
        "path": "ai_route.ts",
        "line": 7,
        "evidence": "pattern",
        "rules": [
          "seceng/unfiltered_llm_stream_to_client"
        ],
        "blocking": false,
        "change": "unclassified",
        "newlyBlocking": null
      },
      {
        "id": "sha256:dc9c0f2dd746743cfa27fe54474754ff1b22d4aa5298163cb64f7263345bd190",
        "title": "Agent file write path traversal.",
        "path": "ai_route.ts",
        "line": 13,
        "evidence": "pattern",
        "rules": [
          "seceng/agent_file_write_path_traversal"
        ],
        "blocking": false,
        "change": "unclassified",
        "newlyBlocking": null
      },
      {
        "id": "sha256:91da11f4316f3023693b361fa2e473fe0f36452ab04c08d15e48c32f9022009b",
        "title": "Agent file write path traversal.",
        "path": "ai_route.ts",
        "line": 15,
        "evidence": "pattern",
        "rules": [
          "seceng/agent_file_write_path_traversal"
        ],
        "blocking": false,
        "change": "unclassified",
        "newlyBlocking": null
      },
      {
        "id": "sha256:fda094fae25a9c9150d9e993ce89bd34d70f35cc6f73a63ca3ace11908e79eac",
        "title": "CWE-79 (insecure-output-handling): Renders raw HTML in React; if it carries LLM/markdown/user output, sanitize (DOMPurify).",
        "path": "ui.tsx",
        "line": 6,
        "evidence": "path-in-file",
        "rules": [
          "seceng.llm04.model-output-xss-js",
          "seceng.llm05.inner-html-assignment",
          "seceng.llm05.react-dangerously-set-inner-html",
          "seceng.llm05.react-dangerously-set-inner-html-unprotected",
          "seceng/html_render",
          "vulnfix-ai-ai_js_dangerous_html"
        ],
        "blocking": false,
        "change": "unclassified",
        "newlyBlocking": null
      },
      {
        "id": "sha256:f1c13928590c3148d0894548d457817226c49e42510b9efdaf77ddd9f6811a08",
        "title": "Assignment to innerHTML or outerHTML may render model, retrieved, or tool output as executable HTML. Confirm sanitizer use and source trust.",
        "path": "ui.tsx",
        "line": 14,
        "evidence": "path-in-file",
        "rules": [
          "seceng.llm05.inner-html-assignment",
          "seceng/html_render"
        ],
        "blocking": false,
        "change": "unclassified",
        "newlyBlocking": null
      },
      {
        "id": "sha256:ff5a126e19946add5d2f52e4b33ab881325fafb7e7342ad075850a19dfc26092",
        "title": "Markdown rendering appears to allow raw HTML. If model or retrieved content reaches this renderer, this can become XSS.",
        "path": "ui.tsx",
        "line": 16,
        "evidence": "pattern",
        "rules": [
          "seceng.llm05.marked-html-enabled"
        ],
        "blocking": false,
        "change": "unclassified",
        "newlyBlocking": null
      },
      {
        "id": "sha256:f427b43820db7ba61aeafb03a9295b0d70e406061d9b69e298f05acd664ad793",
        "title": "Assignment to innerHTML or outerHTML may render model, retrieved, or tool output as executable HTML. Confirm sanitizer use and source trust.",
        "path": "ui.tsx",
        "line": 18,
        "evidence": "path-in-file",
        "rules": [
          "seceng.llm05.inner-html-assignment",
          "seceng/html_render"
        ],
        "blocking": false,
        "change": "unclassified",
        "newlyBlocking": null
      }
    ],
    "acceptedRisks": [],
    "exceptions": {
      "known": false,
      "expiredEntries": 0
    },
    "limitations": [
      "Newly blocking needs a base run (--base); without one it is unknown.",
      "Cases follow core fingerprint deduplication; co-located rules without shared identity stay separate.",
      "Recorded rule hits exclude hits removed by core deduplication."
    ]
  },
  "versions": {
    "keryn": "0.5.2",
    "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
    "cyclonedx": "1.6",
    "protocol": 1,
    "metrics": 1,
    "core": "keryn-core/0.0.0",
    "library": "0.8.0"
  },
  "subject": "example-repo",
  "revision": "0000000",
  "coverage": {
    "rulesRequested": 1598,
    "rulesExecuted": 1598,
    "rulesApplicable": 1073,
    "scope": {
      "scanned": 3,
      "excluded": 0,
      "skipped": {},
      "unsupported": {
        "rules": 0,
        "partialRules": 0
      },
      "failed": {
        "unreadable": 0,
        "notParsed": 0,
        "timedOut": 0,
        "oversizedSource": 0
      },
      "failedPaths": []
    },
    "unsupportedRules": [],
    "partialRules": [],
    "ruleWarnings": [],
    "timeouts": [],
    "filesScanned": 3,
    "filesSkipped": 0,
    "filesExcluded": 0,
    "hostSkips": [],
    "skippedAs": {
      "noEngine": 0,
      "noRules": 0,
      "defaultIgnored": 0,
      "binary": 0,
      "tooLarge": 0,
      "unrecorded": 0
    },
    "limitations": [
      "Semgrep-compatible SUBSET: no join, no metavariable-pattern/comparison, no cross-file or type inference, no language equivalences/constant propagation; taint is an approximation.",
      "Structural matching uses the bundled language grammars, including Ruby. Unsupported rule/language combinations are listed in coverage; generic text also supports regex rules.",
      "Parity is only claimed where proven by differential tests against native Semgrep CE (results: https://keryn.dev/evals/semgrep-ce/).",
      "Deliberate divergence: each language is matched with its own grammar. Semgrep CE reuses the JavaScript parse of a pattern for every language of a rule that lists javascript, so its Python side never matches keyword arguments, dict literals or eval/require there (reported as a rule warning).",
      "Maintainer/install-hook transition not checked without --base evidence; a lockfile alone does not record authenticated maintainer history."
    ],
    "complete": true,
    "statement": "1598/1598 rules executed (0 unsupported, 0 partial, 0 timed out); 3 files scanned, 0 skipped; 15 absence findings collapsed into 13 repo-level findings.",
    "collapsed": {
      "rules": 13,
      "findings": 15
    },
    "dedup": {
      "classCollapsed": 0,
      "exactCollapsed": 0,
      "input": 32,
      "output": 32
    }
  },
  "components": [
    {
      "key": "library:openai",
      "kind": "library",
      "name": "openai",
      "provider": "openai",
      "category": "llm-sdk",
      "evidence": [
        {
          "path": "agent.py",
          "line": 1,
          "ruleId": "keryn.inv.lib.openai"
        },
        {
          "path": "ai_route.ts",
          "line": 2,
          "ruleId": "keryn.inv.lib.openai"
        }
      ],
      "scope": "direct",
      "basis": "observed-in-source",
      "provenance": {
        "identity": "unknown",
        "version": "unknown",
        "artifactDigest": "unknown",
        "resolutions": [],
        "reachability": {
          "status": "unknown",
          "reason": "Static references do not establish runtime reachability or non-reachability.",
          "paths": []
        },
        "advisory": {
          "status": "unknown",
          "source": "unknown",
          "asOf": "unknown"
        },
        "malware": {
          "status": "unknown",
          "source": "unknown",
          "asOf": "unknown"
        },
        "inspection": "unassessed"
      }
    },
    {
      "key": "library:vercel-ai-sdk",
      "kind": "library",
      "name": "vercel-ai-sdk",
      "category": "llm-sdk",
      "evidence": [
        {
          "path": "ai_route.ts",
          "line": 1,
          "ruleId": "keryn.inv.lib.vercel-ai"
        }
      ],
      "scope": "direct",
      "basis": "observed-in-source",
      "provenance": {
        "identity": "unknown",
        "version": "unknown",
        "artifactDigest": "unknown",
        "resolutions": [],
        "reachability": {
          "status": "unknown",
          "reason": "Static references do not establish runtime reachability or non-reachability.",
          "paths": []
        },
        "advisory": {
          "status": "unknown",
          "source": "unknown",
          "asOf": "unknown"
        },
        "malware": {
          "status": "unknown",
          "source": "unknown",
          "asOf": "unknown"
        },
        "inspection": "unassessed"
      }
    }
  ],
  "bom": {
    "bomFormat": "CycloneDX",
    "specVersion": "1.6",
    "serialNumber": "urn:uuid:ad628851-cdd5-49af-8e9f-05752e709274",
    "version": 1,
    "metadata": {
      "timestamp": "2026-01-01T00:00:00Z",
      "tools": {
        "components": [
          {
            "type": "application",
            "name": "keryn",
            "version": "0.5.2",
            "description": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)"
          }
        ]
      },
      "component": {
        "type": "application",
        "name": "example-repo",
        "bom-ref": "keryn:subject",
        "version": "0000000"
      },
      "properties": [
        {
          "name": "keryn:coverage.rules",
          "value": "1598/1598 executed"
        },
        {
          "name": "keryn:coverage.files",
          "value": "3 scanned, 0 skipped"
        },
        {
          "name": "keryn:caveat",
          "value": "Inventory reflects static references only. Absence is not evidence of absence; presence does not prove runtime use."
        },
        {
          "name": "keryn:surface",
          "value": "0 routes, 1 tools"
        },
        {
          "name": "keryn:ci:policySha256",
          "value": "none"
        },
        {
          "name": "keryn:ci:ruleBundleSha256",
          "value": "sha256:ff505642b502caefa5c56c481db622fd900dcc90a40e3e22f7b3ac3fa0fffab8"
        }
      ]
    },
    "components": [
      {
        "type": "library",
        "name": "openai",
        "bom-ref": "keryn:library:openai",
        "publisher": "openai",
        "evidence": {
          "occurrences": [
            {
              "location": "agent.py",
              "line": 1
            },
            {
              "location": "ai_route.ts",
              "line": 2
            }
          ]
        },
        "properties": [
          {
            "name": "keryn:assetProvenance",
            "value": "{\"identity\":\"unknown\",\"version\":\"unknown\",\"artifactDigest\":\"unknown\",\"resolutions\":[],\"reachability\":{\"status\":\"unknown\",\"reason\":\"Static references do not establish runtime reachability or non-reachability.\",\"paths\":[]},\"advisory\":{\"status\":\"unknown\",\"source\":\"unknown\",\"asOf\":\"unknown\"},\"malware\":{\"status\":\"unknown\",\"source\":\"unknown\",\"asOf\":\"unknown\"},\"inspection\":\"unassessed\"}"
          },
          {
            "name": "keryn:category",
            "value": "llm-sdk"
          },
          {
            "name": "keryn:basis",
            "value": "observed-in-source"
          },
          {
            "name": "keryn:scope",
            "value": "direct"
          },
          {
            "name": "keryn:rules",
            "value": "keryn.inv.lib.openai"
          },
          {
            "name": "keryn:provider",
            "value": "openai"
          }
        ]
      },
      {
        "type": "library",
        "name": "vercel-ai-sdk",
        "bom-ref": "keryn:library:vercel-ai-sdk",
        "evidence": {
          "occurrences": [
            {
              "location": "ai_route.ts",
              "line": 1
            }
          ]
        },
        "properties": [
          {
            "name": "keryn:assetProvenance",
            "value": "{\"identity\":\"unknown\",\"version\":\"unknown\",\"artifactDigest\":\"unknown\",\"resolutions\":[],\"reachability\":{\"status\":\"unknown\",\"reason\":\"Static references do not establish runtime reachability or non-reachability.\",\"paths\":[]},\"advisory\":{\"status\":\"unknown\",\"source\":\"unknown\",\"asOf\":\"unknown\"},\"malware\":{\"status\":\"unknown\",\"source\":\"unknown\",\"asOf\":\"unknown\"},\"inspection\":\"unassessed\"}"
          },
          {
            "name": "keryn:category",
            "value": "llm-sdk"
          },
          {
            "name": "keryn:basis",
            "value": "observed-in-source"
          },
          {
            "name": "keryn:scope",
            "value": "direct"
          },
          {
            "name": "keryn:rules",
            "value": "keryn.inv.lib.vercel-ai"
          }
        ]
      }
    ],
    "services": [
      {
        "bom-ref": "keryn:tool:ai_route.ts:toolDef",
        "name": "toolDef",
        "description": "send email",
        "properties": [
          {
            "name": "keryn:assetProvenance",
            "value": "{\"identity\":\"source-definition:ai_route.ts:toolDef\",\"version\":\"unknown\",\"artifactDigest\":\"unknown\",\"resolutions\":[],\"reachability\":{\"status\":\"unknown\",\"reason\":\"Static references do not establish runtime reachability or non-reachability.\",\"paths\":[]},\"advisory\":{\"status\":\"unknown\",\"source\":\"unknown\",\"asOf\":\"unknown\"},\"malware\":{\"status\":\"unknown\",\"source\":\"unknown\",\"asOf\":\"unknown\"},\"inspection\":\"unassessed\"}"
          },
          {
            "name": "keryn:category",
            "value": "agent-tool"
          },
          {
            "name": "keryn:basis",
            "value": "observed-in-source"
          },
          {
            "name": "keryn:scope",
            "value": "direct"
          },
          {
            "name": "keryn:occurrences",
            "value": "ai_route.ts:29"
          },
          {
            "name": "keryn:tool.framework",
            "value": "vercel-ai"
          },
          {
            "name": "keryn:tool.capability",
            "value": "send"
          },
          {
            "name": "keryn:tool.capabilityBasis",
            "value": "authority:send,authority:external,authority:irreversible"
          },
          {
            "name": "keryn:tool.authority",
            "value": "send,external,irreversible"
          }
        ]
      }
    ]
  },
  "agentSurface": {
    "routes": [],
    "tools": [
      {
        "id": "ai_route.ts:toolDef",
        "name": "toolDef",
        "description": "send email",
        "params": [],
        "framework": "vercel-ai",
        "capability": "send",
        "capabilityBasis": [
          "authority:send",
          "authority:external",
          "authority:irreversible"
        ],
        "authority": {
          "read": false,
          "write": false,
          "send": true,
          "execute": false,
          "admin": false,
          "external": true,
          "irreversible": true,
          "sensitive": false,
          "network": false,
          "filesystem": false,
          "browser": false,
          "payment": false
        },
        "path": "ai_route.ts",
        "line": 29,
        "scope": "direct",
        "provenance": {
          "identity": "source-definition:ai_route.ts:toolDef",
          "version": "unknown",
          "artifactDigest": "unknown",
          "resolutions": [],
          "reachability": {
            "status": "unknown",
            "reason": "Static references do not establish runtime reachability or non-reachability.",
            "paths": []
          },
          "advisory": {
            "status": "unknown",
            "source": "unknown",
            "asOf": "unknown"
          },
          "malware": {
            "status": "unknown",
            "source": "unknown",
            "asOf": "unknown"
          },
          "inspection": "unassessed"
        }
      }
    ]
  },
  "deep": {
    "returned": 14,
    "facts": {
      "taint": 0,
      "sinkSites": 6,
      "unmapped": 0
    },
    "kept": 14,
    "shadowed": 0,
    "corroborated": 8,
    "noPath": 1
  },
  "findings": [
    {
      "ruleId": "keryn.inv.lib.openai",
      "path": "agent.py",
      "line": 1,
      "column": 1,
      "endLine": 1,
      "endColumn": 14,
      "message": "References the OpenAI SDK.",
      "severity": "INFO",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "edge": "depends_on",
        "edge_boundary": "supply-chain",
        "aibom": {
          "kind": "library",
          "name": "openai",
          "provider": "openai",
          "category": "llm-sdk",
          "packages": [
            "npm:openai",
            "pypi:openai"
          ]
        },
        "owasp_llm_version": "2025",
        "assertion": "capability",
        "category": "security",
        "subcategory": "inventory",
        "confidence": "P1",
        "technology": [
          "openai"
        ],
        "role": "framework"
      },
      "snippet": "import openai",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P1",
      "subcategory": "inventory",
      "assertion": "capability",
      "role": "framework",
      "evidence": {
        "path": "agent.py",
        "lineStart": 1,
        "lineEnd": 1,
        "snippet": "import openai",
        "contentSha256": "sha256:c52abe60f2a9d309e5c7875dce58f51152117a6baf0e5befcc7c88c7af3b2cca"
      },
      "fingerprint": "sha256:4f7345b3b7d53bbd2193b5a6c7eadbc14515d784e9879df57c7681debc08d7a5",
      "gating": false
    },
    {
      "ruleId": "seceng/ai_gateway",
      "path": "agent.py",
      "line": 11,
      "column": 1,
      "endLine": 11,
      "endColumn": 1,
      "message": "AI gateway or model endpoint lacks authorization, tenant scope, or rate limits",
      "severity": "WARNING",
      "engine": "seceng",
      "snippet": "The scan identified a candidate AI gateway control gap. Validation should confirm that identity, authorization, tenant scope, quota, and rate limits are enforced before model invocation.",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "trace": [
        {
          "kind": "source",
          "path": "agent.py",
          "line": 7,
          "column": 1,
          "endLine": 7,
          "endColumn": 1
        }
      ],
      "confidence": "P1",
      "findingClass": "ai_gateway",
      "metadata": {
        "granularity": "line",
        "deepId": "finding_seceng_rulespec_1",
        "owasp": [
          "LLM02",
          "LLM06",
          "LLM10"
        ],
        "remediation": "Add and verify path-relevant controls before the sink: authentication, authorization, tenant_isolation, rate_limit, quota, audit, provider_key_protection.",
        "references": [
          "https://genai.owasp.org/llm-top-10/"
        ],
        "role": "framework",
        "severityCap": {
          "from": "ERROR",
          "reason": "inventory"
        }
      },
      "role": "framework",
      "evidence": {
        "path": "agent.py",
        "lineStart": 11,
        "lineEnd": 11,
        "snippet": "r = client.chat.completions.create(model=\"m\", messages=[])",
        "contentSha256": "sha256:41a1fdf29e3fdcb5ee2575c7467763c7f1ae0443f2c18a4d80ba90009ccd28cd"
      },
      "fingerprint": "sha256:1d5227d76b750072ae30951f153df4f3317b38b206bc756840a3e5fe34f576a6",
      "gating": false
    },
    {
      "ruleId": "seceng/model_call_without_token_cap",
      "path": "agent.py",
      "line": 11,
      "column": 1,
      "endLine": 11,
      "endColumn": 1,
      "message": "Model call without token cap.",
      "severity": "WARNING",
      "engine": "seceng",
      "snippet": "LLM10 P1: sink `client.chat.completions.create(` on line 11 appears without a nearby guard",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P0",
      "findingClass": "model_call_without_token_cap",
      "metadata": {
        "granularity": "line",
        "deepId": "finding_seceng_ss_1",
        "owasp": [
          "LLM10"
        ],
        "cwe": [
          "CWE-22",
          "CWE-400",
          "CWE-73"
        ],
        "remediation": "Add max_tokens or max_completion_tokens to all model API calls. Implement a token budget at the agent/orchestration level and abort loops that exceed the cap. Use rate limiting and cost alerts in the gateway layer. Expected controls: canonicalize, allowed_root, path_clean, deny_dotdot, allowlist, human_approval, dry_run, authorization.",
        "references": [
          "https://genai.owasp.org/llm-top-10/",
          "https://cwe.mitre.org/data/definitions/22.html",
          "https://cwe.mitre.org/data/definitions/400.html",
          "https://cwe.mitre.org/data/definitions/73.html"
        ],
        "role": "framework"
      },
      "role": "framework",
      "evidence": {
        "path": "agent.py",
        "lineStart": 11,
        "lineEnd": 11,
        "snippet": "r = client.chat.completions.create(model=\"m\", messages=[])",
        "contentSha256": "sha256:41a1fdf29e3fdcb5ee2575c7467763c7f1ae0443f2c18a4d80ba90009ccd28cd"
      },
      "fingerprint": "sha256:21f8e1dd9989840ad1842d51339a54253e3dadf737926dbd508a509f38c25023",
      "gating": false
    },
    {
      "ruleId": "keryn.vendor.openai-call-without-moderation-py",
      "path": "agent.py",
      "line": 11,
      "column": 9,
      "endLine": 11,
      "endColumn": 63,
      "message": "The function that calls this OpenAI generation endpoint never calls moderations.create, so harmful or policy-violating input and output reach the model and your users unscreened. The Moderation endpoint is free; screen user input before the call and model output before it is shown.",
      "severity": "WARNING",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "category": "security",
        "edge": "trusts",
        "subcategory": "audit",
        "assertion": "absence",
        "confidence": "P2",
        "false_positive_risk": "high",
        "finding_class": "vendor_moderation_not_called",
        "cwe": [
          "CWE-1188"
        ],
        "owasp_llm": [
          "LLM01",
          "LLM05"
        ],
        "owasp_llm_version": "2025",
        "technology": [
          "openai"
        ],
        "references": [
          "https://developers.openai.com/api/docs/guides/safety-best-practices",
          "https://developers.openai.com/api/reference/resources/moderations"
        ],
        "remediation": "Call client.moderations.create(input=...) on the user input before this call and on the generated text before returning it, and refuse or fall back when the result is flagged. If moderation runs in shared middleware, suppress this audit there.",
        "collapsed": true,
        "role": "framework"
      },
      "metavars": {
        "$C": "client"
      },
      "snippet": "client.chat.completions.create(model=\"m\", messages=[])",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P2",
      "falsePositiveRisk": "high",
      "findingClass": "vendor_moderation_not_called",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 1,
      "role": "framework",
      "evidence": {
        "path": "agent.py",
        "lineStart": 11,
        "lineEnd": 11,
        "snippet": "r = client.chat.completions.create(model=\"m\", messages=[])",
        "contentSha256": "sha256:41a1fdf29e3fdcb5ee2575c7467763c7f1ae0443f2c18a4d80ba90009ccd28cd"
      },
      "fingerprint": "sha256:47d97c027ed59a7503642193829f3f44bc9d7c5773ed13a422b3390ceb81badc",
      "gating": false
    },
    {
      "ruleId": "keryn.vendor.openai-chat-without-user-identifier-py",
      "path": "agent.py",
      "line": 11,
      "column": 9,
      "endLine": 11,
      "endColumn": 63,
      "message": "The OpenAI call carries neither a user nor a safety_identifier parameter, so OpenAI cannot tell your end users apart. Those fields are what lets the platform act on one abusive end user instead of your whole organisation when policy-violating prompts arrive. Pass safety_identifier (or user on older endpoints) with a hashed end-user id.",
      "severity": "INFO",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "category": "security",
        "edge": "grants",
        "subcategory": "audit",
        "assertion": "absence",
        "confidence": "P2",
        "false_positive_risk": "medium",
        "finding_class": "abuse_identifier_missing",
        "cwe": [
          "CWE-778"
        ],
        "owasp_llm": [
          "LLM10"
        ],
        "owasp_llm_version": "2025",
        "owasp_agentic": [
          "ASI03"
        ],
        "owasp_agentic_basis": "heuristic",
        "technology": [
          "openai"
        ],
        "references": [
          "https://developers.openai.com/api/docs/guides/safety-best-practices",
          "https://developers.openai.com/api/reference/resources/responses/methods/create"
        ],
        "remediation": "Pass safety_identifier=<hashed end-user id> on responses.create and chat.completions.create (user=<hashed id> on endpoints that predate safety_identifier). Hash or tokenise the id; do not send names or emails.",
        "collapsed": true,
        "role": "framework"
      },
      "metavars": {
        "$C": "client",
        "$MODEL": "\"m\""
      },
      "snippet": "client.chat.completions.create(model=\"m\", messages=[])",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P2",
      "falsePositiveRisk": "medium",
      "findingClass": "abuse_identifier_missing",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 1,
      "role": "framework",
      "evidence": {
        "path": "agent.py",
        "lineStart": 11,
        "lineEnd": 11,
        "snippet": "r = client.chat.completions.create(model=\"m\", messages=[])",
        "contentSha256": "sha256:41a1fdf29e3fdcb5ee2575c7467763c7f1ae0443f2c18a4d80ba90009ccd28cd"
      },
      "fingerprint": "sha256:cedce0da910f3b7876780d19bf39bcb3d6e71bed1ba436f8391d85179db68aed",
      "gating": false
    },
    {
      "ruleId": "seceng.llm01.missing-safety-sidecar-openai-python",
      "path": "agent.py",
      "line": 11,
      "column": 9,
      "endLine": 11,
      "endColumn": 63,
      "message": "OpenAI model call found in a Python file without visible import of guardrails, llm_guard, rebuff, nemoguardrails, or equivalent safety sidecar.",
      "severity": "INFO",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "assertion": "absence",
        "edge": "trusts",
        "owasp_llm": [
          "LLM01"
        ],
        "cwe": [
          "CWE-693"
        ],
        "cwe_justification": "No narrower CWE covers a disabled or absent LLM content-safety layer (Bedrock guardrail, Azure RAI policy, a guardrail library); it spans input and output, so CWE-1426/1427 alone would name one direction.",
        "finding_class": "missing_safety_sidecar",
        "confidence": "P1",
        "validation_payload_id": "safety-sidecar-policy",
        "exploitability_hint": "security_issue",
        "false_positive_risk": "high",
        "owasp_llm_version": "2025",
        "category": "security",
        "subcategory": "audit",
        "technology": [
          "openai"
        ],
        "owasp_agentic": [
          "ASI01"
        ],
        "owasp_agentic_basis": "heuristic",
        "audit_review": "demote-info: Posture hint: no visible guardrails import in this file; may be applied elsewhere. Unenforceable per file.",
        "deprecated_alias": [
          "seceng.llm01.missing-safety-guardrail-policy"
        ],
        "collapsed": true,
        "role": "framework"
      },
      "metavars": {
        "$CLIENT": "client"
      },
      "snippet": "client.chat.completions.create(model=\"m\", messages=[])",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P1",
      "falsePositiveRisk": "high",
      "findingClass": "missing_safety_sidecar",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 1,
      "role": "framework",
      "evidence": {
        "path": "agent.py",
        "lineStart": 11,
        "lineEnd": 11,
        "snippet": "r = client.chat.completions.create(model=\"m\", messages=[])",
        "contentSha256": "sha256:41a1fdf29e3fdcb5ee2575c7467763c7f1ae0443f2c18a4d80ba90009ccd28cd"
      },
      "fingerprint": "sha256:2487b03b3bf22cf24df53dc3e034c091cc73d81e44d2fc2a9976270a834389b8",
      "gating": false
    },
    {
      "ruleId": "seceng/agent_tool_surfaces_found_without_obvious_controls",
      "path": "ai_route.ts",
      "line": 1,
      "column": 1,
      "endLine": 1,
      "endColumn": 1,
      "message": "Agent/tool surfaces found without obvious controls",
      "severity": "WARNING",
      "engine": "seceng",
      "snippet": "The repo appears to expose tools or function-calling surfaces, but no obvious eval, guardrail, policy, or approval control files were detected.",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P0",
      "findingClass": "agent_tool_surfaces_found_without_obvious_controls",
      "metadata": {
        "granularity": "file",
        "deepId": "finding_seceng_1",
        "owasp": [
          "LLM06"
        ],
        "remediation": "Add tool permission reviews and confirmation gates.",
        "references": [
          "https://genai.owasp.org/llm-top-10/"
        ],
        "role": "application",
        "severityCap": {
          "from": "ERROR",
          "reason": "inventory"
        }
      },
      "role": "application",
      "fingerprint": "sha256:9b51046956403bfe13beea46d932bdbf1aa61aad77d4e531138d928e11458e64",
      "gating": false
    },
    {
      "ruleId": "seceng.forensics-model-version-missing",
      "path": "ai_route.ts",
      "line": 1,
      "column": 10,
      "endLine": 1,
      "endColumn": 20,
      "message": "AI call or model gateway invocation lacks visible model/version/provider capture for forensic reproducibility.",
      "severity": "INFO",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "assertion": "absence",
        "edge": "none",
        "owasp_llm": [
          "LLM09",
          "LLM10"
        ],
        "nist_ai_rmf": [
          "MAP",
          "MEASURE"
        ],
        "cwe": [
          "CWE-778"
        ],
        "finding_class": "missing_model_version_evidence",
        "confidence": "P1",
        "validation_payload_id": "model-version-evidence",
        "exploitability_hint": "security_issue",
        "false_positive_risk": "high",
        "owasp_llm_version": "2025",
        "category": "security",
        "subcategory": "audit",
        "technology": [
          "ai-forensics-observability"
        ],
        "owasp_agentic": [
          "ASI09",
          "ASI08"
        ],
        "owasp_agentic_basis": "heuristic",
        "audit_review": "demote-info: Posture hint, rarely actionable: logging/forensic/correlation posture; not a code defect, not locatable.",
        "collapsed": true,
        "role": "application"
      },
      "snippet": "streamText",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P1",
      "falsePositiveRisk": "high",
      "findingClass": "missing_model_version_evidence",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 7,
      "relatedLocations": [
        {
          "path": "agent.py",
          "line": 11,
          "column": 16,
          "endLine": 11,
          "endColumn": 32
        },
        {
          "path": "ai_route.ts",
          "line": 7,
          "column": 13,
          "endLine": 7,
          "endColumn": 23
        },
        {
          "path": "ai_route.ts",
          "line": 9,
          "column": 13,
          "endLine": 9,
          "endColumn": 23
        },
        {
          "path": "ai_route.ts",
          "line": 11,
          "column": 13,
          "endLine": 11,
          "endColumn": 23
        },
        {
          "path": "ai_route.ts",
          "line": 13,
          "column": 26,
          "endLine": 13,
          "endColumn": 42
        },
        {
          "path": "ai_route.ts",
          "line": 15,
          "column": 26,
          "endLine": 15,
          "endColumn": 42
        }
      ],
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 1,
        "lineEnd": 1,
        "snippet": "import { streamText, tool } from \"ai\";",
        "contentSha256": "sha256:884789e0f139d685b23576e54a770a22f50ac0f2d711829a4b296310fdf26f45"
      },
      "fingerprint": "sha256:2cdf4755752b6ec94028a8f1eeeb5981d3e84502e9c919b5b7cde0984a49a7c1",
      "gating": false
    },
    {
      "ruleId": "seceng.forensics.ai-action-missing-correlation-id",
      "path": "ai_route.ts",
      "line": 1,
      "column": 10,
      "endLine": 1,
      "endColumn": 20,
      "message": "AI action, tool call, or agent workflow lacks visible correlation/request/trace ID capture.",
      "severity": "INFO",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "assertion": "absence",
        "edge": "none",
        "owasp_llm": [
          "LLM07",
          "LLM09"
        ],
        "nist_ai_rmf": [
          "GOVERN",
          "MEASURE",
          "MANAGE"
        ],
        "cwe": [
          "CWE-778"
        ],
        "finding_class": "missing_ai_correlation_id",
        "confidence": "P1",
        "validation_payload_id": "ai-correlation-id-coverage",
        "exploitability_hint": "security_issue",
        "false_positive_risk": "high",
        "owasp_llm_version": "2025",
        "category": "security",
        "subcategory": "audit",
        "technology": [
          "github-actions"
        ],
        "owasp_agentic": [
          "ASI02",
          "ASI09"
        ],
        "owasp_agentic_basis": "heuristic",
        "audit_review": "demote-info: Posture hint, rarely actionable: logging/forensic/correlation posture; not a code defect, not locatable.",
        "collapsed": true,
        "role": "application"
      },
      "snippet": "streamText",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P1",
      "falsePositiveRisk": "high",
      "findingClass": "missing_ai_correlation_id",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 7,
      "relatedLocations": [
        {
          "path": "agent.py",
          "line": 11,
          "column": 16,
          "endLine": 11,
          "endColumn": 32
        },
        {
          "path": "ai_route.ts",
          "line": 7,
          "column": 13,
          "endLine": 7,
          "endColumn": 23
        },
        {
          "path": "ai_route.ts",
          "line": 9,
          "column": 13,
          "endLine": 9,
          "endColumn": 23
        },
        {
          "path": "ai_route.ts",
          "line": 11,
          "column": 13,
          "endLine": 11,
          "endColumn": 23
        },
        {
          "path": "ai_route.ts",
          "line": 13,
          "column": 26,
          "endLine": 13,
          "endColumn": 42
        },
        {
          "path": "ai_route.ts",
          "line": 15,
          "column": 26,
          "endLine": 15,
          "endColumn": 42
        }
      ],
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 1,
        "lineEnd": 1,
        "snippet": "import { streamText, tool } from \"ai\";",
        "contentSha256": "sha256:884789e0f139d685b23576e54a770a22f50ac0f2d711829a4b296310fdf26f45"
      },
      "fingerprint": "sha256:24c7cc4d56f0f3fa06f9757cbb4b942a2ed2f261edc0eb55a02d635e921be2b3",
      "gating": false
    },
    {
      "ruleId": "keryn.inv.lib.vercel-ai",
      "path": "ai_route.ts",
      "line": 1,
      "column": 29,
      "endLine": 1,
      "endColumn": 38,
      "message": "References the Vercel AI SDK.",
      "severity": "INFO",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "edge": "depends_on",
        "edge_boundary": "supply-chain",
        "aibom": {
          "kind": "library",
          "name": "vercel-ai-sdk",
          "category": "llm-sdk",
          "packages": [
            "npm:ai",
            "npm:@ai-sdk/openai",
            "npm:@ai-sdk/anthropic",
            "npm:@ai-sdk/google"
          ]
        },
        "owasp_llm_version": "2025",
        "assertion": "capability",
        "category": "security",
        "subcategory": "inventory",
        "confidence": "P1",
        "technology": [
          "vercel-ai-sdk"
        ],
        "role": "application"
      },
      "snippet": "from \"ai\"",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P1",
      "subcategory": "inventory",
      "assertion": "capability",
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 1,
        "lineEnd": 1,
        "snippet": "import { streamText, tool } from \"ai\";",
        "contentSha256": "sha256:884789e0f139d685b23576e54a770a22f50ac0f2d711829a4b296310fdf26f45"
      },
      "fingerprint": "sha256:399d15051e8ab5166ccf3beb91afe2e17908ce969114db2de27ddbcdb38aa037",
      "gating": false
    },
    {
      "ruleId": "keryn.inv.lib.openai",
      "path": "ai_route.ts",
      "line": 2,
      "column": 15,
      "endLine": 2,
      "endColumn": 28,
      "message": "References the OpenAI SDK.",
      "severity": "INFO",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "edge": "depends_on",
        "edge_boundary": "supply-chain",
        "aibom": {
          "kind": "library",
          "name": "openai",
          "provider": "openai",
          "category": "llm-sdk",
          "packages": [
            "npm:openai",
            "pypi:openai"
          ]
        },
        "owasp_llm_version": "2025",
        "assertion": "capability",
        "category": "security",
        "subcategory": "inventory",
        "confidence": "P1",
        "technology": [
          "openai"
        ],
        "role": "application"
      },
      "snippet": "from \"openai\"",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P1",
      "subcategory": "inventory",
      "assertion": "capability",
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 2,
        "lineEnd": 2,
        "snippet": "import OpenAI from \"openai\";",
        "contentSha256": "sha256:4db7290b0afd02c5e85fc97817d8a19ebfaaca9907827241083b99c00bb8eafe"
      },
      "fingerprint": "sha256:b829b8ab6c2e808fd2d946e236d7393fd48c6d5ea03d828a3c57d7e393d38ecd",
      "gating": false
    },
    {
      "ruleId": "seceng/model_call_without_token_cap",
      "path": "ai_route.ts",
      "line": 7,
      "column": 1,
      "endLine": 7,
      "endColumn": 1,
      "message": "Model call without token cap.",
      "severity": "WARNING",
      "engine": "seceng",
      "snippet": "LLM10 P1: sink `streamText(` on line 7 appears without a nearby guard",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P0",
      "findingClass": "model_call_without_token_cap",
      "metadata": {
        "granularity": "line",
        "deepId": "finding_seceng_ss_2",
        "owasp": [
          "LLM10"
        ],
        "cwe": [
          "CWE-400"
        ],
        "remediation": "Add max_tokens or max_completion_tokens to all model API calls. Implement a token budget at the agent/orchestration level and abort loops that exceed the cap. Use rate limiting and cost alerts in the gateway layer.",
        "references": [
          "https://genai.owasp.org/llm-top-10/",
          "https://cwe.mitre.org/data/definitions/400.html"
        ],
        "role": "application"
      },
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 7,
        "lineEnd": 7,
        "snippet": "const a = streamText({ model: \"m\", tools: tools });",
        "contentSha256": "sha256:a1919e57c0e2166070b3ba899a9652ce4ac53ddb64f3473cc95806ed07b50ba5"
      },
      "fingerprint": "sha256:da184b1e5f18400da7613b69ce8ce330c8a2806e56cece89b86a53c2110e942a",
      "gating": false
    },
    {
      "ruleId": "seceng/unfiltered_llm_stream_to_client",
      "path": "ai_route.ts",
      "line": 7,
      "column": 1,
      "endLine": 7,
      "endColumn": 1,
      "message": "Model Output Streamed or Rendered as Unsanitized HTML",
      "severity": "ERROR",
      "engine": "seceng",
      "snippet": "Model output is streamed directly to a response — ensure downstream rendering sanitizes before injecting into the DOM.",
      "proof": {
        "level": 1,
        "rung": "pattern"
      },
      "confidence": "P2",
      "findingClass": "unfiltered_llm_stream_to_client",
      "metadata": {
        "granularity": "line",
        "deepId": "finding_seceng_ast_1",
        "owasp": [
          "LLM05"
        ],
        "cwe": [
          "CWE-20"
        ],
        "remediation": "Sanitize model output before inserting into HTML sinks. Use DOMPurify or equivalent. Prefer textContent over innerHTML.",
        "references": [
          "https://genai.owasp.org/llm-top-10/",
          "https://cwe.mitre.org/data/definitions/20.html"
        ],
        "role": "application"
      },
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 7,
        "lineEnd": 7,
        "snippet": "const a = streamText({ model: \"m\", tools: tools });",
        "contentSha256": "sha256:a1919e57c0e2166070b3ba899a9652ce4ac53ddb64f3473cc95806ed07b50ba5"
      },
      "fingerprint": "sha256:61dedc32607fae20a29bad35697c505ba7119b6cd124de61de2c63c8f1e01843",
      "gating": false
    },
    {
      "ruleId": "seceng.vercelai.streamtext-tools-without-maxsteps",
      "path": "ai_route.ts",
      "line": 7,
      "column": 13,
      "endLine": 7,
      "endColumn": 53,
      "message": "Vercel AI SDK streamText uses tools without maxSteps. Tool-enabled agents should bound step count to reduce runaway execution.",
      "severity": "WARNING",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "analysis-scope": "file-local",
        "requires_imports": [
          "ai",
          "@ai-sdk/"
        ],
        "assertion": "absence",
        "edge": "grants",
        "owasp_llm": [
          "LLM06",
          "LLM10"
        ],
        "cwe": [
          "CWE-770"
        ],
        "finding_class": "unbounded_ai_tool_steps",
        "confidence": "P2",
        "validation_payload_id": "vercel-ai-maxsteps",
        "exploitability_hint": "reachable_vuln",
        "false_positive_risk": "low",
        "owasp_llm_version": "2025",
        "category": "security",
        "subcategory": "audit",
        "technology": [
          "vercel-ai-sdk"
        ],
        "owasp_agentic": [
          "ASI02",
          "ASI08"
        ],
        "owasp_agentic_basis": "heuristic",
        "audit_review": "keep-audit-warning: Unbounded agent/retry loop or tool-step config missing max_iterations/maxSteps/recursion_limit/max_retries; keyword argument absence is checkable at the call.",
        "deprecated_alias": [
          "seceng.loop.vercel-ai-tools-no-maxsteps"
        ],
        "collapsed": true,
        "role": "application"
      },
      "metavars": {
        "$TOOLS": "tools"
      },
      "snippet": "streamText({ model: \"m\", tools: tools })",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P2",
      "falsePositiveRisk": "low",
      "findingClass": "unbounded_ai_tool_steps",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 1,
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 7,
        "lineEnd": 7,
        "snippet": "const a = streamText({ model: \"m\", tools: tools });",
        "contentSha256": "sha256:a1919e57c0e2166070b3ba899a9652ce4ac53ddb64f3473cc95806ed07b50ba5"
      },
      "fingerprint": "sha256:fc13e77b21d30aeb4ae4c567c976f94f499862ba17baf36d2c4f53638e4089ca",
      "gating": false
    },
    {
      "ruleId": "seceng/model_call_without_token_cap",
      "path": "ai_route.ts",
      "line": 9,
      "column": 1,
      "endLine": 9,
      "endColumn": 1,
      "message": "Model call without token cap.",
      "severity": "WARNING",
      "engine": "seceng",
      "snippet": "LLM10 P1: sink `streamText(` on line 9 appears without a nearby guard",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P0",
      "findingClass": "model_call_without_token_cap",
      "metadata": {
        "granularity": "line",
        "deepId": "finding_seceng_ss_3",
        "owasp": [
          "LLM10"
        ],
        "cwe": [
          "CWE-400"
        ],
        "remediation": "Add max_tokens or max_completion_tokens to all model API calls. Implement a token budget at the agent/orchestration level and abort loops that exceed the cap. Use rate limiting and cost alerts in the gateway layer.",
        "references": [
          "https://genai.owasp.org/llm-top-10/",
          "https://cwe.mitre.org/data/definitions/400.html"
        ],
        "role": "application"
      },
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 9,
        "lineEnd": 9,
        "snippet": "const b = streamText({ model: \"m\", tools: tools, maxSteps: 4 });",
        "contentSha256": "sha256:720b72514c6cc47ff80615c56b8f345553b71d2a48844255c145bb9adb21933b"
      },
      "fingerprint": "sha256:978966efa099e28de94ebe915522a7a35b8dfa09978e91eae1f93975da8bb0da",
      "gating": false
    },
    {
      "ruleId": "seceng/llm10_model_call_without_token_cap",
      "path": "ai_route.ts",
      "line": 11,
      "column": 1,
      "endLine": 11,
      "endColumn": 1,
      "message": "A model call has no output token limit (unbounded consumption).",
      "severity": "WARNING",
      "engine": "seceng",
      "snippet": "LLM10 P1: sink `streamText(` on line 11 appears without a nearby guard",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P0",
      "findingClass": "llm10_model_call_without_token_cap",
      "metadata": {
        "granularity": "line",
        "deepId": "finding_seceng_ss_4",
        "owasp": [
          "LLM10"
        ],
        "cwe": [
          "CWE-400"
        ],
        "remediation": "Add max_tokens or max_completion_tokens to all model API calls. Implement a token budget at the agent/orchestration level and abort loops that exceed the cap. Use rate limiting and cost alerts in the gateway layer.",
        "references": [
          "https://genai.owasp.org/llm-top-10/",
          "https://cwe.mitre.org/data/definitions/400.html"
        ],
        "role": "application"
      },
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 11,
        "lineEnd": 11,
        "snippet": "const c = streamText({ messages: [{ role: \"user\", content: userText }], model: \"m\" });",
        "contentSha256": "sha256:e5dd6b71aefc1cbd0caf658ba1d6cf9a9b9d8a15863f1ec98a0228aaf8dd245c"
      },
      "fingerprint": "sha256:491cf64b5e9bbbf9121473699e5f13afe17ee51dec8c0c568cd85ec5d5fd1c92",
      "gating": false
    },
    {
      "ruleId": "seceng.llm01.vercel-ai-sdk-injection",
      "path": "ai_route.ts",
      "line": 11,
      "column": 13,
      "endLine": 11,
      "endColumn": 88,
      "message": "Vercel AI SDK accepts a user-role prompt. This is an AI input surface, not evidence of a prompt-injection vulnerability.",
      "severity": "INFO",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "edge": "calls",
        "edge_boundary": "user->prompt",
        "owasp_llm": [
          "LLM01"
        ],
        "confidence": "P2",
        "assertion": "capability",
        "claim": "observation",
        "owasp_llm_version": "2025",
        "category": "security",
        "subcategory": "inventory",
        "technology": [
          "vercel-ai-sdk",
          "nextjs"
        ],
        "owasp_agentic": [
          "ASI01"
        ],
        "owasp_agentic_basis": "heuristic",
        "false_positive_risk": "high",
        "finding_class": "ai_user_prompt_surface",
        "role": "application"
      },
      "metavars": {
        "$INPUT": "userText"
      },
      "snippet": "streamText({ messages: [{ role: \"user\", content: userText }], model: \"m\" })",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P2",
      "falsePositiveRisk": "high",
      "findingClass": "ai_user_prompt_surface",
      "subcategory": "inventory",
      "assertion": "capability",
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 11,
        "lineEnd": 11,
        "snippet": "const c = streamText({ messages: [{ role: \"user\", content: userText }], model: \"m\" });",
        "contentSha256": "sha256:e5dd6b71aefc1cbd0caf658ba1d6cf9a9b9d8a15863f1ec98a0228aaf8dd245c"
      },
      "fingerprint": "sha256:263beac442c43d7961bcafbb552f9658d715b969914eee4208402aae8081b4cb",
      "gating": false
    },
    {
      "ruleId": "seceng/agent_file_write_path_traversal",
      "path": "ai_route.ts",
      "line": 13,
      "column": 1,
      "endLine": 13,
      "endColumn": 1,
      "message": "Agent file write path traversal.",
      "severity": "WARNING",
      "engine": "seceng",
      "snippet": "LLM10 P1: sink `client.chat.completions.create(` on line 13 appears without a nearby guard",
      "proof": {
        "level": 1,
        "rung": "pattern"
      },
      "confidence": "P0",
      "findingClass": "agent_file_write_path_traversal",
      "metadata": {
        "granularity": "line",
        "deepId": "finding_seceng_ss_5",
        "owasp": [
          "LLM10"
        ],
        "cwe": [
          "CWE-22",
          "CWE-400",
          "CWE-73"
        ],
        "remediation": "Add max_tokens or max_completion_tokens to all model API calls. Implement a token budget at the agent/orchestration level and abort loops that exceed the cap. Use rate limiting and cost alerts in the gateway layer. Expected controls: canonicalize, allowed_root, path_clean, deny_dotdot, allowlist, human_approval, dry_run, authorization.",
        "references": [
          "https://genai.owasp.org/llm-top-10/",
          "https://cwe.mitre.org/data/definitions/22.html",
          "https://cwe.mitre.org/data/definitions/400.html",
          "https://cwe.mitre.org/data/definitions/73.html"
        ],
        "role": "application"
      },
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 13,
        "lineEnd": 13,
        "snippet": "const d = await client.chat.completions.create({ model: \"x\", messages: [] });",
        "contentSha256": "sha256:873c2c82a4384af30fdbab7f69914de9fc9bc767243ce551702b823573969bd2"
      },
      "fingerprint": "sha256:dc9c0f2dd746743cfa27fe54474754ff1b22d4aa5298163cb64f7263345bd190",
      "gating": false
    },
    {
      "ruleId": "seceng/ai_gateway",
      "path": "ai_route.ts",
      "line": 13,
      "column": 1,
      "endLine": 13,
      "endColumn": 1,
      "message": "AI gateway or model endpoint lacks authorization, tenant scope, or rate limits",
      "severity": "WARNING",
      "engine": "seceng",
      "snippet": "The scan identified a candidate AI gateway control gap. Validation should confirm that identity, authorization, tenant scope, quota, and rate limits are enforced before model invocation.",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "trace": [
        {
          "kind": "source",
          "path": "ai_route.ts",
          "line": 5,
          "column": 1,
          "endLine": 5,
          "endColumn": 1
        }
      ],
      "confidence": "P1",
      "findingClass": "ai_gateway",
      "metadata": {
        "granularity": "line",
        "deepId": "finding_seceng_rulespec_2",
        "owasp": [
          "LLM02",
          "LLM06",
          "LLM10"
        ],
        "remediation": "Add and verify path-relevant controls before the sink: authentication, authorization, tenant_isolation, rate_limit, quota, audit, provider_key_protection.",
        "references": [
          "https://genai.owasp.org/llm-top-10/"
        ],
        "role": "application",
        "severityCap": {
          "from": "ERROR",
          "reason": "inventory"
        }
      },
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 13,
        "lineEnd": 13,
        "snippet": "const d = await client.chat.completions.create({ model: \"x\", messages: [] });",
        "contentSha256": "sha256:873c2c82a4384af30fdbab7f69914de9fc9bc767243ce551702b823573969bd2"
      },
      "fingerprint": "sha256:853c7c897430ebdfc828eb36b7d3cde5848a31fd28581d24383605e5563d9164",
      "gating": false
    },
    {
      "ruleId": "seceng.edge-ai-route-no-rate-limit",
      "path": "ai_route.ts",
      "line": 13,
      "column": 13,
      "endLine": 13,
      "endColumn": 79,
      "message": "Edge AI route/function lacks visible rate limiting around model calls.",
      "severity": "INFO",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "assertion": "absence",
        "edge": "grants",
        "owasp_llm": [
          "LLM10"
        ],
        "cwe": [
          "CWE-770"
        ],
        "finding_class": "edge_ai_missing_rate_limit",
        "confidence": "P1",
        "validation_payload_id": "edge-ai-rate-limit",
        "exploitability_hint": "security_issue",
        "false_positive_risk": "high",
        "owasp_llm_version": "2025",
        "category": "security",
        "subcategory": "audit",
        "technology": [
          "vercel-ai-sdk",
          "netlify"
        ],
        "owasp_agentic": [
          "ASI08"
        ],
        "owasp_agentic_basis": "heuristic",
        "audit_review": "demote-info: Posture hint, rarely actionable: rate-limit/budget/quota hint; usually enforced at gateway/CDN, not visible in file.",
        "collapsed": true,
        "role": "application"
      },
      "metavars": {
        "$CLIENT": "client"
      },
      "snippet": "await client.chat.completions.create({ model: \"x\", messages: [] })",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P1",
      "falsePositiveRisk": "high",
      "findingClass": "edge_ai_missing_rate_limit",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 1,
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 13,
        "lineEnd": 13,
        "snippet": "const d = await client.chat.completions.create({ model: \"x\", messages: [] });",
        "contentSha256": "sha256:873c2c82a4384af30fdbab7f69914de9fc9bc767243ce551702b823573969bd2"
      },
      "fingerprint": "sha256:bdae3dbfa41e88f5cf622a7f06d38b8514c553499ee61dd57fa035d6d8dc939b",
      "gating": false
    },
    {
      "ruleId": "keryn.vendor.openai-call-without-moderation-js",
      "path": "ai_route.ts",
      "line": 13,
      "column": 19,
      "endLine": 13,
      "endColumn": 79,
      "message": "The function that calls this OpenAI generation endpoint never calls moderations.create, so harmful or policy-violating input and output reach the model and your users unscreened. The Moderation endpoint is free; screen user input before the call and model output before it is shown.",
      "severity": "WARNING",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "category": "security",
        "edge": "trusts",
        "subcategory": "audit",
        "assertion": "absence",
        "confidence": "P2",
        "false_positive_risk": "high",
        "finding_class": "vendor_moderation_not_called",
        "cwe": [
          "CWE-1188"
        ],
        "owasp_llm": [
          "LLM01",
          "LLM05"
        ],
        "owasp_llm_version": "2025",
        "technology": [
          "openai"
        ],
        "references": [
          "https://developers.openai.com/api/docs/guides/safety-best-practices",
          "https://developers.openai.com/api/reference/resources/moderations"
        ],
        "remediation": "Call client.moderations.create(input=...) on the user input before this call and on the generated text before returning it, and refuse or fall back when the result is flagged. If moderation runs in shared middleware, suppress this audit there.",
        "collapsed": true,
        "role": "application"
      },
      "metavars": {
        "$C": "client"
      },
      "snippet": "client.chat.completions.create({ model: \"x\", messages: [] })",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P2",
      "falsePositiveRisk": "high",
      "findingClass": "vendor_moderation_not_called",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 2,
      "relatedLocations": [
        {
          "path": "ai_route.ts",
          "line": 15,
          "column": 19,
          "endLine": 15,
          "endColumn": 71
        }
      ],
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 13,
        "lineEnd": 13,
        "snippet": "const d = await client.chat.completions.create({ model: \"x\", messages: [] });",
        "contentSha256": "sha256:873c2c82a4384af30fdbab7f69914de9fc9bc767243ce551702b823573969bd2"
      },
      "fingerprint": "sha256:c385147efdfaeca954133fc9e54ddd85ea55200d7356d2e2d6222a874af6eab4",
      "gating": false
    },
    {
      "ruleId": "keryn.vendor.openai-chat-without-user-identifier-js",
      "path": "ai_route.ts",
      "line": 13,
      "column": 19,
      "endLine": 13,
      "endColumn": 79,
      "message": "The OpenAI call carries neither a user nor a safety_identifier parameter, so OpenAI cannot tell your end users apart. Those fields are what lets the platform act on one abusive end user instead of your whole organisation when policy-violating prompts arrive. Pass safety_identifier (or user on older endpoints) with a hashed end-user id.",
      "severity": "INFO",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "category": "security",
        "edge": "grants",
        "subcategory": "audit",
        "assertion": "absence",
        "confidence": "P2",
        "false_positive_risk": "medium",
        "finding_class": "abuse_identifier_missing",
        "cwe": [
          "CWE-778"
        ],
        "owasp_llm": [
          "LLM10"
        ],
        "owasp_llm_version": "2025",
        "owasp_agentic": [
          "ASI03"
        ],
        "owasp_agentic_basis": "heuristic",
        "technology": [
          "openai"
        ],
        "references": [
          "https://developers.openai.com/api/docs/guides/safety-best-practices",
          "https://developers.openai.com/api/reference/resources/responses/methods/create"
        ],
        "remediation": "Pass safety_identifier: <hashed end-user id> on responses.create and chat.completions.create (user: <hashed id> on endpoints that predate safety_identifier). Hash or tokenise the id; do not send names or emails.",
        "collapsed": true,
        "role": "application"
      },
      "metavars": {
        "$C": "client",
        "$MODEL": "\"x\""
      },
      "snippet": "client.chat.completions.create({ model: \"x\", messages: [] })",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P2",
      "falsePositiveRisk": "medium",
      "findingClass": "abuse_identifier_missing",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 2,
      "relatedLocations": [
        {
          "path": "ai_route.ts",
          "line": 15,
          "column": 19,
          "endLine": 15,
          "endColumn": 71
        }
      ],
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 13,
        "lineEnd": 13,
        "snippet": "const d = await client.chat.completions.create({ model: \"x\", messages: [] });",
        "contentSha256": "sha256:873c2c82a4384af30fdbab7f69914de9fc9bc767243ce551702b823573969bd2"
      },
      "fingerprint": "sha256:1e7069ccb20391ce9257c6ffaa94198665b6826cde4cc1adca00ad84c4f56b1b",
      "gating": false
    },
    {
      "ruleId": "seceng.llm10.openai-call-without-max-tokens",
      "path": "ai_route.ts",
      "line": 13,
      "column": 19,
      "endLine": 13,
      "endColumn": 79,
      "message": "Model call appears to lack max token budget. Confirm bounded output and request budgeting.",
      "severity": "WARNING",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "assertion": "absence",
        "edge": "grants",
        "owasp_llm": [
          "LLM10"
        ],
        "cwe": [
          "CWE-400"
        ],
        "finding_class": "token_budget_missing",
        "confidence": "P1",
        "owasp_llm_version": "2025",
        "category": "security",
        "subcategory": "audit",
        "technology": [
          "openai"
        ],
        "owasp_agentic": [
          "ASI03",
          "ASI08"
        ],
        "owasp_agentic_basis": "heuristic",
        "audit_review": "keep-audit-warning: LLM call with no max_tokens; classic checkable absence at the call site.",
        "collapsed": true,
        "role": "application"
      },
      "metavars": {
        "$CLIENT": "client",
        "$ARGS": "{ model: \"x\", messages: [] }"
      },
      "snippet": "client.chat.completions.create({ model: \"x\", messages: [] })",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P1",
      "findingClass": "token_budget_missing",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 2,
      "relatedLocations": [
        {
          "path": "ai_route.ts",
          "line": 15,
          "column": 19,
          "endLine": 15,
          "endColumn": 71
        }
      ],
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 13,
        "lineEnd": 13,
        "snippet": "const d = await client.chat.completions.create({ model: \"x\", messages: [] });",
        "contentSha256": "sha256:873c2c82a4384af30fdbab7f69914de9fc9bc767243ce551702b823573969bd2"
      },
      "fingerprint": "sha256:e020970d6c3d8dd58aeb99a632cc96c3e8b7487ff6314119c876183ac82c449b",
      "gating": false
    },
    {
      "ruleId": "seceng/agent_file_write_path_traversal",
      "path": "ai_route.ts",
      "line": 15,
      "column": 1,
      "endLine": 15,
      "endColumn": 1,
      "message": "Agent file write path traversal.",
      "severity": "WARNING",
      "engine": "seceng",
      "snippet": "LLM10 P1: sink `client.responses.create(` on line 15 appears without a nearby guard",
      "proof": {
        "level": 1,
        "rung": "pattern"
      },
      "confidence": "P0",
      "findingClass": "agent_file_write_path_traversal",
      "metadata": {
        "granularity": "line",
        "deepId": "finding_seceng_ss_6",
        "owasp": [
          "LLM10"
        ],
        "cwe": [
          "CWE-22",
          "CWE-400",
          "CWE-73"
        ],
        "remediation": "Add max_tokens or max_completion_tokens to all model API calls. Implement a token budget at the agent/orchestration level and abort loops that exceed the cap. Use rate limiting and cost alerts in the gateway layer. Expected controls: canonicalize, allowed_root, path_clean, deny_dotdot, allowlist, human_approval, dry_run, authorization.",
        "references": [
          "https://genai.owasp.org/llm-top-10/",
          "https://cwe.mitre.org/data/definitions/22.html",
          "https://cwe.mitre.org/data/definitions/400.html",
          "https://cwe.mitre.org/data/definitions/73.html"
        ],
        "role": "application"
      },
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 15,
        "lineEnd": 15,
        "snippet": "const e = await client.responses.create({ model: \"x\", input: \"hi\" });",
        "contentSha256": "sha256:9fa6774135fea84d9335342594d081be28c0183c86ac325f10b8f394be0620c2"
      },
      "fingerprint": "sha256:91da11f4316f3023693b361fa2e473fe0f36452ab04c08d15e48c32f9022009b",
      "gating": false
    },
    {
      "ruleId": "seceng/llm10_model_call_without_token_cap",
      "path": "ai_route.ts",
      "line": 23,
      "column": 1,
      "endLine": 23,
      "endColumn": 1,
      "message": "A model call has no output token limit (unbounded consumption).",
      "severity": "WARNING",
      "engine": "seceng",
      "snippet": "LLM10 P1: sink `model.generate(` on line 23 appears without a nearby guard",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P0",
      "findingClass": "llm10_model_call_without_token_cap",
      "metadata": {
        "granularity": "line",
        "deepId": "finding_seceng_ss_7",
        "owasp": [
          "LLM10"
        ],
        "cwe": [
          "CWE-400"
        ],
        "remediation": "Add max_tokens or max_completion_tokens to all model API calls. Implement a token budget at the agent/orchestration level and abort loops that exceed the cap. Use rate limiting and cost alerts in the gateway layer.",
        "references": [
          "https://genai.owasp.org/llm-top-10/",
          "https://cwe.mitre.org/data/definitions/400.html"
        ],
        "role": "application"
      },
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 23,
        "lineEnd": 23,
        "snippet": "model.generate(step);",
        "contentSha256": "sha256:0fb493d52d8e05bbe87385ec471662927f7ac599d96929d22a9abbdec7359595"
      },
      "fingerprint": "sha256:4a81f370440b7b6722b9b9e773390fde6745fab156b7917df54bbcd0f8661d88",
      "gating": false
    },
    {
      "ruleId": "seceng.llm06.dangerous-tool-without-obvious-approval",
      "path": "ai_route.ts",
      "line": 29,
      "column": 17,
      "endLine": 29,
      "endColumn": 76,
      "message": "Tool definition exposes a side-effecting capability. Confirm human approval, RBAC, tenant scoping, and audit logging.",
      "severity": "INFO",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "assertion": "absence",
        "edge": "grants",
        "owasp_llm": [
          "LLM06"
        ],
        "cwe": [
          "CWE-285",
          "CWE-862"
        ],
        "finding_class": "agent_tool_without_approval",
        "confidence": "P1",
        "owasp_llm_version": "2025",
        "category": "security",
        "subcategory": "audit",
        "technology": [
          "llm06-agent-tool-approval"
        ],
        "owasp_agentic": [
          "ASI03",
          "ASI02"
        ],
        "owasp_agentic_basis": "heuristic",
        "audit_review": "demote-info: Posture hint, rarely actionable: unenforceable \"no visible approval/policy/validation\" across scope; high FP, fix not local.",
        "collapsed": true,
        "role": "application"
      },
      "metavars": {
        "$FUNC": "{ description: \"send email\", execute: async () => 1 }"
      },
      "snippet": "tool({ description: \"send email\", execute: async () => 1 })",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P1",
      "findingClass": "agent_tool_without_approval",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 1,
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 29,
        "lineEnd": 29,
        "snippet": "const toolDef = tool({ description: \"send email\", execute: async () => 1 });",
        "contentSha256": "sha256:e46be07a84c4d8743b2e1d366385422b6f7f17bedef858b68e72ab7f747d915e"
      },
      "fingerprint": "sha256:72317894b6265620478b440c1aebd135f4ff7028442370340f765640b55196b5",
      "gating": false
    },
    {
      "ruleId": "seceng.toolauth.audit-missing-for-dangerous-tool",
      "path": "ai_route.ts",
      "line": 29,
      "column": 51,
      "endLine": 29,
      "endColumn": 58,
      "message": "Dangerous tool/action lacks visible audit event with user, tenant, resource, and action context.",
      "severity": "INFO",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "assertion": "absence",
        "edge": "calls",
        "owasp_llm": [
          "LLM06",
          "LLM07"
        ],
        "nist_ai_rmf": [
          "GOVERN",
          "MEASURE",
          "MANAGE"
        ],
        "cwe": [
          "CWE-778"
        ],
        "finding_class": "dangerous_tool_missing_audit",
        "confidence": "P1",
        "validation_payload_id": "tool-audit-coverage",
        "exploitability_hint": "security_issue",
        "false_positive_risk": "high",
        "owasp_llm_version": "2025",
        "category": "security",
        "subcategory": "audit",
        "technology": [
          "tool-authorization-policy"
        ],
        "owasp_agentic": [
          "ASI03",
          "ASI02"
        ],
        "owasp_agentic_basis": "heuristic",
        "audit_review": "demote-info: Posture hint, rarely actionable: logging/forensic/correlation posture; not a code defect, not locatable.",
        "collapsed": true,
        "role": "application"
      },
      "snippet": "execute",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P1",
      "falsePositiveRisk": "high",
      "findingClass": "dangerous_tool_missing_audit",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 1,
      "role": "application",
      "evidence": {
        "path": "ai_route.ts",
        "lineStart": 29,
        "lineEnd": 29,
        "snippet": "const toolDef = tool({ description: \"send email\", execute: async () => 1 });",
        "contentSha256": "sha256:e46be07a84c4d8743b2e1d366385422b6f7f17bedef858b68e72ab7f747d915e"
      },
      "fingerprint": "sha256:80dacd5a3c180db9b53195207a043158638a4332fb6dfd683819083da47cb4c9",
      "gating": false
    },
    {
      "ruleId": "vulnfix-ai-ai_js_dangerous_html",
      "path": "ui.tsx",
      "line": 6,
      "column": 13,
      "endLine": 6,
      "endColumn": 63,
      "message": "CWE-79 (insecure-output-handling): Renders raw HTML in React; if it carries LLM/markdown/user output, sanitize (DOMPurify).",
      "severity": "ERROR",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "source": "vulnfix-mine",
        "edge": "calls",
        "edge_boundary": "model->code",
        "pack": "ai-security",
        "cwe": [
          "CWE-79"
        ],
        "ai_category": "insecure-output-handling",
        "owasp_llm": [
          "LLM05"
        ],
        "basis": "known",
        "confidence": "P1",
        "owasp_llm_version": "2025",
        "assertion": "presence",
        "category": "security",
        "subcategory": "vuln",
        "confidence_note": "AI-security consensus dangerous pattern",
        "technology": [
          "react"
        ],
        "owasp_agentic": [
          "ASI05"
        ],
        "owasp_agentic_basis": "reviewed",
        "deprecated_alias": [
          "vulnfix-ai-ts_ai_dangerous_html"
        ],
        "false_positive_risk": "medium",
        "finding_class": "model_output_xss",
        "deep_check": "path",
        "deep_finding": "finding_seceng_57bd403bc17f_ir2",
        "merged": [
          {
            "ruleId": "vulnfix-ai-ai_js_dangerous_html",
            "line": 8,
            "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
            "proof": 2,
            "column": 13,
            "endLine": 8,
            "endColumn": 83,
            "severity": "ERROR",
            "message": "CWE-79 (insecure-output-handling): Renders raw HTML in React; if it carries LLM/markdown/user output, sanitize (DOMPurify).",
            "fingerprint": "sha256:1f5d9bd8e498a18222c1053d1a5b3da000c0e6a3dbc7648f04d0b6895f96d9e0"
          },
          {
            "ruleId": "seceng.llm05.react-dangerously-set-inner-html",
            "line": 6,
            "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
            "proof": 2,
            "column": 13,
            "endLine": 6,
            "endColumn": 63,
            "severity": "WARNING",
            "message": "Model-controlled, retrieved, or tool-controlled content may be rendered through dangerouslySetInnerHTML. Confirm whether the source is trusted and sanitized.",
            "fingerprint": "sha256:6418ae2b1b6a46e42c0bc7b68f97fc0ed551f7a88f87ad4ed6a696482b5edd07"
          },
          {
            "ruleId": "seceng.llm04.model-output-xss-js",
            "line": 10,
            "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
            "proof": 2,
            "column": 3,
            "endLine": 10,
            "endColumn": 22,
            "severity": "WARNING",
            "message": "Model-generated output is assigned to a dangerous HTML sink. This allows the model to perform Cross-Site Scripting (XSS).",
            "fingerprint": "sha256:b84a9fbfa1394e9596a7a39cb59c25c46ae765343aa74acf54478356254e03d7"
          },
          {
            "ruleId": "seceng.llm05.inner-html-assignment",
            "line": 10,
            "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
            "proof": 2,
            "column": 3,
            "endLine": 10,
            "endColumn": 22,
            "severity": "WARNING",
            "message": "Assignment to innerHTML or outerHTML may render model, retrieved, or tool output as executable HTML. Confirm sanitizer use and source trust.",
            "fingerprint": "sha256:01bc58b056d17e4030298c991a8c3cd3fa07bba27c493487e5634fc96c37cce7"
          },
          {
            "ruleId": "seceng.llm05.react-dangerously-set-inner-html-unprotected",
            "line": 6,
            "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
            "proof": 2,
            "column": 13,
            "endLine": 6,
            "endColumn": 63,
            "severity": "WARNING",
            "message": "LLM output rendered via dangerouslySetInnerHTML without DOMPurify. High XSS risk.",
            "fingerprint": "sha256:004f18f8a3b3ede9421b4641cd61155807618e213097866798b5a3dcfda007ba"
          },
          {
            "ruleId": "seceng/html_render",
            "line": 8,
            "engine": "seceng",
            "proof": 2,
            "column": 1,
            "endLine": 8,
            "endColumn": 1,
            "severity": "WARNING",
            "message": "Untrusted input reaches HTML rendered in the page (cross-site scripting).",
            "fingerprint": "sha256:fb1415ad090d308d089c3fea217079a8616594378039ab96baea1bd7e6935c71"
          }
        ],
        "role": "application"
      },
      "metavars": {
        "$C": "div"
      },
      "snippet": "<div dangerouslySetInnerHTML={{ __html: html }} />",
      "proof": {
        "level": 2,
        "rung": "path-in-file"
      },
      "confidence": "P1",
      "falsePositiveRisk": "medium",
      "findingClass": "model_output_xss",
      "subcategory": "vuln",
      "assertion": "presence",
      "trace": [
        {
          "kind": "source",
          "path": "ui.tsx",
          "line": 4,
          "column": 1,
          "endLine": 4,
          "endColumn": 1,
          "text": "html"
        }
      ],
      "alsoMatched": [
        "seceng.llm04.model-output-xss-js",
        "seceng.llm05.inner-html-assignment",
        "seceng.llm05.react-dangerously-set-inner-html",
        "seceng.llm05.react-dangerously-set-inner-html-unprotected",
        "seceng/html_render"
      ],
      "relatedLocations": [
        {
          "path": "ui.tsx",
          "line": 8,
          "column": 13,
          "endLine": 8,
          "endColumn": 83,
          "message": "vulnfix-ai-ai_js_dangerous_html"
        },
        {
          "path": "ui.tsx",
          "line": 10,
          "column": 3,
          "endLine": 10,
          "endColumn": 22,
          "message": "seceng.llm04.model-output-xss-js"
        }
      ],
      "role": "application",
      "evidence": {
        "path": "ui.tsx",
        "lineStart": 6,
        "lineEnd": 6,
        "snippet": "const a = <div dangerouslySetInnerHTML={{ __html: html }} />;",
        "contentSha256": "sha256:6d952aaac59141589925b481a1e195c7c036af3ae4035428414b186657666f6c"
      },
      "fingerprint": "sha256:fda094fae25a9c9150d9e993ce89bd34d70f35cc6f73a63ca3ace11908e79eac"
    },
    {
      "ruleId": "seceng.llm05.inner-html-assignment",
      "path": "ui.tsx",
      "line": 14,
      "column": 3,
      "endLine": 14,
      "endColumn": 43,
      "message": "Assignment to innerHTML or outerHTML may render model, retrieved, or tool output as executable HTML. Confirm sanitizer use and source trust.",
      "severity": "WARNING",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "remediation": "Use textContent for plain text. If rich HTML is required, sanitize it before assigning it to innerHTML or outerHTML.",
        "references": [
          "https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#security_considerations"
        ],
        "assertion": "presence",
        "edge": "calls",
        "edge_boundary": "model->code",
        "claim": "violation",
        "owasp_llm": [
          "LLM05"
        ],
        "cwe": [
          "CWE-79"
        ],
        "finding_class": "unsafe_html_rendering",
        "confidence": "P1",
        "owasp_llm_version": "2025",
        "category": "security",
        "subcategory": "vuln",
        "technology": [
          "llm05-output-to-html"
        ],
        "owasp_agentic": [
          "ASI05"
        ],
        "owasp_agentic_basis": "reviewed",
        "false_positive_risk": "medium",
        "deep_check": "path",
        "deep_finding": "finding_seceng_0fa677159165_ir0",
        "merged": [
          {
            "ruleId": "seceng/html_render",
            "line": 14,
            "engine": "seceng",
            "proof": 2,
            "column": 1,
            "endLine": 14,
            "endColumn": 1,
            "severity": "WARNING",
            "message": "Untrusted input reaches HTML rendered in the page (cross-site scripting).",
            "fingerprint": "sha256:9eaeca369de9c5d27ced37e865e11eaf1be1574d3929593707279d7477fbbd77"
          }
        ],
        "role": "application"
      },
      "metavars": {
        "$EL": "el",
        "$POS": "\"beforeend\"",
        "$VALUE": "html"
      },
      "snippet": "el.insertAdjacentHTML(\"beforeend\", html)",
      "proof": {
        "level": 2,
        "rung": "path-in-file"
      },
      "confidence": "P1",
      "falsePositiveRisk": "medium",
      "findingClass": "unsafe_html_rendering",
      "subcategory": "vuln",
      "assertion": "presence",
      "trace": [
        {
          "kind": "source",
          "path": "ui.tsx",
          "line": 4,
          "column": 1,
          "endLine": 4,
          "endColumn": 1,
          "text": "html"
        }
      ],
      "alsoMatched": [
        "seceng/html_render"
      ],
      "role": "application",
      "evidence": {
        "path": "ui.tsx",
        "lineStart": 14,
        "lineEnd": 14,
        "snippet": "el.insertAdjacentHTML(\"beforeend\", html);",
        "contentSha256": "sha256:327905f3f754c591eda920e160fa9663550ec1b7940f13f3ecd2043d5ea2ae0c"
      },
      "fingerprint": "sha256:f1c13928590c3148d0894548d457817226c49e42510b9efdaf77ddd9f6811a08"
    },
    {
      "ruleId": "seceng.llm05.marked-html-enabled",
      "path": "ui.tsx",
      "line": 16,
      "column": 3,
      "endLine": 16,
      "endColumn": 52,
      "message": "Markdown rendering appears to allow raw HTML. If model or retrieved content reaches this renderer, this can become XSS.",
      "severity": "WARNING",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "remediation": "Sanitize the HTML produced by Marked before inserting it into the document. Apply the sanitizer after Markdown rendering so it also checks the markup emitted by the renderer.",
        "references": [
          "https://marked.js.org/#usage"
        ],
        "assertion": "presence",
        "edge": "writes",
        "claim": "violation",
        "owasp_llm": [
          "LLM05"
        ],
        "cwe": [
          "CWE-79"
        ],
        "finding_class": "unsafe_markdown_rendering",
        "confidence": "P1",
        "owasp_llm_version": "2025",
        "category": "security",
        "subcategory": "vuln",
        "technology": [
          "llm05-output-to-html"
        ],
        "owasp_agentic": [
          "ASI06"
        ],
        "owasp_agentic_basis": "heuristic",
        "false_positive_risk": "medium",
        "deep_check": "no-path",
        "role": "application"
      },
      "snippet": "marked.setOptions({ gfm: true, sanitize: false })",
      "proof": {
        "level": 1,
        "rung": "pattern"
      },
      "confidence": "P1",
      "falsePositiveRisk": "medium",
      "findingClass": "unsafe_markdown_rendering",
      "subcategory": "vuln",
      "assertion": "presence",
      "role": "application",
      "evidence": {
        "path": "ui.tsx",
        "lineStart": 16,
        "lineEnd": 16,
        "snippet": "marked.setOptions({ gfm: true, sanitize: false });",
        "contentSha256": "sha256:aea9c5c9421fb2d13a81087dd04df11584167420d1d855ab8342202420988118"
      },
      "fingerprint": "sha256:ff5a126e19946add5d2f52e4b33ab881325fafb7e7342ad075850a19dfc26092",
      "gating": false
    },
    {
      "ruleId": "seceng.llm05.inner-html-assignment",
      "path": "ui.tsx",
      "line": 18,
      "column": 3,
      "endLine": 18,
      "endColumn": 42,
      "message": "Assignment to innerHTML or outerHTML may render model, retrieved, or tool output as executable HTML. Confirm sanitizer use and source trust.",
      "severity": "WARNING",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "remediation": "Use textContent for plain text. If rich HTML is required, sanitize it before assigning it to innerHTML or outerHTML.",
        "references": [
          "https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML#security_considerations"
        ],
        "assertion": "presence",
        "edge": "calls",
        "edge_boundary": "model->code",
        "claim": "violation",
        "owasp_llm": [
          "LLM05"
        ],
        "cwe": [
          "CWE-79"
        ],
        "finding_class": "unsafe_html_rendering",
        "confidence": "P1",
        "owasp_llm_version": "2025",
        "category": "security",
        "subcategory": "vuln",
        "technology": [
          "llm05-output-to-html"
        ],
        "owasp_agentic": [
          "ASI05"
        ],
        "owasp_agentic_basis": "reviewed",
        "false_positive_risk": "medium",
        "deep_check": "path",
        "deep_finding": "finding_seceng_a18f5e018c1a_ir1",
        "merged": [
          {
            "ruleId": "seceng/html_render",
            "line": 18,
            "engine": "seceng",
            "proof": 2,
            "column": 1,
            "endLine": 18,
            "endColumn": 1,
            "severity": "WARNING",
            "message": "Untrusted input reaches HTML rendered in the page (cross-site scripting).",
            "fingerprint": "sha256:6a961465c7a424db02b706eb8735c1d2a34cc66926f371fcbbcf294ee9d50bc4"
          }
        ],
        "role": "application"
      },
      "metavars": {
        "$EL": "el",
        "$VALUE": "DOMPurify.sanitize(html)"
      },
      "snippet": "el.innerHTML = DOMPurify.sanitize(html)",
      "proof": {
        "level": 2,
        "rung": "path-in-file"
      },
      "confidence": "P1",
      "falsePositiveRisk": "medium",
      "findingClass": "unsafe_html_rendering",
      "subcategory": "vuln",
      "assertion": "presence",
      "trace": [
        {
          "kind": "source",
          "path": "ui.tsx",
          "line": 4,
          "column": 1,
          "endLine": 4,
          "endColumn": 1,
          "text": "html"
        }
      ],
      "alsoMatched": [
        "seceng/html_render"
      ],
      "role": "application",
      "evidence": {
        "path": "ui.tsx",
        "lineStart": 18,
        "lineEnd": 18,
        "snippet": "el.innerHTML = DOMPurify.sanitize(html);",
        "contentSha256": "sha256:4948523e28345e1926805e8ce194ac5a28e2ccb7c269c697160f2e13442b0694"
      },
      "fingerprint": "sha256:f427b43820db7ba61aeafb03a9295b0d70e406061d9b69e298f05acd664ad793"
    },
    {
      "ruleId": "seceng.mcp.ts.sse-transport-no-origin-validation",
      "path": "ui.tsx",
      "line": 21,
      "column": 13,
      "endLine": 21,
      "endColumn": 43,
      "message": "SSEServerTransport is created without enableDnsRebindingProtection, so no Origin/Host validation happens, and the legacy HTTP+SSE transport is deprecated. Any web page can open the SSE stream on a local server.",
      "severity": "WARNING",
      "engine": "keryn-engine/0.1.1 (tree-sitter-wasm, semgrep-compatible subset)",
      "metadata": {
        "category": "security",
        "edge": "reaches",
        "edge_boundary": "user->prompt",
        "subcategory": "audit",
        "assertion": "absence",
        "confidence": "P2",
        "false_positive_risk": "medium",
        "finding_class": "mcp_transport_exposure",
        "cwe": [
          "CWE-346",
          "CWE-1327"
        ],
        "owasp_llm": [
          "LLM06"
        ],
        "owasp_llm_version": "2025",
        "owasp_agentic": [
          "ASI07"
        ],
        "owasp_agentic_basis": "reviewed",
        "technology": [
          "mcp",
          "typescript",
          "nodejs"
        ],
        "references": [
          "https://github.com/modelcontextprotocol/typescript-sdk",
          "https://modelcontextprotocol.io/specification/2025-06-18/basic/transports"
        ],
        "remediation": "Migrate to Streamable HTTP, or pass { enableDnsRebindingProtection: true, allowedHosts, allowedOrigins } as the third constructor argument and require authentication.",
        "collapsed": true,
        "role": "application"
      },
      "snippet": "new SSEServerTransport(\"/sse\")",
      "proof": {
        "level": 0,
        "rung": "inventory"
      },
      "confidence": "P2",
      "falsePositiveRisk": "medium",
      "findingClass": "mcp_transport_exposure",
      "subcategory": "audit",
      "assertion": "absence",
      "occurrences": 1,
      "role": "application",
      "evidence": {
        "path": "ui.tsx",
        "lineStart": 21,
        "lineEnd": 21,
        "snippet": "const sse = new SSEServerTransport(\"/sse\");",
        "contentSha256": "sha256:1c5f32979cb8a68b07b640241efe077132cb877fb7def8aa948099c5e459d1fb"
      },
      "fingerprint": "sha256:02965527d17b186658fafeb4d1960d934f2392133eaad6bed2779a0fa5e7be99",
      "gating": false
    }
  ],
  "nday": {
    "signatures": 3156,
    "schemaVersion": 1,
    "generated": "2026-10-09",
    "filesChecked": 3,
    "matches": 0,
    "versionPatched": 0,
    "raised": 0,
    "standalone": 0
  },
  "gate": {
    "exitCode": 0,
    "reasons": [],
    "counts": {
      "failing": 0,
      "warnings": 3
    }
  }
}
