Manage your AI attack surface
AI Attack Surface Management builds an evidence-backed inventory of the AI providers, models, frameworks, prompts, agents, tools, Model Context Protocol (MCP) servers, vector databases, guardrails, and application endpoints declared in your repositories. Open AI Attack Surface from the dashboard sidebar.
CodeStax performs passive static analysis. It reads supported source and configuration files, and reads the published archives of declared MCP server packages after verifying their registry digests, but it does not execute repository or package code, install dependencies, or store detected secret values.
Establish an inventory
- Connect a repository and run a Smart or Deep scan.
- Open AI Attack Surface → Overview.
- Check the repository freshness and latest-run coverage before relying on the inventory.
- Open Inventory to review each discovered asset and its source evidence.
The inventory recognizes common AI providers and platforms, including OpenAI, Anthropic, Google Gemini and Vertex AI, Azure OpenAI, Amazon Bedrock, Cohere, Mistral AI, Hugging Face, Replicate, Groq, Together AI, and Ollama. It also recognizes common orchestration frameworks, vector stores, guardrails, MCP configuration, model identifiers, prompts, agents, tools, and AI-facing routes.
Understand coverage and freshness
The Runs view records the branch, commit, engine version, files considered, files scanned, skipped files, discovered assets, findings, policy result, and coverage state.
| State | Meaning |
|---|---|
| Complete | The run completed within the analyzer’s file and byte limits. A complete default-branch run may reconcile the current inventory. |
| Partial | Some eligible content was skipped or a limit was reached. Existing assets are preserved because missing evidence is not proof that an asset was removed. |
| Failed | The analyzer could not produce usable evidence. |
| Unverified | The run cannot establish complete coverage. |
| Not applicable | The scan did not run this analyzer for the repository. |
The repository’s exclude paths apply to this analyzer as they do to every other engine. A run that reaches the file-size, file-count or analysis-time limit is Partial, and the scan’s warnings name the AI Attack Surface Analyzer and the reason, so incomplete AI coverage is never shown as a clean scan. A run whose dataflow analysis did not run is flagged the same way.
Repository freshness is updated only by a complete default-branch reconciliation. Feature-branch scans add evidence but do not silently remove assets from the current default-branch inventory.
Build an AI Bill of Materials
Select one repository, then open AI Attack Surface → AI BOM. CodeStax builds the BOM from the repository’s latest complete, authoritative default-branch generation. Preview, partial, failed, and non-applicable runs cannot become BOM generations.
The BOM workspace shows:
- the generation, exact commit, scan completion time, and snapshot fidelity;
- model, data-asset, provider, and relationship counts;
- explicit identity, version, supplier, license, source-provenance, and governance coverage;
- independent readiness for CycloneDX and SPDX; and
- changes between authoritative generations.
Scan coverage and BOM completeness answer different questions. A complete scan means all eligible repository files were analyzed within configured limits. It does not prove that no runtime-only component exists, so CycloneDX composition is reported as unknown, not complete.
Export CycloneDX 1.7
CycloneDX AI/ML-BOM is available when the selected repository has a complete authoritative generation. Models are exported as machine-learning-model, prompts and data assets as data, frameworks with their standard type, and endpoints as services only when evidence contains a real absolute URI. CodeStax does not invent endpoint schemes, unknown versions, or empty dependency declarations.
Exports use stable identifiers, the scan completion time, the repository commit, and canonical JSON ordering. Repeating an export without changing its inputs produces the same bytes and SHA-256 digest.
Prepare SPDX 3.0.1 AI Profile
SPDX AI Profile has mandatory facts that static source detection cannot safely infer. For every model, an organization admin must declare and verify its supplier, release time, download location, and package version. Dataset assets additionally require a built time and dataset type. A license may be explicitly declared or left as SPDX NoAssertion.
Use Complete declaration beside a blocked asset. Record the upstream or repository source, optionally add its SHA-256 digest, and mark the declaration verified only after checking that source. Updates use optimistic versions and are written to the organization audit log.
CodeStax blocks the SPDX download until every relevant asset is ready. It never substitutes the scan time for a model release time, a repository URL for a model download location, or a detected provider name for a verified supplier.
Compare generations
The generation comparison classifies added, removed, modified, evidence-only, and relationship changes from immutable per-run asset snapshots. If a legacy generation cannot reconstruct every discovered asset, the export fails explicitly. If the canonicalization version changes, CodeStax requires a rebaseline instead of presenting widespread identity churn as real additions and removals.
Historical asset fields come from the immutable selected generation. Human declarations use the latest verified revision at export time and are labeled current-at-export; changing a declaration changes the BOM artifact ID, version, timestamp, and digest without rewriting the scan snapshot.
Review the topology
Open Topology to see relationships inferred from colocated evidence. Relationships can show that an endpoint, framework, or agent:
- uses a model or provider;
- retrieves from a vector database or knowledge source;
- invokes a tool or MCP server; or
- is protected by a guardrail.
Topology is static evidence, not a runtime trace. Confirm consequential paths in the source before changing production controls.
Triage AI-specific findings
The Findings view maps risks to the OWASP Top 10 for LLM Applications 2025 categories. Shipped checks cover prompt injection, sensitive-data exposure, AI supply-chain pinning, data and model poisoning, unsafe model-output handling, excessive agency (including agents given an unrestricted execution tool), system-prompt exposure, vector and embedding isolation, unvalidated model decisions, and unbounded consumption (including agent loops with no iteration or budget bound).
Each finding states how it was decided. Dataflow findings carry a proven path from a source to a sink: untrusted input reaching a prompt, sensitive data reaching a provider call, untrusted content reaching a retrieval or training pipeline, model output reaching code execution, a query, a request or unsafe rendering, and a model-supplied MCP tool argument reaching a shell, the filesystem, an outbound request or a database query. Dataflow runs for Python, JavaScript and TypeScript, Go and Java. Pattern findings matched a known-dangerous construct in the syntax tree, configuration findings were read from a declared client configuration, manifest findings come from dependency manifests, and heuristic findings were inferred from surrounding code and should be confirmed before acting. When the dataflow engine was unavailable for a run, the run says so and the affected rules fall back to heuristics rather than presenting an unverified clean result.
For the full rule catalogue and per-language dataflow coverage, see AI security rules and dataflow analysis. For BOM exports, declarations and drift, see AI Bill of Materials.
Each finding includes a stable rule ID, severity, confidence state, source location, redacted evidence summary, and remediation guidance. A finding moves through these states:
openacknowledgedaccepted_riskresolveddismissed
Members can set open and acknowledged. Only organization admins and owners can set accepted_risk, resolved or dismissed, or move a finding out of one of those states. A reason is required for accepted-risk, resolved, and dismissed states, and accepted-risk and dismissed also require an expiry no more than 365 days ahead. Triage changes are written to the organization audit log.
Review Model Context Protocol servers
A Model Context Protocol (MCP) server is third-party code the model can invoke with the host’s privileges. CodeStax reads the trust decision in three places.
Client configuration. Declared servers are read from Claude Desktop and Claude Code (claude_desktop_config.json, .mcp.json), VS Code (.vscode/mcp.json, settings.json), Cursor (.cursor/mcp.json), Windsurf, Cline, Continue (config.json, config.yaml), Zed and Gemini CLI configurations. Configuration checks report unpinned server versions, install-at-launch commands, credentials passed through to the server process, inline credentials, plaintext transports, remote servers with no declared authentication, blanket tool auto-approval, privileged launch settings, unpinned remote sources, and TLS verification disabled by environment or launch flags. A disabled server is inventoried but not assessed.
Server code in your repository. Servers built with the Python, TypeScript, Go and Java SDKs are checked. The checks that need dataflow analysis (command execution, filesystem access, outbound requests and database queries built from model-supplied arguments) currently cover Python and TypeScript servers only; see AI Security Rules & Dataflow for per-language coverage. Checks include tool, resource, prompt and server-instruction text that carries instructions aimed at the model (tool poisoning), tools that reach command execution, unrestricted filesystem access, outbound requests or database queries from model-supplied arguments, consequential tools with no approval step, fetched content returned without a provenance boundary, unbounded sampling or elicitation, elicitation that asks the user for secrets, tool annotations that contradict the handler, tools with no input schema or a permissive one, network transports without origin validation or authentication, weak or URL-carried session identifiers, token passthrough to upstream APIs, tokens accepted without signature or audience validation, tool definitions built from fetched content, and tool arguments written to logs.
Published packages the configuration launches. For a declared npx, bunx, uvx or pipx server, CodeStax downloads the published package at the pinned version (or the version the registry currently resolves, which is itself reported as unpinned), verifies the registry digest, and reads it without installing or running anything. The same server-code checks run over the package, plus install-time scripts, known vulnerabilities from public advisory data, and packages whose digest or version could not be verified. Findings are attributed to the configuration file that trusts the server and name the package, version and file. The inventory records the resolved version, the tools the package exposes, and whether the integrity check passed. A server installed from a custom package registry (a --registry or --index-url launch option, or a registry environment variable such as NPM_CONFIG_REGISTRY or UV_INDEX_URL) is reported as unverifiable instead: the code that runs is not the public package of the same name, so CodeStax does not inspect that one in its place. Inspection respects a per-run time budget and never blocks a scan; a registry that could not be reached is recorded on the run.
Package inspection reads from the public npm and PyPI registries and public advisory data. It is on by default. If a registry can’t be reached, or inspection is turned off for a run, the run records that instead of reporting the package as clean.
Approve assets
Organization admins and owners can set an asset to Approved, Restricted, Denied, or Unreviewed. Every approval change requires a reason and is audit logged.
Use approval to record governance decisions, not to hide discovery evidence. A denied asset remains visible until a later complete default-branch scan proves it is no longer present.
Configure policy
Open AI Attack Surface → Policy to configure the organization policy and optional repository overrides. Available controls include:
- provider allowlisting and denied model identifiers;
- model-version pinning;
- approved-asset requirements;
- prompt-injection and sensitive-data-exposure blocking;
- failure on incomplete coverage;
- maximum critical and high findings; and
- an optional policy gate.
The policy and its gate are evaluated on repository scans. Pull-request reviews report AI findings through the standard review severity gate; this policy and its waivers do not apply to pull requests.
Policy updates use version checks so a stale admin session cannot overwrite a newer change. Repository overrides inherit unspecified fields from the organization policy and can be deleted to return to full inheritance.
Enable the gate only after reviewing inventory coverage and existing findings. A policy configured to fail on coverage gaps can intentionally block when the analyzer cannot prove complete coverage.
Use expiring waivers
Organization admins and owners can create an expiring waiver for an organization, repository, or individual finding. A waiver must name a rule, include a reason, and expire within 365 days. Revoking a waiver is also audit logged.
- Organization and repository waivers name a policy control (for example
critical_thresholdorcoverage) or a finding rule, and apply across that scope. - Finding waivers are an exception for one finding. They must name that finding’s own rule, remove only that finding from the policy’s checks and threshold counts, and never waive a repository-wide control.
Export evidence
Use Export inventory or Export findings in the dashboard, or call GET /api/ai-asm/export. CSV exports are tenant scoped, protect spreadsheet cells from formula injection, and are capped at 10,000 rows. The response header X-Export-Truncated reports whether more rows existed.
See the AI Attack Surface API for automation examples.