AI security rules and dataflow analysis
CodeStax checks the AI code and configuration in your repositories against a catalogue of 45 rules: 13 rules for LLM applications and agents (AIASM-LLM*) and 32 rules for Model Context Protocol (MCP) clients, servers and packages (AIASM-MCP-*). Every rule maps to a category of the OWASP Top 10 for LLM Applications 2025.
This page is the rule reference. For the inventory, BOM, triage, approval and policy workflows that consume these findings, see AI Attack Surface Management.
The rules run during Smart and Deep repository scans. Analysis is static: CodeStax reads source, configuration and published package archives, and never runs repository or package code.
How a finding is decided
Every finding records how it was decided. The dashboard shows this as a tag under the confidence value, so you can tell a proven path from an inference before you act on it.
| Tag in the dashboard | Method | What it means |
|---|---|---|
| Dataflow proven | dataflow | Taint analysis traced a path from an untrusted or model-derived source to the sink. The evidence names the line where the tainted value enters. |
| Pattern match | pattern | The exact shape of one call or declaration is the defect, for example an agent built with a shell tool. |
| From configuration | configuration | Read directly from a declared MCP client configuration file. |
| From manifest | manifest | Read from a dependency manifest or from public advisory data for a resolved package version. |
| Inferred | heuristic | Inferred from surrounding code. Confirm before acting. |
The method is also returned as analysis_method on each finding from the AI Attack Surface API. The Overview tab of AI Attack Surface shows a Dataflow-proven count: findings where a source-to-sink path was traced rather than inferred from nearby code.
Rules confirmed by dataflow analysis
Twelve rules are owned by the dataflow engine. When the engine runs, CodeStax reports these rules only from the engine’s results and does not also emit the heuristic version, so a proven finding is never duplicated by a weaker guess.
| Rule | Method | Python | JavaScript / TypeScript | Go | Java |
|---|---|---|---|---|---|
AIASM-LLM01-001 untrusted input reaches a prompt | Dataflow | Yes | Yes | Yes | Yes |
AIASM-LLM02-001 sensitive data reaches a provider call | Dataflow | Yes | Yes | Yes | Yes |
AIASM-LLM04-001 untrusted content reaches retrieval or training | Dataflow | Yes | Yes | Not yet | Not yet |
AIASM-LLM05-001 model output reaches a dangerous sink | Dataflow | Yes | Yes | Yes | Yes |
AIASM-LLM06-001 agent with excessive tool authority | Pattern | Yes | Yes | Not yet | Not yet |
AIASM-LLM06-002 agent given an unrestricted execution tool | Pattern | Yes | Yes | Not yet | Not yet |
AIASM-LLM08-001 vector retrieval without tenant isolation | Pattern | Yes | Yes | Not yet | Not yet |
AIASM-LLM10-001 AI call without resource bounds | Pattern | Yes | Yes | Yes | Yes |
AIASM-MCP-007 model-supplied argument reaches command execution | Dataflow | Yes | Yes | Not yet | Not yet |
AIASM-MCP-008 model-supplied path reaches the filesystem | Dataflow | Yes | Yes | Not yet | Not yet |
AIASM-MCP-017 model-supplied URL reaches an outbound request | Dataflow | Yes | Yes | Not yet | Not yet |
AIASM-MCP-018 model-supplied value reaches a database query | Dataflow | Yes | Yes | Not yet | Not yet |
Not yet means the Go or Java rule pack does not cover that rule today. In a run where the dataflow engine completes, those rules are not reported for Go and Java files. Do not read the absence of an AIASM-LLM04-001, AIASM-LLM06-*, AIASM-LLM08-001 or AIASM-MCP-007/008/017/018 finding in Go or Java code as evidence that the risk is absent.
When dataflow analysis is unavailable
If the dataflow engine cannot run for a scan, the run records that dataflow was unavailable and the twelve rules above fall back to their heuristic versions. Those findings carry the Inferred tag, not Dataflow proven, so an unverified result is never presented as a proven one. A repository with no AI-bearing files needs no dataflow analysis and is treated as complete.
An unavailable dataflow engine weakens the evidence but does not mark the run’s file coverage as partial. See coverage and freshness.
Findings in test files
Findings in test paths keep their rule ID but are reported at info severity, so a deliberately vulnerable fixture does not count as a critical or high finding.
LLM application rules
| Rule | Title | Default severity | OWASP | Decided by |
|---|---|---|---|---|
AIASM-LLM01-001 | Untrusted input may reach an AI prompt | High | LLM01 Prompt injection | Dataflow |
AIASM-LLM02-001 | Sensitive data may be sent to an AI provider | High | LLM02 Sensitive information disclosure | Dataflow |
AIASM-LLM03-001 | AI dependency is not version pinned | Medium | LLM03 Supply chain | Manifest |
AIASM-LLM03-002 | Model identifier is not revision pinned | Low | LLM03 Supply chain | Model reference in code |
AIASM-LLM04-001 | Untrusted content may enter a retrieval or training pipeline | High | LLM04 Data and model poisoning | Dataflow |
AIASM-LLM05-001 | Model output may reach a dangerous sink | Critical | LLM05 Improper output handling | Dataflow |
AIASM-LLM06-001 | Agent may have excessive tool authority | High | LLM06 Excessive agency | Pattern |
AIASM-LLM06-002 | Agent is given an unrestricted execution tool | Critical | LLM06 Excessive agency | Pattern |
AIASM-LLM07-001 | System prompt may be exposed to clients | Medium | LLM07 System prompt leakage | Inferred |
AIASM-LLM08-001 | Vector retrieval may lack tenant isolation | High | LLM08 Vector and embedding weaknesses | Pattern |
AIASM-LLM09-001 | Model output may drive a trusted decision without validation | Medium | LLM09 Misinformation | Inferred |
AIASM-LLM10-001 | AI invocation lacks visible resource bounds | Medium | LLM10 Unbounded consumption | Pattern |
AIASM-LLM10-002 | Agent loop has no iteration or budget bound | Medium | LLM10 Unbounded consumption | Inferred |
AIASM-LLM06-002 fires when an agent is equipped with a shell, code-interpreter, terminal or arbitrary-execution tool. A prompt injection or model error then becomes code execution with the agent’s privileges. Replace general execution tools with narrowly scoped operations, sandbox any execution that remains, and require approval before it runs.
AIASM-LLM10-002 fires on a loop that calls the model repeatedly with no visible iteration limit, budget, deadline or counted exit. Bound every agent loop with a maximum number of iterations, a token or cost budget and a wall-clock deadline.
MCP rules
MCP rules are checked in three places. See Review Model Context Protocol servers for the supported client configuration files and SDKs.
Client configuration
| Rule | Title | Default severity | OWASP |
|---|---|---|---|
AIASM-MCP-001 | MCP server is not version pinned | High | LLM03 |
AIASM-MCP-002 | MCP server installs unreviewed code at launch | High | LLM03 |
AIASM-MCP-003 | Credential is passed through to an MCP server | High | LLM06 |
AIASM-MCP-004 | MCP server uses an unencrypted transport | High | LLM06 |
AIASM-MCP-005 | Remote MCP server has no declared authentication | High | LLM06 |
AIASM-MCP-010 | MCP client auto-approves tool calls | Critical | LLM06 |
AIASM-MCP-011 | MCP server is loaded from an unpinned remote source | Medium | LLM03 |
AIASM-MCP-013 | MCP configuration contains an inline credential | Critical | LLM06 |
AIASM-MCP-015 | MCP server runs with excessive host privilege | High | LLM06 |
AIASM-MCP-021 | TLS verification is disabled on an MCP transport | High | LLM06 |
Configuration findings carry the From configuration tag. Inline credential values are redacted in the evidence. AIASM-MCP-021 is also reported from server code that disables certificate verification.
Server code in your repository
| Rule | Title | Default severity | OWASP |
|---|---|---|---|
AIASM-MCP-006 | MCP tool description contains model-directed instructions | Critical | LLM01 |
AIASM-MCP-007 | MCP tool exposes command execution to the model | Critical | LLM05 |
AIASM-MCP-008 | MCP tool exposes unrestricted filesystem access | High | LLM06 |
AIASM-MCP-009 | Consequential MCP tool has no approval step | High | LLM06 |
AIASM-MCP-012 | MCP tool returns untrusted content without provenance | Medium | LLM01 |
AIASM-MCP-014 | MCP sampling or elicitation is enabled without bounds | Medium | LLM10 |
AIASM-MCP-016 | Network MCP transport has no origin validation | High | LLM06 |
AIASM-MCP-017 | Model-supplied URL reaches an outbound request | High | LLM06 |
AIASM-MCP-018 | Model-supplied value reaches a database query | Critical | LLM05 |
AIASM-MCP-019 | Client credential is forwarded to an upstream API | High | LLM06 |
AIASM-MCP-020 | MCP tool accepts unvalidated input | Medium | LLM01 |
AIASM-MCP-022 | MCP session identifier is weak or exposed | Medium | LLM06 |
AIASM-MCP-023 | MCP resource, prompt or instructions carry model-directed text | Critical | LLM01 |
AIASM-MCP-024 | MCP tools are registered from fetched content | High | LLM03 |
AIASM-MCP-025 | MCP tool arguments or credentials are logged | Medium | LLM02 |
AIASM-MCP-026 | MCP server accepts tokens without signature or audience validation | High | LLM06 |
AIASM-MCP-027 | MCP elicitation requests sensitive information | High | LLM02 |
AIASM-MCP-028 | MCP tool annotations contradict the handler | Medium | LLM06 |
AIASM-MCP-029 | Network-exposed MCP server has no authentication | High | LLM06 |
AIASM-MCP-007, AIASM-MCP-008, AIASM-MCP-017 and AIASM-MCP-018 are dataflow rules: a finding means a model-supplied tool argument was traced to the sink. The remaining server-code rules are decided by pattern matching or inference and carry the matching tag.
Published packages that a configuration launches
| Rule | Title | Default severity | OWASP |
|---|---|---|---|
AIASM-MCP-030 | Declared MCP server package runs install-time scripts | Medium | LLM03 |
AIASM-MCP-031 | Declared MCP server package has known vulnerabilities | High | LLM03 |
AIASM-MCP-032 | Declared MCP server package could not be verified | Medium | LLM03 |
AIASM-MCP-031 uses the advisory’s own severity when one is published.
Third-party MCP package inspection
A configuration such as npx -y some-server or uvx some-server tells the model’s host to download and run third-party code. CodeStax inspects that code without running it.
-
Resolve the package. Launch commands are mapped to a registry package:
- npm:
npx,bunx,pnpx,pnpm dlx,yarn dlx,npm exec,npm x,bun x - PyPI:
uvx,uv tool run,pipx run
Servers launched from a local path, a container image or a shell wrapper are not registry packages and are not inspected.
- npm:
-
Download and verify. CodeStax fetches the pinned version, or the version the registry currently resolves when the configuration is unpinned (which is itself reported by
AIASM-MCP-001). It checks the archive against the registry’s published integrity digest. A digest mismatch or a version that does not exist is reported asAIASM-MCP-032. -
Read without executing. The archive is opened file by file. No package manager, install script or package code runs. Archive entries with absolute paths,
..segments, links or device files are rejected, and downloads and extraction are size-capped. -
Check the contents. The server-code rules above run over the package, plus install-time scripts (
AIASM-MCP-030) and published advisories for the resolved version (AIASM-MCP-031).
Findings are attributed to the configuration file that trusts the server and name the package, version and file. The server’s inventory entry records the ecosystem, whether the version is pinned, whether the integrity check passed, and the tools the package exposes.
Inspection runs within a per-scan time budget and never blocks a scan. A package that could not be fetched, or that was skipped because the budget ran out, is recorded on the run as not inspected rather than as clean.
Work with rule findings in the dashboard
Open AI Attack Surface → Findings.
- Type a rule ID such as
AIASM-MCP-007into Search title, rule, or file to list every occurrence of one rule. - Use the OWASP filter (for example LLM06 · Excessive agency), the severity filter and the triage-state filter to narrow the list.
- Open a finding to see its rule ID, OWASP category, confidence, the analysis-method tag, occurrences, first-seen date, location, redacted evidence and remediation.
- Record a triage decision. See Triage AI-specific findings for the states and who can set them.
To enforce rules rather than review them, configure AI Attack Surface → Policy. See Configure policy.