> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trulyagentic.io/llms.txt
> Use this file to discover all available pages before exploring further.

# OWASP Agentic AI (ASI01–ASI06)

> Deterministic protections against indirect prompt injection, MCP tool poisoning, manifest rug pulls, and context manipulation.

[`src/mcp-scanner.ts`](https://github.com/trulyagentic/truly-agentic-governance-kit/blob/main/src/mcp-scanner.ts) and [`src/gateway.ts`](https://github.com/trulyagentic/truly-agentic-governance-kit/blob/main/src/gateway.ts) map directly to OWASP Top 10 for Agentic Applications (2026) categories `ASI01`–`ASI06`.

| OWASP ID | Threat Category | Deterministic Defense in `@trulyagentic/governance-kit` |
| - | - | - |
| **ASI01** | **Agent Goal Hijack** (Indirect Prompt Injection) | `scanUntrustedPayload` inspects tool arguments and external text payloads (`untrustedInputs`) for HTML comment instructions, role delimiters (`system:`, `<\|im_start\|>`), zero-width Unicode obfuscation, and override phrases prior to policy execution. |
| **ASI02** | **Tool Misuse & Excessive Agency** | `PolicyEngine` enforces `read`/`propose`/`write` tiering, `L1`–`L5` agency limits, numeric/currency/IBAN/domain constraints, and mandatory `idempotencyKey` write protections. |
| **ASI03** | **Identity & Privilege Abuse** | `AgentRegistry` permits only provisioned `svc-agent-*` identities with per-tool allowlists; `ApprovalGate` binds tickets strictly to `(agentId, toolName, inputSha256, idempotencyKey)` and individual `usr_*` approvers. |
| **ASI04** | **Agentic Supply Chain** (MCP Poisoning & Rug Pulls) | `scanMcpToolDefinition` detects `<IMPORTANT>`, `<system>`, exfiltration directives (`.ssh`, `.env`, `id_rsa`), and cross-tool shadowing directives, and verifies `computeToolManifestHash` against pinned baselines (`config/mcp-pins.example.json`). |
| **ASI05** | **Unexpected Execution & Unvalidated Output** | Zero `eval()` or dynamic shell execution; deterministic schema validation blocks malformed parameters and idempotency key payload mismatches before invoking downstream executors. |
| **ASI06** | **Memory & Context Poisoning** | All untrusted inputs are scanned pre-policy and logged with canonical `inputSha256` digests in the tamper-evident hash chain (`verifyAuditChainEntries`). |

## MCP Manifest Pinning (`ASI04`)

Rug-pull attacks occur when an external MCP server passes initial onboarding review and later mutates its tool description or JSON schema stealthily.

`computeToolManifestHash(tool)` hashes canonical JSON (`canonicalJson`) of `{ serverId, toolName, description, inputSchema }` using SHA-256:

```ts theme={null}
import { computeToolManifestHash, scanMcpToolDefinition } from '@trulyagentic/governance-kit';
import type { PinnedToolManifest } from '@trulyagentic/governance-kit';

const expectedHash = computeToolManifestHash(approvedToolDefinition);

const pinnedRegistry = new Map<string, PinnedToolManifest>([
  ['erp-mcp:erp.get_invoice', { serverId: 'erp-mcp', toolName: 'erp.get_invoice', manifestSha256: expectedHash }],
]);

const result = scanMcpToolDefinition(runtimeToolDefinition, pinnedRegistry);
if (!result.safe) {
  // Gateway blocks execution fail-closed with tag ASI04 (rule: mcp_manifest_rug_pull or unpinned_mcp_tool)
}
```

## Poisoning Rules Enforced by `scanMcpToolDefinition`

* `hidden_instruction_tag`: `<important>`, `<system>`, `<instructions>`, `<override>`, `<hidden>`
* `instruction_override_phrase`: `"ignore all previous instructions"`, `"disregard prior rules"`, etc.
* `exfiltration_directive`: attempts to reference `.ssh`, `id_rsa`, `aws_secret`, `.env`, `credentials`, `cookies`, or `private key`
* `tool_shadowing_directive`: instructions telling the model `"before calling X ... call/redirect Y"`
* `zero_width_obfuscation`: invisible Unicode bidirectional/zero-width characters (`\u200B`–`\u200F`, `\u202A`–`\u202E`, `\u2060`, `\uFEFF`)
* `unpinned_mcp_tool` / `mcp_manifest_rug_pull`: absence from allowlist or SHA-256 hash mismatch


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.