Agent Identity Protocol (AIP) Specification
Version: v1alpha2Status: Draft
Last Updated: 2026-01-24
Authors: Eduardo Arango ([email protected])
Abstract
The Agent Identity Protocol (AIP) defines a standard for policy-based authorization of AI agent tool calls. AIP enables runtime environments to enforce fine-grained access control over Model Context Protocol (MCP) tool invocations, providing a security boundary between AI agents and external resources. This specification defines:- The policy document schema (
AgentPolicy) - Evaluation semantics for authorization decisions
- Agent identity and session management (new in v1alpha2)
- Server-side validation endpoints (new in v1alpha2)
- Error codes for denied requests
- Audit log format for compliance
Table of Contents
- Introduction
- Terminology
- Policy Document Schema
- Evaluation Semantics
- Agent Identity (new in v1alpha2)
- Server-Side Validation (new in v1alpha2)
- Error Codes
- Audit Log Format
- Conformance
- Security Considerations
- IANA Considerations
- Appendix A: Complete Schema Reference
- Appendix B: Changelog
- Appendix C: References
- Appendix D: Future Extensions
- Appendix E: Implementation Notes
1. Introduction
1.1 Motivation
AI agents operating through the Model Context Protocol (MCP) have access to powerful tools: file systems, databases, APIs, and cloud infrastructure. Without a policy layer, agents operate with unrestricted access to any tool the MCP server exposes. AIP addresses this gap by introducing:- Capability declaration: Explicit allowlists of permitted tools
- Argument validation: Regex-based constraints on tool parameters
- Human-in-the-loop: Interactive approval for sensitive operations
- Audit trail: Immutable logging of all authorization decisions
- Agent identity: Cryptographic binding of policies to agent sessions (new in v1alpha2)
- Server-side validation: Optional HTTP endpoints for distributed policy enforcement (new in v1alpha2)
1.2 Goals
- Interoperability: Any MCP runtime can implement AIP
- Simplicity: YAML-based policies readable by security teams
- Defense in depth: Multiple layers (method, tool, argument, identity)
- Fail-closed: Unknown tools are denied by default
- Zero-trust ready: Support for token-based identity verification (new in v1alpha2)
1.3 Non-Goals
The following are explicitly out of scope for this version of the specification:- Network egress control (see Appendix D: Future Extensions)
- Subprocess sandboxing (implementation-defined)
- External identity federation (OIDC/SPIFFE - see Appendix D)
- Rate limiting algorithms (implementation-defined)
- Policy expression languages beyond regex (CEL/Rego - see Appendix D)
1.4 Relationship to MCP
AIP is designed as a security layer for MCP. It interceptstools/call requests and applies policy checks before forwarding to the MCP server.
1.5 Relationship to MCP Authorization
MCP defines an optional OAuth 2.1-based authorization layer (MCP 2025-06-18 and later). AIP is complementary to MCP authorization:| Concern | MCP Authorization | AIP |
|---|---|---|
| Scope | Transport-level authentication | Tool-level authorization |
| What it protects | Access to MCP server | Access to specific tools |
| Token type | OAuth 2.1 access tokens | AIP Identity Tokens (optional) |
| Policy language | OAuth scopes | YAML policy documents |
2. Terminology
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.| Term | Definition |
|---|---|
| Agent | An AI system that invokes MCP tools on behalf of a user |
| Policy | A document specifying authorization rules (AgentPolicy) |
| Tool | An MCP tool exposed by an MCP server |
| Decision | The result of policy evaluation: ALLOW, BLOCK, or ASK |
| Violation | A policy rule was triggered (may or may not block) |
| Session | A bounded period of agent activity with consistent identity (new) |
| Identity Token | A cryptographic token binding policy to session (new) |
| Policy Hash | SHA-256 hash of the canonical policy document (new) |
3. Policy Document Schema
3.1 Document Structure
An AIP policy document is a YAML file with the following top-level structure:3.2 Required Fields
| Field | Type | Description |
|---|---|---|
apiVersion | string | MUST be aip.io/v1alpha2 |
kind | string | MUST be AgentPolicy |
metadata.name | string | Unique identifier for this policy |
3.3 Metadata
3.3.1 Policy Signature (v1alpha2)
Thesignature field provides cryptographic integrity verification for the policy document.
Format: <algorithm>:<base64-encoded-signature>
Supported algorithms:
ed25519- Ed25519 signature (RECOMMENDED)
3.4 Spec Fields
[Sections 3.4.1 through 3.6 remain unchanged from v1alpha1]3.4.1 mode
Controls enforcement behavior.| Value | Behavior |
|---|---|
enforce | Violations are blocked (default) |
monitor | Violations are logged but allowed |
3.4.2 allowed_tools
A list of tool names that the agent MAY invoke.3.4.3 allowed_methods
A list of JSON-RPC methods that are permitted. If not specified, implementations MUST use the default safe list:* MAY be used to allow all methods.
3.4.4 denied_methods
A list of JSON-RPC methods that are explicitly denied. Denied methods take precedence over allowed methods.3.4.5 protected_paths
A list of file paths that tools MUST NOT access. Any tool argument containing a protected path MUST be blocked.- Expand
~to the user’s home directory - Automatically protect the policy file itself
3.4.6 strict_args_default
Whentrue, tool rules reject any arguments not explicitly declared in allow_args.
Default: false
3.5 Tool Rules
Tool rules provide fine-grained control over specific tools.3.5.1 Actions
| Action | Behavior |
|---|---|
allow | Permit (subject to argument validation) |
block | Deny unconditionally |
ask | Require interactive user approval |
3.5.2 Rate Limiting
Format:<count>/<period>
| Period | Aliases |
|---|---|
second | sec, s |
minute | min, m |
hour | hr, h |
"10/minute", "100/hour", "5/second"
Rate limiting algorithm is implementation-defined (token bucket, sliding window, etc.).
3.5.3 Argument Validation
Theallow_args field maps argument names to regex patterns.
- Use a regex engine with linear-time guarantees (RE2 or equivalent)
- Match against the string representation of the argument value
- Treat missing constrained arguments as a violation
3.5.4 Tool Schema Hashing (v1alpha2)
Theschema_hash field provides cryptographic verification of tool definitions to prevent tool poisoning attacks.
Format: <algorithm>:<hex-digest>
Supported algorithms:
sha256(RECOMMENDED)sha384sha512
| Condition | Behavior |
|---|---|
schema_hash absent | No schema verification (backward compatible) |
| Hash matches | Tool allowed (proceed to argument validation) |
| Hash mismatch | Tool BLOCKED with error -32013 |
| Tool not found | Tool BLOCKED with error -32001 |
- Tool poisoning prevention: Detect when an MCP server changes a tool’s behavior after policy approval
- Compliance auditing: Prove that approved tools haven’t been modified
- Supply chain security: Pin specific tool versions in policy
- Schema hashes MUST be regenerated when MCP server is updated
- Implementations SHOULD log hash mismatches with both expected and actual hashes
- Policy authors SHOULD document which tool version the hash corresponds to
| Code | Name | Description |
|---|---|---|
| -32013 | Schema Mismatch | Tool schema hash does not match policy (new) |
3.6 DLP Configuration
Data Loss Prevention (DLP) scans for sensitive data in requests and responses.3.6.1 scan_requests (v1alpha2)
Whentrue, DLP patterns are applied to tool arguments before the request is forwarded.
Default: false (backward compatible)
Use case: Prevents data exfiltration via arguments (e.g., embedding secrets in API queries).
3.6.2 scan_responses
Whentrue, DLP patterns are applied to tool responses.
Default: true
3.6.3 max_scan_size (v1alpha2)
Maximum size of content to scan per request/response. Format: Size string (e.g.,"1MB", "512KB", "10MB")
Default: "1MB"
Content exceeding this limit:
- SHOULD be truncated for scanning (scan first
max_scan_sizebytes) - MUST log a warning
3.6.4 on_request_match (v1alpha2)
Action when DLP pattern matches in a request (whenscan_requests: true).
| Value | Behavior |
|---|---|
block | Reject the request with error -32001 (default) |
redact | Replace matched content and forward |
warn | Log warning and forward unchanged |
block
Security note: redact for requests may produce invalid tool arguments. Use with caution.
Redaction failure handling (v1alpha2):
When on_request_match: "redact" is configured, redacted content may cause downstream failures:
- Invalid JSON: Redaction in nested structures may break JSON parsing
- Schema validation failure: Redacted values may violate tool argument schemas
- Tool execution failure: The MCP server may reject redacted arguments
| Field | Type | Description |
|---|---|---|
on_redaction_failure | string | Action when redacted request fails: block, allow_original, reject |
log_original_on_failure | bool | Log pre-redaction content for forensics (sensitive!) |
| Value | Behavior | Security | Use Case |
|---|---|---|---|
block | Block with -32001 (default) | High | Production |
allow_original | Forward original unredacted | Low | Debug only |
reject | Block with -32014 (new error) | High | Strict compliance |
| Code | Name | Description |
|---|---|---|
| -32014 | DLP Redaction Failed | Request redaction produced invalid content (new) |
log_original_on_failure: true will log sensitive data that DLP attempted to redact. This SHOULD only be enabled:
- In development environments
- With appropriate log access controls
- For time-limited forensic investigations
3.6.5 Pattern Scope (v1alpha2)
Patterns can be scoped to requests, responses, or both:3.7 Identity Configuration (v1alpha2)
Theidentity section configures agent identity and token management.
3.7.1 enabled
Whentrue, the AIP engine generates and manages identity tokens for the session.
Default: false
3.7.2 token_ttl
The time-to-live for identity tokens. Format: Go duration string (e.g.,"5m", "1h", "300s")
Default: "5m" (5 minutes)
Implementations SHOULD use short TTLs (5-15 minutes) to limit token theft window.
3.7.3 rotation_interval
How often to rotate tokens before expiry. Format: Go duration string Default:"4m" (4 minutes, ensuring rotation before 5m TTL)
Constraint: rotation_interval MUST be less than token_ttl.
Validation behavior (v1alpha2):
When loading a policy, implementations MUST validate the rotation_interval constraint:
| Condition | Behavior | Error |
|---|---|---|
rotation_interval >= token_ttl | Reject policy | Policy load failure |
rotation_interval > token_ttl * 0.9 | Warn, allow | Log warning |
rotation_interval not specified | Use default ("4m") | - |
rotation_interval: "0s" | Disable rotation | - |
| Use Case | token_ttl | rotation_interval | Rationale |
|---|---|---|---|
| Default | "5m" | "4m" | 1 minute grace for in-flight |
| High-security | "5m" | "2m" | More frequent rotation |
| Low-latency | "1m" | "45s" | Minimal token lifetime |
| Long-lived | "1h" | "50m" | 10 minute grace |
rotation_interval: "0s" disables automatic rotation. Tokens will only be refreshed when explicitly requested or when they expire.
3.7.4 require_token
Whentrue, all tool calls MUST include a valid identity token. Calls without tokens are rejected with error code -32008.
Default: false
This enables gradual rollout: start with require_token: false to generate tokens without enforcement, then enable enforcement.
3.7.5 session_binding
Determines what context is bound to the session identity.| Value | Binding |
|---|---|
process | Session bound to process ID (default) |
policy | Session bound to policy hash |
strict | Session bound to process + policy + timestamp |
3.7.6 nonce_window
The duration to retain nonces for replay detection. Format: Go duration string Default: Equalstoken_ttl (e.g., "5m" if token_ttl is "5m")
Purpose: Bounds the storage required for replay prevention. Nonces older than nonce_window MAY be pruned from storage.
Constraints:
nonce_windowMUST be greater than or equal totoken_ttl- Setting
nonce_windowless thantoken_ttlis a configuration error
| Deployment | Recommended nonce_window |
|---|---|
| Single instance | token_ttl (default) |
| Multi-instance (shared storage) | token_ttl + clock_skew_tolerance |
| High-security | 2 * token_ttl |
3.7.7 policy_transition_grace
The grace period during which tokens issued with the previous policy hash remain valid after a policy update. Format: Go duration string Default:"0s" (no grace period - strict policy enforcement)
Purpose: Allows gradual policy rollouts without invalidating all in-flight tokens immediately.
Behavior:
- When policy is updated, the previous policy hash is retained in
recent_policy_hashes - Tokens with either current or recent policy hash are accepted during the grace period
- After grace period expires, only current policy hash is valid
policy_transition_graceSHOULD be less thantoken_ttlto ensure policy changes take effect within one token lifetime- Setting very long grace periods weakens security guarantees
| Scenario | Recommended Setting |
|---|---|
| Development | "0s" - Immediate policy updates |
| Production (single instance) | "30s" - Brief grace for in-flight requests |
| Production (distributed) | "2m" - Allow for propagation delay |
| Canary deployments | Equal to deployment window |
3.7.8 audience (v1alpha2)
The intended audience for identity tokens. This value is included in the token’saud claim and MUST be validated by recipients.
Format: URI string identifying the MCP server or service
Default: Value of metadata.name
Purpose: Prevents tokens issued for one MCP server from being accepted by another. This is critical for:
- Multi-tenant deployments where agents access multiple MCP servers
- Defense against token theft and replay across services
- Compliance with OAuth 2.1 audience binding requirements (RFC 8707)
- Implementations MUST reject tokens where
auddoes not match the expected audience - When
server.enabled: true, the audience SHOULD be the server’s canonical URL - Wildcards are NOT permitted in audience values
audienceMUST be a valid URI or the policymetadata.name- Empty string is NOT valid; use default (metadata.name) instead
3.7.9 nonce_storage (v1alpha2)
Configuration for distributed nonce storage, required for multi-instance deployments.| Field | Type | Description |
|---|---|---|
type | string | Storage backend: memory, redis, postgres |
address | string | Connection string for external storage |
key_prefix | string | Prefix for nonce keys (namespacing) |
clock_skew_tolerance | duration | Added to TTL to handle clock drift |
| Type | Atomicity | Persistence | Multi-instance | Use Case |
|---|---|---|---|---|
memory | ✅ (sync.Map) | ❌ | ❌ | Development, single-instance |
redis | ✅ (SET NX) | ✅ | ✅ | Production (RECOMMENDED) |
postgres | ✅ (UNIQUE) | ✅ | ✅ | Production with existing DB |
type: "memory" with multiple AIP instances is a security vulnerability that allows cross-instance replay attacks. Implementations SHOULD warn when memory storage is detected in environments with multiple instances.
3.8 Server Configuration (v1alpha2)
Theserver section configures optional HTTP endpoints for server-side validation.
3.8.1 enabled
Whentrue, the AIP engine starts an HTTP server for remote validation.
Default: false
3.8.2 listen
The address and port to bind the HTTP server. Format:<host>:<port> or :<port>
Default: "127.0.0.1:9443" (localhost only)
⚠️ Security: Binding to 0.0.0.0 exposes the validation endpoint to the network. Implementations MUST require TLS when listen address is not localhost.
3.8.3 failover_mode
Defines behavior when the validation server is unreachable (for clients) or when internal validation fails (for server).| Value | Behavior | Security | Availability |
|---|---|---|---|
fail_closed | Deny all requests | High | Low |
fail_open | Allow all requests | Low | High |
local_policy | Fall back to local policy evaluation | Medium | Medium |
fail_closed (deny-by-default for security)
fail_closed (RECOMMENDED for production):
- All validation requests are denied when server is unreachable
- Returns error code -32001 (Forbidden) with reason “validation_unavailable”
- Highest security, may cause availability issues
- All requests are allowed when server is unreachable
- Logs warning: “failover_mode=fail_open triggered”
- ⚠️ Only use in development or when availability > security
failover_mode: "fail_open" is configured, implementations SHOULD require additional constraints to limit exposure:
| Field | Type | Description |
|---|---|---|
allowed_tools | []string | Only these tools are allowed during fail_open (others blocked) |
max_duration | duration | Auto-revert to fail_closed after this period |
max_requests | int | Auto-revert after N requests in fail_open mode |
alert_webhook | string | POST notification when fail_open activates |
require_local_policy | bool | Only fail_open if local policy is loaded and valid |
- When validation server becomes unreachable:
- Increment fail_open counter
- Check if
max_requestsexceeded → revert to fail_closed - Check if
max_durationexceeded → revert to fail_closed - If request tool NOT in
allowed_tools→ block with -32001 - If
require_local_policyand no valid local policy → block with -32001 - POST to
alert_webhook(async, fire-and-forget) - Allow request, log warning
- Implementations SHOULD warn at policy load time if
fail_openis used without constraints - Implementations MUST log every request processed in fail_open mode
- Implementations SHOULD expose a metric
aip_fail_open_requests_total
- Falls back to local policy file evaluation
- Requires local policy to be loaded and valid
- Provides security with graceful degradation
3.8.4 timeout
Maximum time to wait for validation server response. Format: Go duration string Default:"5s" (5 seconds)
After timeout, the failover_mode behavior is triggered.
Example:
3.8.5 TLS Configuration
When the listen address is not localhost (127.0.0.1 or ::1), TLS MUST be configured.
- PEM-encoded certificates and keys
- Let’s Encrypt/ACME integration (implementation-defined)
3.8.6 Endpoints
Customizable endpoint paths:| Endpoint | Default | Description |
|---|---|---|
validate | /v1/validate | Policy validation endpoint |
revoke | /v1/revoke | Token/session revocation (v1alpha2) |
jwks | /v1/jwks | JSON Web Key Set for token verification (v1alpha2) |
health | /health | Health check (for load balancers) |
metrics | /metrics | Prometheus metrics (optional) |
4. Evaluation Semantics
[Sections 4.1 through 4.5 remain unchanged from v1alpha1]4.1 Name Normalization
Tool names and method names MUST be normalized before comparison using the following algorithm:- Fullwidth characters:
delete→delete - Ligatures:
file→file - Zero-width characters:
delete→delete
4.2 Method-Level Authorization
Method authorization is the FIRST line of defense, evaluated BEFORE tool-level checks.4.3 Tool-Level Authorization
Tool authorization applies totools/call requests.
4.4 Decision Outcomes
| Decision | Mode=enforce | Mode=monitor |
|---|---|---|
| ALLOW | Forward request | Forward request |
| BLOCK | Return error | Forward request, log violation |
| ASK | Prompt user | Prompt user |
| RATE_LIMITED | Return error | Return error (always enforced) |
| PROTECTED_PATH | Return error | Return error (always enforced) |
| TOKEN_REQUIRED | Return error | Return error (always enforced) (new) |
| TOKEN_INVALID | Return error | Return error (always enforced) (new) |
4.5 Argument Validation
STRING() function converts values to string representation:
- String → as-is
- Number → decimal representation
- Boolean → “true” or “false”
- Null → empty string
- Array/Object → JSON serialization
5. Agent Identity (v1alpha2)
This section defines the agent identity model introduced in v1alpha2.5.1 Overview
Agent identity provides:- Session binding: Cryptographic proof that requests belong to the same session
- Policy integrity: Verification that the policy hasn’t changed mid-session
- Replay prevention: Nonces prevent token reuse across sessions
- Audit correlation: Session IDs link related audit events
5.2 Policy Hash
The policy hash uniquely identifies a policy configuration.5.2.1 Canonical Form
Before hashing, the policy MUST be converted to canonical form:5.2.2 Hash Computation
5.3 Identity Token Structure
An AIP Identity Token is a JWT-like structure (but NOT necessarily JWT-encoded) with the following fields:| Field | Type | Description |
|---|---|---|
version | string | Token format version (aip/v1alpha2) |
aud | string | Intended audience (from identity.audience or metadata.name) |
policy_hash | string | SHA-256 hash of canonical policy |
session_id | string | UUID identifying this session |
agent_id | string | Value of metadata.name from policy |
issued_at | string | Token issuance time (ISO 8601) |
expires_at | string | Token expiration time (ISO 8601) |
nonce | string | Random value for replay prevention |
binding | object | Session binding context (see 5.3.2) |
5.3.2 Binding Object (v1alpha2)
Thebinding object ties tokens to their execution context:
| Field | Type | Required | Description |
|---|---|---|---|
process_id | int | Yes | OS process ID |
policy_path | string | Yes | Absolute path to policy file |
hostname | string | Yes | Normalized hostname (see below) |
container_id | string | No | Container ID (Docker/containerd) |
pod_uid | string | No | Kubernetes pod UID |
| Environment | hostname Value | Additional Fields |
|---|---|---|
| Bare metal | FQDN | - |
| VM | FQDN | - |
| Docker | container:<id> | container_id |
| Kubernetes | k8s:<pod-uid> | pod_uid, container_id |
| Serverless | lambda:<request-id> | Implementation-defined |
session_binding | Hostname Checked | Container ID Checked | Pod UID Checked |
|---|---|---|---|
process | No | No | No |
policy | No | No | No |
strict | Yes | Yes (if present) | Yes (if present) |
session_binding: "strict" in Kubernetes or serverless environments may cause issues:
- Pod restarts change pod UID → tokens invalid
- Horizontal scaling creates multiple instances → tokens not portable
5.3.1 Token Encoding
Implementations MUST encode tokens using one of the following formats:| Format | When to Use | Interoperability |
|---|---|---|
| JWT (RFC 7519) | When server.enabled: true (REQUIRED) | High - standard format |
| Compact (Base64 JSON) | Local-only deployments | Low - AIP-specific |
server.enabled: true, tokens MUST be encoded as RFC 7519 JWTs. This ensures interoperability with external systems and standard JWT libraries.
JWT Header:
ES256(ECDSA with P-256 and SHA-256) - RECOMMENDED for productionEdDSA(Ed25519) - RECOMMENDED for performanceHS256(HMAC-SHA256) - MAY be used only whenserver.enabled: false
HS256 requires a shared secret, which is unsuitable for distributed validation. Implementations MUST reject HS256 tokens on server endpoints.
Compact Encoding (local-only):
When server.enabled: false, implementations MAY use compact encoding:
5.4 Token Lifecycle
5.4.1 Token Issuance
Tokens are issued when:- Session starts (first tool call with
identity.enabled: true) - Rotation interval elapsed
- Policy changes (new policy_hash)
5.4.2 Token Rotation
Rotation creates a new token while the old token is still valid (grace period).5.4.3 Token Validation
5.5 Session Management
5.5.1 Session Start
A session starts when:- The AIP engine loads a policy with
identity.enabled: true - A new process starts with AIP configured
5.5.2 Session End
A session ends when:- The AIP engine process terminates
- The policy is unloaded or changed significantly
- Explicit session termination (implementation-defined)
5.5.3 Session ID
Session IDs MUST be:- UUID v4 (random) - RECOMMENDED
- Globally unique
- Not predictable
5.6 Token and Session Revocation (v1alpha2)
Revocation allows immediate invalidation of tokens or sessions before their natural expiration.5.6.1 Revocation Targets
| Target | Scope | Use Case |
|---|---|---|
| Token (by nonce) | Single token | Suspected token compromise |
| Session (by session_id) | All tokens in session | User logout, session termination |
5.6.2 Revocation Storage
Implementations MUST maintain a revocation set containing:- Revoked sessions SHOULD be retained for
max_session_duration(implementation-defined, default: 24h) - Revoked tokens SHOULD be retained for
nonce_windowduration (then naturally expire)
5.6.3 Revocation Check
Token validation MUST include revocation check:5.6.4 Local Revocation
For local-only deployments (server.enabled: false), implementations SHOULD provide:
- Signal handler (e.g.,
SIGUSR1) to trigger session termination - File-based revocation list that is polled periodically
- API for programmatic revocation (implementation-defined)
5.7 Compatibility with Agentic JWT
AIP Identity Tokens are designed to be compatible with the emerging Agentic JWT standard (draft-goswami-agentic-jwt-00). Implementations MAY support Agentic JWT by:- Computing
agent_checksumfrom policy content - Including
agent_proofclaims in JWT tokens - Supporting the
agent_checksumOAuth grant type
5.8 Key Management (v1alpha2)
This section defines key management requirements for JWT signing whenserver.enabled: true.
5.8.1 Key Configuration
| Field | Type | Description |
|---|---|---|
signing_algorithm | string | JWT signing algorithm (see 5.8.2) |
key_source | string | generate, file, or external |
key_path | string | Path to key file (PEM format) |
rotation_period | duration | How often to rotate keys |
jwks_endpoint | string | Endpoint path for JWKS (when server.enabled) |
5.8.2 Supported Algorithms
| Algorithm | Key Type | Security | Performance | Recommendation |
|---|---|---|---|---|
ES256 | ECDSA P-256 | High | Fast | Default, RECOMMENDED |
ES384 | ECDSA P-384 | Higher | Medium | High-security environments |
EdDSA | Ed25519 | High | Fastest | Performance-critical |
RS256 | RSA 2048+ | High | Slow | Legacy compatibility |
HS256 | HMAC | Medium | Fastest | Local-only, NOT for server mode |
HS256 uses symmetric keys and MUST NOT be used when server.enabled: true. Implementations MUST reject this configuration.
5.8.3 Key Sources
generate (default):- Implementation generates and manages keys automatically
- Private key stored in memory (RECOMMENDED) or encrypted file
- JWKS endpoint exposes public keys for verification
- Key loaded from PEM file
- Implementation MUST NOT expose private key
- Key rotation requires file replacement and restart/reload
- Keys managed by external KMS (HashiCorp Vault, AWS KMS, etc.)
- Implementation-defined integration
5.8.4 Key Rotation
Keys SHOULD be rotated periodically to limit exposure from key compromise. Rotation process:- New keys MUST be added to JWKS before becoming active
- Old keys MUST remain in JWKS for at least
token_ttlafter rotation - Implementations MUST support at least 2 concurrent keys in JWKS
5.8.5 JWKS Endpoint
Whenserver.enabled: true, implementations MUST expose a JWKS endpoint for token verification.
Request:
- Clients SHOULD cache JWKS responses
Cache-Controlheader SHOULD indicate TTL (default: 1 hour)- Clients MUST refresh JWKS when encountering unknown
kid
5.8.6 Key Compromise Response
If a signing key is compromised:- Immediate: Remove compromised key from JWKS
- Generate: Create new signing key
- Revoke: Revoke all sessions that used compromised key
- Rotate: Force token rotation for all active sessions
- Audit: Log compromise event with forensic details
6. Server-Side Validation (v1alpha2)
This section defines the optional HTTP server for remote policy validation.6.1 Overview
The AIP server provides:- Remote validation: Validate tool calls from external systems
- Health checks: Integration with load balancers and orchestrators
- Metrics: Prometheus-compatible metrics export
6.2 Validation Endpoint
6.2.1 Request Format
| Field | Type | Required | Description |
|---|---|---|---|
tool | string | Yes | Tool name to validate |
arguments | object | Yes | Tool arguments |
Authorization header using the Bearer scheme:
- Request body parameters
- Query string parameters
- Cookies
- Token leakage via access logs (query strings)
- CSRF attacks (body parameters)
- Cross-origin token theft (cookies)
identity.require_token: true, requests without a valid Authorization header MUST be rejected with HTTP 401.
6.2.2 Response Format
| Field | Type | Description |
|---|---|---|
decision | string | allow, block, or ask |
reason | string | Human-readable explanation |
violations | array | List of policy violations (if any) |
token_status | object | Token validity information (if token provided) |
6.2.3 Error Responses
| HTTP Status | Error Code | Description |
|---|---|---|
| 400 | invalid_request | Malformed request body |
| 401 | token_required | Token required but not provided |
| 401 | token_invalid | Token validation failed |
| 403 | forbidden | Tool not allowed |
| 429 | rate_limited | Rate limit exceeded |
| 500 | internal_error | Server error |
6.3 Health Endpoint
6.3.1 Request
6.3.2 Response
| Status | HTTP Code | Description |
|---|---|---|
healthy | 200 | Server is ready |
degraded | 200 | Server running with warnings |
unhealthy | 503 | Server not ready |
6.4 Metrics Endpoint
When enabled, the metrics endpoint exposes Prometheus-compatible metrics.6.4.1 Request
6.4.2 Metrics
| Metric | Type | Description |
|---|---|---|
aip_requests_total | counter | Total validation requests |
aip_decisions_total | counter | Decisions by type (allow/block/ask) |
aip_violations_total | counter | Policy violations by type |
aip_token_validations_total | counter | Token validations (valid/invalid) |
aip_revocations_total | counter | Revocation events by type (session/token) |
aip_active_sessions | gauge | Currently active sessions |
aip_request_duration_seconds | histogram | Request latency |
aip_policy_hash | gauge | Current policy hash (as label) |
6.5 Revocation Endpoint (v1alpha2)
The revocation endpoint allows immediate invalidation of tokens or sessions.6.5.1 Request Format
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | session or token |
session_id | string | Conditional | Session UUID (required if type=session) |
token_nonce | string | Conditional | Token nonce (required if type=token) |
reason | string | No | Audit trail reason |
6.5.2 Response Format
6.5.3 Error Responses
| HTTP Status | Error Code | Description |
|---|---|---|
| 400 | invalid_request | Missing required fields |
| 401 | unauthorized | Admin authentication required |
| 404 | not_found | Session or token not found |
| 500 | internal_error | Server error |
6.5.4 Authorization
The revocation endpoint MUST require elevated privileges:- Separate admin token (not user identity token)
- mTLS with admin certificate
- Operator API key
6.5.5 Audit Logging
Revocation events MUST be logged:6.6 Authentication
The validation endpoint SHOULD be protected. Implementations MUST support:- Bearer tokens: AIP Identity Tokens in Authorization header
- mTLS: Mutual TLS for service-to-service authentication
- API keys
- OAuth 2.0 tokens (for integration with external IdPs)
7. Error Codes
AIP defines the following JSON-RPC error codes:| Code | Name | Description |
|---|---|---|
| -32001 | Forbidden | Tool not in allowed_tools list |
| -32002 | Rate Limited | Rate limit exceeded |
| -32004 | User Denied | User rejected approval prompt |
| -32005 | User Timeout | Approval prompt timed out |
| -32006 | Method Not Allowed | JSON-RPC method not permitted |
| -32007 | Protected Path | Access to protected path blocked |
| -32008 | Token Required | Identity token required but not provided (new) |
| -32009 | Token Invalid | Identity token validation failed (new) |
| -32010 | Policy Signature Invalid | Policy signature verification failed (new) |
| -32011 | Token Revoked | Token or session explicitly revoked (new) |
| -32012 | Audience Mismatch | Token audience does not match expected value (new) |
| -32013 | Schema Mismatch | Tool schema hash does not match policy (new) |
| -32014 | DLP Redaction Failed | Request redaction produced invalid content (new) |
7.1 Error Response Format
7.2 New Error Codes (v1alpha2)
-32008 Token Required
Returned whenidentity.require_token: true and no token is provided.
-32009 Token Invalid
Returned when token validation fails.token_error values:
token_expired- Token past expiration timepolicy_changed- Policy hash mismatchsession_mismatch- Session binding mismatchbinding_mismatch- Strict binding validation failedreplay_detected- Nonce reuse detectedaudience_mismatch- Token audience does not match expected value (new)malformed- Token structure invalid
token_revoked errors use the dedicated -32011 error code for clearer operational distinction.
-32010 Policy Signature Invalid
Returned when policy signature verification fails.-32011 Token Revoked (v1alpha2)
Returned when a token or its session has been explicitly revoked via the revocation endpoint.revocation_type values:
session- Entire session was revoked (all tokens invalid)token- Specific token was revoked (by nonce)
-32012 Audience Mismatch (v1alpha2)
Returned when the token’saud claim does not match the expected audience.
token_audience value SHOULD be logged for forensics but MAY be omitted from client responses to prevent information disclosure.
-32013 Schema Mismatch (v1alpha2)
Returned when a tool’s schema hash does not match the expected value in the policy.- Alert security teams immediately
- Log full schema details for forensic analysis
- Consider blocking the MCP server until verified
8. Audit Log Format
[Section 8.1-8.3 remain unchanged from v1alpha1]8.1 Required Fields
| Field | Type | Description |
|---|---|---|
timestamp | ISO 8601 | Time of the decision |
direction | string | upstream (client→server) or downstream (server→client) |
decision | string | ALLOW, BLOCK, ALLOW_MONITOR, RATE_LIMITED |
policy_mode | string | enforce or monitor |
violation | boolean | Whether a policy violation was detected |
8.2 Optional Fields
| Field | Type | Description |
|---|---|---|
method | string | JSON-RPC method name |
tool | string | Tool name (for tools/call) |
args | object | Tool arguments (SHOULD be redacted) |
failed_arg | string | Argument that failed validation |
failed_rule | string | Regex pattern that failed |
session_id | string | Session identifier (new) |
token_id | string | Token nonce (new) |
policy_hash | string | Policy hash at decision time (new) |
8.3 Example
8.4 Identity Events (v1alpha2)
Identity-related events SHOULD be logged:Token Issued
Token Rotated
Token Validation Failed
9. Conformance
9.1 Conformance Levels
| Level | Requirements |
|---|---|
| Basic | Method authorization, tool allowlist, error codes |
| Full | Basic + argument validation, rate limiting, DLP, audit logging |
| Extended | Full + Human-in-the-Loop (action=ask) |
| Identity | Full + Identity tokens, session management (new) |
| Server | Identity + Server-side validation endpoints (new) |
9.2 Conformance Testing
Implementations MUST pass the conformance test suite to claim AIP compliance. The test suite consists of:- Schema validation tests: Verify policy parsing
- Decision tests: Input → expected decision
- Normalization tests: Verify Unicode handling
- Error format tests: Verify JSON-RPC errors
- Identity tests: Token lifecycle, rotation, validation (new)
- Server tests: HTTP endpoint behavior (new)
spec/conformance/ for test vectors.
9.3 Implementation Requirements
Implementations MUST:- Parse
apiVersion: aip.io/v1alpha2documents - Reject documents with unknown
apiVersion - Apply NFKC normalization to names
- Return specified error codes
- Support
enforceandmonitormodes
- Log decisions in the specified format
- Support DLP scanning
- Support rate limiting
- Support identity tokens (for Identity conformance level)
- Use any regex engine with RE2 semantics
- Implement additional security features (egress control, sandboxing)
- Implement server-side validation (for Server conformance level)
10. Security Considerations
10.0 Threat Model
This section defines the security assumptions and threat model for AIP.10.0.1 Trust Boundaries
AIP defines the following trust boundaries:| Component | Trust Level | Rationale |
|---|---|---|
| User | Trusted | Defines policy, approves sensitive operations |
| Policy file | Trusted | Integrity verified via signature (when present) |
| AIP Engine | Trusted | Assumed correctly implemented |
| Agent (LLM) | Untrusted | Subject to prompt injection, jailbreaks |
| MCP Server | Untrusted | May be malicious or compromised |
| Tool definitions | Untrusted | May contain poisoned descriptions |
| External resources | Untrusted | May contain indirect prompt injections |
10.0.2 Threats In Scope
AIP is designed to mitigate the following threats:| Threat | Attack Vector | AIP Mitigation |
|---|---|---|
| Unauthorized tool access | Agent calls tools outside intended scope | allowed_tools allowlist, fail-closed default |
| Argument manipulation | Agent passes malicious arguments | allow_args regex validation, strict_args |
| Privilege escalation | Agent accesses sensitive files | protected_paths, path expansion |
| Data exfiltration (response) | Sensitive data in tool responses | DLP scanning with redaction |
| Resource exhaustion | Agent floods tool calls | Rate limiting per tool |
| Policy bypass (Unicode) | Homoglyph attacks on tool names | NFKC normalization |
| Session hijacking | Stolen token reuse | Session binding, nonce tracking |
| Policy tampering | Agent modifies policy | Protected paths, signature verification |
| Replay attacks | Reuse of captured tokens | Nonce validation, short TTL |
10.0.3 Threats Out of Scope
The following threats are explicitly not addressed by this specification:| Threat | Reason | Potential Future Extension |
|---|---|---|
| Network egress | Platform-specific enforcement | Appendix D.1 |
| Tool poisoning | ✅ Addressed in v1alpha2 via schema_hash | Section 3.5.4 |
| Rug pull attacks | Requires runtime behavior attestation | Future: tool attestation |
| Subprocess sandboxing | OS-specific | Implementation-defined |
| Hardware tampering | Physical security | Out of scope |
| Side-channel attacks | Implementation-specific | Out of scope |
| Prompt injection prevention | LLM-level defense | Complementary to AIP |
10.0.4 Security Assumptions
AIP makes the following assumptions:- Policy integrity: The policy file has not been tampered with at load time (verified via signature when
metadata.signatureis present) - Engine integrity: The AIP implementation is correct and not compromised
- Cryptographic security: SHA-256, Ed25519, and other algorithms remain secure
- Clock accuracy: System clocks are reasonably synchronized (within TTL tolerance)
- TLS security: Transport encryption prevents eavesdropping and tampering
10.0.5 Defense in Depth
AIP implements multiple layers of defense:10.1 Policy File Protection
The policy file itself MUST be protected from modification by the agent. Implementations MUST automatically add the policy file path toprotected_paths.
10.2 Regex Denial of Service (ReDoS)
Implementations MUST use a regex engine that guarantees linear-time matching (RE2 or equivalent). Pathological patterns like(a+)+$ MUST NOT cause exponential execution time.
10.3 Unicode Normalization
Implementations MUST apply NFKC normalization to prevent homoglyph attacks. However, implementers should be aware that NFKC does not normalize all visually similar characters (e.g., Cyrillic ‘а’ vs Latin ‘a’).10.4 Monitor Mode Risks
Monitor mode allows all requests through. Implementations SHOULD warn users when monitor mode is enabled in production environments.10.5 Audit Log Integrity
Audit logs SHOULD be written to a location not writable by the agent. Implementations MAY support log signing or forwarding to external systems.10.6 Identity Token Security (v1alpha2)
10.6.1 Token Storage
Identity tokens SHOULD be stored in memory only, not persisted to disk. If persistence is required, tokens MUST be encrypted at rest.10.6.2 Token Transmission
Tokens transmitted over the network MUST use TLS 1.2 or later. Implementations MUST NOT send tokens over unencrypted connections.10.6.3 Token Lifetime
Short token lifetimes (5-15 minutes) limit the window for token theft. Implementations SHOULD NOT allow token_ttl greater than 1 hour.10.6.4 Replay Prevention
Implementations MUST track nonces to prevent token replay within thenonce_window duration.
Atomic Operation Requirement (v1alpha2):
Nonce validation MUST be performed as an atomic check-and-record operation to prevent race conditions in concurrent environments:
| Strategy | Pros | Cons | Recommended For |
|---|---|---|---|
| In-memory (sync.Map) | Fast, simple | Lost on restart | Single-instance, short TTL |
| Redis (SET NX EX) | Atomic, distributed | Latency, dependency | Multi-instance (RECOMMENDED) |
| PostgreSQL (INSERT ON CONFLICT) | Atomic, durable | Higher latency | Multi-instance with DB |
| Bloom filter | Space efficient | False positives, no TTL | NOT RECOMMENDED |
nonce_window to bound storage:
- Shared storage is REQUIRED - Local-only nonce tracking allows replay across instances
- Atomic operations are REQUIRED - Use storage primitives that guarantee atomicity (Redis
SET NX, DB unique constraints) - TTL-based expiration - Set storage TTL to
nonce_window + clock_skew_tolerance(recommended: 30 seconds tolerance) - Clock synchronization - All instances SHOULD use NTP with drift < 1 second
replay_detected).
10.6.5 Session Binding
Session binding prevents stolen tokens from being used in different contexts. Thestrict binding mode provides the strongest guarantees but may cause issues with process restarts.
10.7 Server Endpoint Security (v1alpha2)
10.7.1 Authentication
Validation endpoints MUST require authentication. Unauthenticated endpoints allow attackers to probe policy configurations.10.7.2 Rate Limiting
Validation endpoints SHOULD implement rate limiting to prevent denial of service attacks.10.7.3 Information Disclosure
Error responses SHOULD NOT reveal detailed policy configuration. Thereason field SHOULD provide minimal information needed to diagnose issues.
11. IANA Considerations
This specification requests registration of the following:11.1 Media Type
- Type name: application
- Subtype name: vnd.aip.policy+yaml
- Required parameters: None
- File extension: .yaml, .yml
11.2 URI Scheme
This specification uses theaip.io namespace for versioning:
aip.io/v1alpha1- Previous specificationaip.io/v1alpha2- This specification
Appendix A: Complete Schema Reference
Appendix B: Changelog
v1alpha2 (2026-01-24)
Identity and Session Management- Added
identityconfiguration section- Token generation and rotation with configurable TTL
- Session binding (
process,policy,strict) - Policy hash computation for integrity
nonce_windowfor bounded replay prevention storagepolicy_transition_gracefor gradual policy rolloutsaudiencefor token audience binding (RFC 8707 alignment)nonce_storagefor distributed nonce tracking (Redis, PostgreSQL)keysfor JWT signing key management and rotation
- Added token revocation mechanism (Section 5.6)
- Session and token-level revocation
- Revocation storage and pruning
- Added Section 5.8 Key Management
- Signing algorithm selection (ES256, EdDSA, RS256)
- Key rotation with grace periods
- JWKS endpoint for remote verification
- Key compromise response procedures
- Added Section 5.3.2 Binding Object
- Hostname normalization for containers and Kubernetes
- Container ID and Pod UID binding support
- Added
serverconfiguration section- HTTP validation endpoint (
/v1/validate) - Revocation endpoint (
/v1/revoke) - JWKS endpoint (
/v1/jwks) for key distribution - Health and metrics endpoints
failover_mode:fail_closed,fail_open,local_policyfail_open_constraintsfor safer fail_open deployments- Configurable
timeoutfor validation requests
- HTTP validation endpoint (
- Mandated JWT encoding when
server.enabled: true - Token transmission via Authorization header only (RFC 6750)
- Added
schema_hashto tool_rules (Section 3.5.4)- Cryptographic verification of tool definitions
- Tool poisoning attack prevention
- SHA-256/384/512 algorithm support
- Added
scan_requestsfor request-side DLP scanning - Added
max_scan_sizeto prevent ReDoS - Added
on_request_matchaction (block,redact,warn) - Added
on_redaction_failurehandling (block,allow_original,reject) - Added
log_original_on_failurefor forensics - Added
scopeto patterns (request,response,all)
- Added Section 10.0 Threat Model
- Trust boundaries diagram
- Threats in scope / out of scope
- Defense in depth layers
- Added
metadata.signaturefor policy integrity (Ed25519) - Atomic nonce operations required for replay prevention
- Tool poisoning now addressed via schema hashing
- Enhanced replay prevention documentation with distributed storage
- Added rotation_interval validation (must be < token_ttl)
- Policy load failures for invalid configurations
- Added -32008 Token Required
- Added -32009 Token Invalid (with detailed error types)
- Added -32010 Policy Signature Invalid
- Added -32011 Token Revoked (distinct from -32009)
- Added -32012 Audience Mismatch
- Added -32013 Schema Mismatch (tool poisoning detection)
- Added -32014 DLP Redaction Failed
- Added Identity conformance level
- Added Server conformance level
- Added identity and server tests to conformance suite
v1alpha1 (2026-01-20)
- Initial draft specification
- Defined core policy schema
- Defined evaluation semantics
- Defined error codes
- Defined audit log format
Appendix C: References
- Model Context Protocol (MCP)
- MCP Authorization (2025-06-18)
- JSON-RPC 2.0 Specification
- RFC 2119 - Key words for use in RFCs
- RFC 7519 - JSON Web Token (JWT)
- RFC 8785 - JSON Canonicalization Scheme (JCS)
- Unicode NFKC Normalization
- RE2 Syntax
- Agentic JWT (draft-goswami-agentic-jwt-00)
Appendix D: Future Extensions
This appendix describes features under consideration for future versions of AIP.D.1 Network Egress Control
Status: Proposed for v1beta1 [Content unchanged from v1alpha1]D.2 Policy Inheritance
Status: Under Discussion Allow policies to extend base policies:D.3 External Identity Federation
Status: Proposed for v1beta1 Allow policies to integrate with external identity providers:oidc- OpenID Connect providersspiffe- SPIFFE/SPIRE workload identity
D.4 Telemetry and Metrics
Status: Partially implemented in v1alpha2 (metrics endpoint) Full telemetry specification:D.5 Advanced Policy Expressions
Status: Under Discussion Support for CEL (Common Expression Language) or Rego for complex validation:D.6 Agentic JWT Compatibility
Status: Under Discussion for v1beta1 Full compatibility with the Agentic JWT specification:| AIP Field | Agentic JWT Claim |
|---|---|
policy_hash | agent_proof.agent_checksum |
session_id | intent.workflow_id |
metadata.name | sub (subject) |
tool_rules | Workflow steps |
Appendix E: Implementation Notes
E.1 Reference Implementation
The reference implementation is available at: https://github.com/ArangoGutierrez/agent-identity-protocol It provides:- Go-based proxy (
aip-proxy) - Policy engine (
pkg/policy) - DLP scanner (
pkg/dlp) - Audit logger (
pkg/audit) - Identity manager (
pkg/identity) (v1alpha2) - HTTP server (
pkg/server) (v1alpha2)
E.2 Testing Against Conformance Suite
E.3 Token Implementation Guidance
Generating Secure Nonces
Computing Policy Hash
E.4 Registering Your Implementation
Implementations that pass the conformance suite may be listed in the official registry. Submit a PR to the AIP repository with:- Implementation name and URL
- Conformance level achieved (Basic/Full/Extended/Identity/Server)
- Platform support matrix