Skip to Content
FeaturesAI Security Rules & Dataflow

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 dashboardMethodWhat it means
Dataflow provendataflowTaint 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 matchpatternThe exact shape of one call or declaration is the defect, for example an agent built with a shell tool.
From configurationconfigurationRead directly from a declared MCP client configuration file.
From manifestmanifestRead from a dependency manifest or from public advisory data for a resolved package version.
InferredheuristicInferred 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.

RuleMethodPythonJavaScript / TypeScriptGoJava
AIASM-LLM01-001 untrusted input reaches a promptDataflowYesYesYesYes
AIASM-LLM02-001 sensitive data reaches a provider callDataflowYesYesYesYes
AIASM-LLM04-001 untrusted content reaches retrieval or trainingDataflowYesYesNot yetNot yet
AIASM-LLM05-001 model output reaches a dangerous sinkDataflowYesYesYesYes
AIASM-LLM06-001 agent with excessive tool authorityPatternYesYesNot yetNot yet
AIASM-LLM06-002 agent given an unrestricted execution toolPatternYesYesNot yetNot yet
AIASM-LLM08-001 vector retrieval without tenant isolationPatternYesYesNot yetNot yet
AIASM-LLM10-001 AI call without resource boundsPatternYesYesYesYes
AIASM-MCP-007 model-supplied argument reaches command executionDataflowYesYesNot yetNot yet
AIASM-MCP-008 model-supplied path reaches the filesystemDataflowYesYesNot yetNot yet
AIASM-MCP-017 model-supplied URL reaches an outbound requestDataflowYesYesNot yetNot yet
AIASM-MCP-018 model-supplied value reaches a database queryDataflowYesYesNot yetNot 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

RuleTitleDefault severityOWASPDecided by
AIASM-LLM01-001Untrusted input may reach an AI promptHighLLM01 Prompt injectionDataflow
AIASM-LLM02-001Sensitive data may be sent to an AI providerHighLLM02 Sensitive information disclosureDataflow
AIASM-LLM03-001AI dependency is not version pinnedMediumLLM03 Supply chainManifest
AIASM-LLM03-002Model identifier is not revision pinnedLowLLM03 Supply chainModel reference in code
AIASM-LLM04-001Untrusted content may enter a retrieval or training pipelineHighLLM04 Data and model poisoningDataflow
AIASM-LLM05-001Model output may reach a dangerous sinkCriticalLLM05 Improper output handlingDataflow
AIASM-LLM06-001Agent may have excessive tool authorityHighLLM06 Excessive agencyPattern
AIASM-LLM06-002Agent is given an unrestricted execution toolCriticalLLM06 Excessive agencyPattern
AIASM-LLM07-001System prompt may be exposed to clientsMediumLLM07 System prompt leakageInferred
AIASM-LLM08-001Vector retrieval may lack tenant isolationHighLLM08 Vector and embedding weaknessesPattern
AIASM-LLM09-001Model output may drive a trusted decision without validationMediumLLM09 MisinformationInferred
AIASM-LLM10-001AI invocation lacks visible resource boundsMediumLLM10 Unbounded consumptionPattern
AIASM-LLM10-002Agent loop has no iteration or budget boundMediumLLM10 Unbounded consumptionInferred

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

RuleTitleDefault severityOWASP
AIASM-MCP-001MCP server is not version pinnedHighLLM03
AIASM-MCP-002MCP server installs unreviewed code at launchHighLLM03
AIASM-MCP-003Credential is passed through to an MCP serverHighLLM06
AIASM-MCP-004MCP server uses an unencrypted transportHighLLM06
AIASM-MCP-005Remote MCP server has no declared authenticationHighLLM06
AIASM-MCP-010MCP client auto-approves tool callsCriticalLLM06
AIASM-MCP-011MCP server is loaded from an unpinned remote sourceMediumLLM03
AIASM-MCP-013MCP configuration contains an inline credentialCriticalLLM06
AIASM-MCP-015MCP server runs with excessive host privilegeHighLLM06
AIASM-MCP-021TLS verification is disabled on an MCP transportHighLLM06

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

RuleTitleDefault severityOWASP
AIASM-MCP-006MCP tool description contains model-directed instructionsCriticalLLM01
AIASM-MCP-007MCP tool exposes command execution to the modelCriticalLLM05
AIASM-MCP-008MCP tool exposes unrestricted filesystem accessHighLLM06
AIASM-MCP-009Consequential MCP tool has no approval stepHighLLM06
AIASM-MCP-012MCP tool returns untrusted content without provenanceMediumLLM01
AIASM-MCP-014MCP sampling or elicitation is enabled without boundsMediumLLM10
AIASM-MCP-016Network MCP transport has no origin validationHighLLM06
AIASM-MCP-017Model-supplied URL reaches an outbound requestHighLLM06
AIASM-MCP-018Model-supplied value reaches a database queryCriticalLLM05
AIASM-MCP-019Client credential is forwarded to an upstream APIHighLLM06
AIASM-MCP-020MCP tool accepts unvalidated inputMediumLLM01
AIASM-MCP-022MCP session identifier is weak or exposedMediumLLM06
AIASM-MCP-023MCP resource, prompt or instructions carry model-directed textCriticalLLM01
AIASM-MCP-024MCP tools are registered from fetched contentHighLLM03
AIASM-MCP-025MCP tool arguments or credentials are loggedMediumLLM02
AIASM-MCP-026MCP server accepts tokens without signature or audience validationHighLLM06
AIASM-MCP-027MCP elicitation requests sensitive informationHighLLM02
AIASM-MCP-028MCP tool annotations contradict the handlerMediumLLM06
AIASM-MCP-029Network-exposed MCP server has no authenticationHighLLM06

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

RuleTitleDefault severityOWASP
AIASM-MCP-030Declared MCP server package runs install-time scriptsMediumLLM03
AIASM-MCP-031Declared MCP server package has known vulnerabilitiesHighLLM03
AIASM-MCP-032Declared MCP server package could not be verifiedMediumLLM03

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.

  1. 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.

  2. 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 as AIASM-MCP-032.

  3. 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.

  4. 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.

  1. Type a rule ID such as AIASM-MCP-007 into Search title, rule, or file to list every occurrence of one rule.
  2. Use the OWASP filter (for example LLM06 · Excessive agency), the severity filter and the triage-state filter to narrow the list.
  3. Open a finding to see its rule ID, OWASP category, confidence, the analysis-method tag, occurrences, first-seen date, location, redacted evidence and remediation.
  4. 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.