1. Create Dual Keys & Approve a Grant
Generates two non-extractable browser signing keys (one for human approval, one for the agent session), verifies the Worker's locked CSP, and records the signed grant in the edge SQLite ledger.
Delegated Authority · Zero-Key Narrow MCP Gateway
Giving an automated tool a raw API key—or a wide proxy that can call any URL—turns one bad prompt into full account compromise. This gateway hides upstream credentials inside a Cloudflare Durable Object SQLite ledger behind a narrow 4-tool Model Context Protocol (MCP) front door, requires two separate SubtleCrypto ECDSA P-256 proofs (human approval + per-call agent signature), and checks its browser Worker's securitypolicyviolation policy before accepting keys.
Connecting an agent straight to wide REST catalogs or static API keys floods its context with dozens of schemas and lets prompt injection redirect requests or leak secrets in tool output.
Zero-key narrow MCP gateways let browser-hosted agents discover and run fixed, schema-checked operations—with human-approved call budgets, instant epoch revocation, single-use nonces, and zero upstream credentials in the client.
Mint two separate P-256 keys and enroll a delegation, run a valid fixed MCP operation (200), then launch all 6 live red-team attacks—URL injection, replay, 1-byte tamper, revoked epoch, key collapse, and permissive Worker CSP—while scanning every byte for canary leaks.
Follow these three steps in order to create distinct human and agent signing keys, execute one allowed MCP operation, and attack the gateway with six live exploits.
Generates two non-extractable browser signing keys (one for human approval, one for the agent session), verifies the Worker's locked CSP, and records the signed grant in the edge SQLite ledger.
Signs the exact operation arguments inside the locked browser Worker and sends invoke_operation to POST /mcp, where the edge server attaches UPSTREAM_CANARY_TOKEN privately.
Runs URL injection, nonce replay, 1-byte argument tampering, post-revocation calls, single-key collapse, and a permissive Worker CSP probe—then checks every byte for secret leaks.
Each button sends a real signed exploit to the Durable Object ledger (CustodianLedger) or tests browser Worker isolation, then scans every response and audit row for UPSTREAM_CANARY_TOKEN.
Tries to smuggle custom url and headers.Authorization fields into invoke_operation. Expected: blocked with 403 ARBITRARY_TARGET_FORBIDDEN.
Re-sends an already accepted agentProof and one-time nonce verbatim against SQLite consumed_nonces. Expected: blocked with 409 NONCE_REPLAYED.
Signs {"repo":"aifocus","limit":2} then changes one byte (2 → 3) after signing. Expected: blocked with 401 PROOF_DIGEST_MISMATCH.
Captures a valid proof, increments the ledger's global revocationEpoch, and submits the stale proof. Expected: blocked with 401 EPOCH_REVOKED.
Submits the same P-256 key for both human approval and agent signing (agentPublicJwk === humanPublicJwk). Expected: blocked with 403 KEY_COLLAPSE_FORBIDDEN.
Compares the locked Worker (fit) against an unrestricted Worker (unfit that refuses key admission) and scans every trace for leaks.
Run any attack button above to inspect live HTTP/MCP rejections and DO SQLite receipts.
loading…
0 client / 0 server
0 B
exact, base64, suffix, regex
Canary scan results appear here after any attack or manual scan.
Browser WebCrypto non-extractable keys enrolled in DO SQLite CustodianLedger
Not generated
Not generated
Dedicated Worker verifies securitypolicyviolation.originalPolicy before holding AgentSessionKey
Running initial CSP self-check in /workers/secret-custodian.js…
Live Streamable HTTP POST /mcp (2025-03-26) — strictly 4 fixed tools, zero generic proxy
Select a tool above and click "Execute MCP Tool Call" to inspect live JSON-RPC 2.0 responses.
Inspect every allow/deny audit row stored in SQLite, the raw human and agent P-256 proof envelopes, and the live JSON-RPC HTTP wire log.
| # | Decision | HTTP | Code | Tool / Op | Epoch | Canary | Detail |
|---|
Enroll a delegation to inspect humanProof.
Invoke an operation to inspect byte-bound agentProof and SHA-256 digest.
Wire transcript populates as you enroll, invoke, or run red-team probes.
Generic API proxies and raw bearer tokens inside agent runtimes give prompt-injected sessions ambient access to arbitrary endpoints, HTTP methods, and headers—and leak credentials through tool outputs or error traces.
Reduce the agent interface to four fixed MCP tools (search_capabilities, describe_operation, connection_status, invoke_operation) where every call requires distinct human delegation and per-call agent P-256 proofs.
A dedicated browser Worker self-checks its Content-Security-Policy via securitypolicyviolation before holding AgentSessionKey. The Cloudflare Durable Object verifies both P-256 signatures, active revocationEpoch, and SQLite consumed_nonces before injecting UPSTREAM_CANARY_TOKEN inside a fixed connector.
/workers/secret-custodian.jsCSP: default-src 'none'; script-src 'self'; connect-src 'self'
https://example.invalid/... and verifies securitypolicyviolation.originalPolicy before accepting AgentSessionKey{ agentJwkThumbprint, allowedOps, maxCalls, epoch, exp }{ opId, argsJson, nonce, epoch, ts }src/custodian-ledger.ts403 ARBITRARY_TARGET_FORBIDDEN) and key collapse (403 KEY_COLLAPSE_FORBIDDEN)humanProof + recomputed SHA-256 agentProof (401 PROOF_DIGEST_MISMATCH)revocationEpoch (401 EPOCH_REVOKED) and atomic SQLite consumed_nonces (409 NONCE_REPLAYED)UPSTREAM_CANARY_TOKEN strictly inside fixed connector & scan responseOnly 4 fixed MCP tools exposed: search_capabilities, describe_operation, connection_status, invoke_operation.
UPSTREAM_CANARY_TOKEN stays inside DO SQLite
Zero secret material in error or audit receipt
Blocks URL/header injection, nonce replay, 1-byte tamper, stale epoch, key collapse, and unfit Worker CSP.
Replacing generic bearer-token proxies with fixed typed operations, dual ECDSA P-256 proofs verified in a Durable Object SQLite ledger, and a browser Worker that validates its own CSP before handling session keys.
// Ambient API key + arbitrary request surface:
// Prompt injection can call any URL or leak Authorization header
await fetch(agentProvidedUrl, {
method: agentProvidedMethod,
headers: { Authorization: `Bearer ${process.env.PROVIDER_KEY}` },
body: agentProvidedBody,
});
// Fixed opId + human delegation proof + byte-bound agent digest:
await fetch("/mcp", {
method: "POST",
body: JSON.stringify({
jsonrpc: "2.0", id: 1, method: "tools/call",
params: {
name: "invoke_operation",
arguments: { delegationId, opId: "repo.release.list@v1",
argsJson, humanPublicJwk, agentPublicJwk, humanProof, agentProof }
}
})
});
Modeled directly on port-authority/sites/router/call-worker.js: the worker probes a cross-origin URL that its own connect-src 'self' policy must block and verifies event.originalPolicy before holding AgentSessionKey.
const EXPECTED_CSP = "default-src 'none'; script-src 'self'; connect-src 'self'";
self.addEventListener("securitypolicyviolation", (event) => {
const observed = normalizePolicy(event.originalPolicy);
if (observed === EXPECTED_CSP) {
isFit = true;
self.postMessage({ t: "fit", observedPolicy: observed });
}
}, { once: true });
fetch("https://example.invalid/csp-self-check-expected-to-be-blocked-external");
Caller-selected URLs, arbitrary HTTP methods/headers, raw provider tokens inside agent prompts/memory, and silent single-key collapse.
RFC 7638 distinct key thumbprints, SHA-256 byte-bound argsJson digests, atomic SQLite nonces, monotonic revocationEpoch, and Worker CSP self-verification.
Revocation requires checking shared authoritative state (DO SQLite) on every invocation; offline bearer tokens cannot enforce instant epoch revocation or atomic single-use nonces.
SubtleCrypto ECDSA P-256securitypolicyviolation eventconnect-src 'self' lock before holding keys.CustodianLedger)