Comprehensive test vectors for validating AAP (Agent Authorization Profile) implementations.
This directory contains test vectors organized by category:
- valid-tokens/ - Tokens that should pass validation
- invalid-tokens/ - Tokens that should fail validation with specific errors
- constraint-violations/ - Scenarios testing constraint enforcement
- edge-cases/ - Boundary conditions and special cases
Test vectors enable:
- Implementation Validation - Verify your AS/RS correctly implements AAP
- Interoperability Testing - Ensure different implementations work together
- Regression Testing - Catch bugs when updating implementations
- Specification Clarification - Provide concrete examples of abstract rules
Each test vector is a JSON file with the following structure:
{
"name": "test-vector-name",
"description": "Human-readable description",
"token_payload": { /* JWT payload */ },
"test_cases": [
{
"name": "test_case_name",
"request": { /* Request context */ },
"expected_result": "AUTHORIZED|FORBIDDEN|REJECTED",
"error_code": "error_code_if_applicable",
"description": "What this test validates"
}
],
"metadata": {
"specification_section": "Reference to spec section",
"created": "2025-02-01",
"version": "1.0"
}
}| File | Description | Spec Sections Tested |
|---|---|---|
01-basic-research-agent.json |
Basic agent with web search capability | 7.5, 5.6.2 (Capability, Domain constraints) |
02-delegated-token-depth1.json |
First-level delegation with privilege reduction | 5.7, RFC 8693 (Token Exchange) |
03-cms-agent-with-oversight.json |
Agent with human approval requirements | 7.6, 5.2 (Oversight) |
04-time-window-constrained.json |
Time window and data constraints | 5.6.3, 5.6.5 (Time, Data constraints) |
Coverage:
- Basic token validation ✓
- Delegation (depth 0, 1) ✓
- Oversight requirements ✓
- Domain constraints ✓
- Time windows ✓
- HTTP method restrictions ✓
- Request size limits ✓
| File | Description | Error Type |
|---|---|---|
01-expired-token.json |
Expired token with clock skew tests | Token expired |
02-wrong-audience.json |
Audience mismatch | Invalid audience |
03-missing-required-claims.json |
Missing agent/task/capabilities claims (5 variants) | Missing claims |
04-excessive-delegation.json |
Delegation depth > max_depth | Excessive delegation |
05-invalid-delegation-chain.json |
Malformed delegation chains (3 variants) | Invalid chain |
06-invalid-action-format.json |
Action names violating ABNF grammar (5 variants) | Invalid format |
Coverage:
- Expiration validation ✓
- Audience validation ✓
- Required claims validation ✓
- Delegation depth enforcement ✓
- Chain structure validation ✓
- Action name format (ABNF) ✓
| File | Description | Constraints Tested |
|---|---|---|
01-rate-limit-exceeded.json |
Rate limiting violations (hourly, per-minute) | Rate limits |
02-domain-restrictions.json |
Domain allowlist/blocklist violations | Domain constraints |
Coverage:
max_requests_per_hour(fixed window) ✓max_requests_per_minute(sliding window) ✓domains_allowed(DNS suffix matching) ✓domains_blocked(precedence) ✓
| File | Description | Edge Conditions |
|---|---|---|
01-clock-skew.json |
Clock skew tolerance (5-minute window) | Time boundaries |
02-maximum-delegation-depth.json |
Delegation at max depth | Depth boundaries |
03-empty-constraints.json |
Minimal/empty constraints, multiple capabilities | Constraint edge cases |
Coverage:
- Clock skew tolerance (±5 minutes) ✓
- Delegation depth boundaries (0, max, max+1) ✓
- Empty constraints handling ✓
- Multiple capabilities (OR semantics) ✓
Use the provided validator script:
cd test-vectors
python3 validate_test_vectors.py --allOptions:
# Validate specific category
python3 validate_test_vectors.py --category valid-tokens
# Validate specific file
python3 validate_test_vectors.py --file valid-tokens/01-basic-research-agent.json
# Validate against live AS/RS
python3 validate_test_vectors.py --as http://localhost:8080 --rs http://localhost:8081
# Generate report
python3 validate_test_vectors.py --all --report report.html- Sign the token:
import jwt
import json
with open('valid-tokens/01-basic-research-agent.json') as f:
vector = json.load(f)
with open('../keys/as_private_key.pem', 'rb') as f:
private_key = f.read()
token = jwt.encode(
vector['token_payload'],
private_key,
algorithm='ES256',
headers={'kid': 'aap-as-key-1'}
)
print(token)- Validate with RS:
import requests
response = requests.get(
'http://localhost:8081/api/search',
headers={'Authorization': f'Bearer {token}'},
params={'q': 'test', 'url': 'https://example.org/data'}
)
print(response.status_code, response.json())Total Test Vectors: 15 files Total Test Cases: 80+ individual tests
| Section | Test Vectors | Coverage |
|---|---|---|
| 5.5 (Action Grammar) | 1 | ABNF validation |
| 5.6.1 (Rate Limits) | 1 | Hourly, per-minute |
| 5.6.2 (Domain Constraints) | 2 | Allowlist, blocklist, DNS matching |
| 5.6.3 (Time Windows) | 1 | Start, end, clock skew |
| 5.6.5 (Data Constraints) | 1 | Methods, size limits |
| 5.7 (Delegation Semantics) | 2 | Depth, chain, privilege reduction |
| 7.1 (Token Validation) | 2 | Signature, expiration, audience |
| 7.3 (Agent Identity) | 1 | Required fields |
| 7.4 (Task Binding) | 1 | Required fields |
| 7.5 (Capability Enforcement) | 4 | Matching, constraints |
| 7.6 (Oversight) | 1 | Approval requirements |
| 7.7 (Delegation Validation) | 3 | Depth, chain validation |
| RFC 8693 (Token Exchange) | 1 | Delegation with reduction |
| Feature | Valid | Invalid | Violations | Edge Cases |
|---|---|---|---|---|
| Basic validation | 4 | 3 | - | - |
| Delegation | 1 | 2 | - | 1 |
| Rate limiting | - | - | 1 | - |
| Domain constraints | 1 | - | 1 | - |
| Time constraints | 1 | - | - | 1 |
| Oversight | 1 | - | - | - |
| Action format | - | 1 | - | - |
| Clock skew | - | 1 | - | 1 |
| Constraints semantics | - | - | - | 1 |
To test interoperability between different AAP implementations:
-
Token Issuance Test:
- Implementation A (AS) signs test vector token
- Implementation B (RS) validates the token
- Compare actual result with
expected_result
-
Constraint Enforcement Test:
- Use constraint violation test vectors
- Verify both implementations reject with same error code
-
Delegation Test:
- Implementation A issues parent token
- Implementation A performs Token Exchange
- Implementation B validates derived token
- Verify privilege reduction is correct
To add new test vectors:
- Copy template from existing vector
- Update
token_payloadwith test-specific claims - Define
test_caseswith expected results - Add
metadatawith spec section references - Place in appropriate category directory
- Update this README catalog
- Run validator to ensure format is correct
- Unique
name(no duplicates) - Clear
description - Valid JSON structure
- Conforms to AAP JSON Schema
-
test_caseshave expected results -
metadata.specification_sectionreferences correct sections - File named with sequential number (01-, 02-, etc.)
Implementations SHOULD pass all test vectors in valid-tokens/ and edge-cases/.
Implementations MUST correctly reject all test vectors in invalid-tokens/ and constraint-violations/ with the specified error codes.
Test vectors are part of the AAP reference implementation. See main project LICENSE.