@agent-custody/receipts 0.16.5 → 0.16.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -13
- package/dist/capture.d.ts +2 -0
- package/dist/capture.js +13 -2
- package/dist/check.d.ts +1 -1
- package/dist/check.js +34 -10
- package/dist/cli.js +54 -9
- package/dist/config.d.ts +27 -2
- package/dist/config.js +66 -2
- package/dist/console-page.js +144 -50
- package/dist/deny-report.d.ts +7 -0
- package/dist/deny-report.js +8 -3
- package/dist/design.d.ts +11 -0
- package/dist/design.js +91 -0
- package/dist/door-app.d.ts +28 -0
- package/dist/door-app.js +244 -0
- package/dist/door-partner.d.ts +66 -0
- package/dist/door-partner.js +94 -0
- package/dist/door.d.ts +139 -10
- package/dist/door.js +297 -137
- package/dist/gateway-http.d.ts +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +5 -1
- package/dist/log-admin.js +100 -59
- package/dist/log-store.d.ts +8 -2
- package/dist/log-store.js +22 -12
- package/dist/perathos.d.ts +50 -0
- package/dist/perathos.js +188 -0
- package/dist/portal.d.ts +66 -5
- package/dist/portal.js +895 -242
- package/dist/receipt.d.ts +4 -1
- package/dist/session-audit.d.ts +46 -0
- package/dist/session-audit.js +150 -0
- package/dist/site-links.d.ts +23 -0
- package/dist/site-links.js +29 -0
- package/dist/verify.js +44 -4
- package/dist/web-bot-auth.d.ts +105 -0
- package/dist/web-bot-auth.js +508 -0
- package/docs/acs.md +2 -0
- package/docs/approvals.md +1 -1
- package/docs/completeness.md +1 -1
- package/docs/configuration.md +2 -0
- package/docs/console.md +11 -2
- package/docs/door-languages.md +168 -0
- package/docs/door-middleware.md +216 -0
- package/docs/door-quickstart.md +1 -1
- package/docs/door-signals.md +43 -6
- package/docs/door.md +129 -32
- package/docs/egress.md +3 -1
- package/docs/github-action.md +2 -2
- package/docs/mandates.md +1 -1
- package/docs/perathos.md +100 -0
- package/docs/sdk.md +32 -1
- package/docs/threat-model.md +2 -1
- package/docs/tutorials.md +6 -0
- package/docs/usage.md +3 -1
- package/docs/verification.md +3 -1
- package/package.json +7 -1
- package/vectors/audit.json +27 -27
- package/vectors/canonical.json +5 -5
- package/vectors/interop/perathos/LICENSE +21 -0
- package/vectors/interop/perathos/README.md +17 -0
- package/vectors/interop/perathos/pocketos-replay/session.head.json +11 -0
- package/vectors/interop/perathos/pocketos-replay/session.jsonl +8 -0
- package/vectors/interop/perathos/pocketos-replay/verification.json +65 -0
- package/vectors/receipts.json +1701 -1210
package/docs/door.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
# The door
|
|
1
|
+
# The door
|
|
2
|
+
|
|
3
|
+
> How it works and when to use it. Every field, route, and flag is in [the reference](../../../site/reference/door.md).
|
|
2
4
|
|
|
3
5
|
The gateway stands between an agent and the tools it uses. The door stands between the world and your own HTTP surface: a website, an API, a form. Every arrival, a browser, an API client, a crawler, or an agent acting for someone, is classified by what it presented, decided by a Cedar policy for the route it hit, relayed to your origin or refused, and receipted either way. The receipt is the same signed, logged, independently verifiable receipt the gateway issues, with `issuer.kind: "door"`.
|
|
4
6
|
|
|
5
|
-
New to the door? [Put the door in front of a site](door-quickstart.md) walks through one form in about fifteen minutes.
|
|
7
|
+
New to the door? [Put the door in front of a site](door-quickstart.md) walks through one form in about fifteen minutes. A Node site can run the same decision loop in its own process instead, as Express middleware or around a Next.js route handler: [the door in your Node app](door-middleware.md). Already run nginx or Envoy? The door can answer their authz checks instead of relaying, and the site keeps its proxy: [behind nginx or Envoy](#behind-nginx-or-envoy-authz-mode). A site in Go, Rails, Django, or Spring can ask the same check from a middleware: [the door in Go, Rails, Django, and Spring](door-languages.md).
|
|
6
8
|
|
|
7
|
-
This is the first piece of the agent front door. It answers "what may this arrival do here" and "what did it do, provably". It does not yet answer "is this an agent" for web traffic: that is detection, and the door records only what it can check. Read [what the door knows](#what-the-door-knows-about-an-arrival) before writing a policy.
|
|
9
|
+
This is the first piece of the agent front door. It answers "what may this arrival do here" and "what did it do, provably". It does not yet answer "is this an agent" for web traffic: that is detection, and the door records only what it can check. An agent that wants to be known can say so in a way the door checks: a grant, or a [Web Bot Auth signature](#web-bot-auth-signatures). Read [what the door knows](#what-the-door-knows-about-an-arrival) before writing a policy.
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
12
|
agent-custody keygen --dir keys --name door
|
|
@@ -33,23 +35,9 @@ agent-custody door --config door.json --port 8780
|
|
|
33
35
|
}
|
|
34
36
|
```
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
| `origin.url` | where allowed arrivals are relayed: the site or API behind the door. `headers` and `headerEnv` add headers to every relayed request, the latter from the environment, so the origin can require a secret only the door holds. `timeoutMs` bounds one relayed request, default 30 s. A path in the URL (`https://host/api/v1`) is kept: the arrival's path goes under it, and a redirect from the origin to a place under it comes back as a door path |
|
|
40
|
-
| `routes` | what the policy sees as the action. `path` is exact (`/refunds`), a prefix (`/api/*`), or `*`; `methods` narrows it, default every method. The first route that matches wins; an arrival no route matches is the action `unmatchedRoute`, default `other`. The match reads the path as the origin will: percent-decoded once, so `/%61dmin` falls under `/admin/*`, and with empty segments merged, so `//admin/users` and `/admin//users` fall under it too (nginx, Apache, and many frameworks merge them). A trailing slash matches as none: `/refunds/` falls under `/refunds`. The origin is sent that merged, decoded form, trailing slash kept, so the door and the origin read one path. A path with a segment that does not decode, or decodes to a slash or a backslash, falls under `unmatchedRoute` and is never relayed |
|
|
41
|
-
| `trustedPrincipalKeys` | public keys of principals whose signed grants the door accepts as a passport. Without any, no arrival can be `verified` |
|
|
42
|
-
| `policyFile` | the Cedar policy, re-read when the file changes; one that does not parse is refused and the policy in force stays |
|
|
43
|
-
| `mode` | `enforce` (default) refuses what the policy denies. `observe` relays everything and records the decision with `enforced: false` |
|
|
44
|
-
| `trustProxy` | behind one reverse proxy you run: the arrival's address is the last in `X-Forwarded-For`, the one your proxy appended; everything before it is what the client sent. The proxy's `X-Forwarded-For`, `-Proto`, and `-Host` are kept on the relay, with the door's own socket address appended, and the other client-address headers (`Forwarded`, `X-Real-IP`, `True-Client-IP`, `CF-Connecting-IP`, every `X-Forwarded-*`) are relayed as the proxy sent them. Without `trustProxy` the client wrote all of these: the door drops them and sets `X-Forwarded-For`, `-Host`, `-Proto`, and `X-Real-IP` itself |
|
|
45
|
-
| `maxBodyBytes` | the largest request body the door relays; a larger one gets 413 and a `withheld` receipt once the policy has allowed it. Default 1 MiB |
|
|
46
|
-
| `maxResponseBytes` | the largest origin response the door relays; see [what the arrival gets back](#what-the-arrival-gets-back). Default 32 MiB |
|
|
47
|
-
| `maxInFlight` | arrivals handled at once. Each holds its body and the origin's answer in memory until it is answered, so this bounds the door's memory at about `maxInFlight × (maxBodyBytes + maxResponseBytes)`. Past it the next arrival gets 503 with `Retry-After: 1` before its body is read: it is not decided, relayed, or receipted. Default 256 |
|
|
48
|
-
| `precommit` | route names whose arrivals are committed to the log before they are relayed whatever their method, or `["*"]`. Every arrival whose method is not GET, HEAD, or OPTIONS is committed regardless; see [before the origin hears of it](#before-the-origin-hears-of-it). Default `[]` |
|
|
49
|
-
| `challenge` | the human branch: `{ provider: "turnstile" or "hcaptcha", siteKey, secretEnv, hostnames, action?, header?, timeoutMs?, maxInFlight? }`. `hostnames` lists the hosts of the pages that render the widget, `action` (Turnstile only) the widget's action, and `maxInFlight` (default 64) how many checks may wait on the provider at once. A token an arrival sends in `header` (default `x-agent-custody-challenge`) is verified with the provider, and the outcome is the arrival's `challenge` signal; see [challenging a human](#challenging-a-human). The secret comes from the environment variable, read at startup; missing is a startup error |
|
|
50
|
-
| `receiptsDir`, `logFile` or `log`, `otel`, `splunk`, `capture`, `captureKeyEnv` | as for the [gateway](configuration.md): where receipts and the log go, exporters, and private evidence per route. A remote `log` needs `log.keys`, because its answer is checked before a request is relayed. Unlike the gateway, the door withholds by default: see [what a receipt records](#what-a-receipt-records-of-the-query-and-the-body) |
|
|
51
|
-
|
|
52
|
-
`agent-custody check --config door.json` reads a door config the way the door would: unknown keys, the key, the principal keys, the policy (including a permit that names an agent without requiring a verified arrival, see below), the routes, what is precommitted, the challenge provider or its absence, the origin's scheme, every credential variable the door reads at startup (origin headers, the log, Splunk, OTel, the capture key, the challenge secret), and the paths. It exits 1 on an error.
|
|
38
|
+
Every field of the config, with its type and default, is in [the door reference](../../../site/reference/door.md#config).
|
|
39
|
+
|
|
40
|
+
`agent-custody check --config door.json` reads a door config the way the door would: unknown keys, the key, the principal keys, the policy (including a permit that names an agent without requiring a verified arrival, see below), the routes, what is precommitted, the challenge provider or its absence, the partner engine and its key, the origin's scheme, every credential variable the door reads at startup (origin headers, the log, Splunk, OTel, the capture key, the challenge secret), and the paths. It exits 1 on an error.
|
|
53
41
|
|
|
54
42
|
## What the door knows about an arrival
|
|
55
43
|
|
|
@@ -57,13 +45,15 @@ The door records one fact for every arrival, `arrival`, observed by the door its
|
|
|
57
45
|
|
|
58
46
|
| field | values | meaning |
|
|
59
47
|
| --- | --- | --- |
|
|
60
|
-
| `class` | `verified`, `claimed`, `unknown` | `verified`: a grant signed by a trusted principal, inside its window, naming this route among its scopes. `claimed`: something was asserted that the door could not accept: a grant from a stranger, an expired one, one for other routes, a declared agent name, or
|
|
61
|
-
| `subject` | string | the agent named in a verified grant; else the declared name or the agent a rejected grant named; else `unknown`. Only a verified subject reaches the Cedar `principal` |
|
|
62
|
-
| `grant` | `verified`, `out-of-scope`, `invalid`, `absent` | what became of the grant header, with `grantError` when it was not accepted |
|
|
63
|
-
| `signature` |
|
|
48
|
+
| `class` | `verified`, `claimed`, `unknown` | `verified`: a grant signed by a trusted principal, inside its window, naming this route among its scopes; or, with no grant, a [Web Bot Auth signature](#web-bot-auth-signatures) that checked against the key its agent's directory publishes. `claimed`: something was asserted that the door could not accept: a grant from a stranger, an expired one, one for other routes, one presented under another agent's signature, a declared agent name, or a signature that did not check or was not checked. `unknown`: nothing was presented |
|
|
49
|
+
| `subject` | string | the agent named in a verified grant; else the signature agent of a verified signature (its https origin); else the declared name or the agent a rejected grant named; else `unknown`. Only a verified subject reaches the Cedar `principal` |
|
|
50
|
+
| `grant` | `verified`, `out-of-scope`, `invalid`, `wrong-sender`, `absent` | what became of the grant header, with `grantError` when it was not accepted. `wrong-sender`: the grant verified, and the request is signed by a signature agent the grant does not name |
|
|
51
|
+
| `signature` | `verified`, `invalid`, `unavailable`, `unchecked`, `absent` | what became of an RFC 9421 signature tagged `web-bot-auth`, with `signatureError` when it was not verified. `unchecked`: a `Signature-Input` arrived and the config has no `webBotAuth`, so it is a claim. See [Web Bot Auth signatures](#web-bot-auth-signatures) |
|
|
52
|
+
| `signatureAgent`, `signatureKeyid` | strings | the `Signature-Agent` origin and the keyid the signature named. Checked only when `signature` is `verified` |
|
|
64
53
|
| `declared` | string | the `x-agent-custody-agent` header, when sent. A claim |
|
|
65
54
|
| `remote` | string | the arrival's address |
|
|
66
55
|
| `challenge` | `{ provider, outcome, error? }` | only when `challenge` is configured. `passed`: the provider confirmed the token the arrival sent. `failed`: the provider refused the token (`invalid-input-response`, `timeout-or-duplicate`, `expired-input-response`, `already-seen-response`, `missing-input-response`, with the codes in `error`), it confirmed a token issued on another hostname or for another action, or the token was longer than 4096 characters, which is refused without calling the provider. `unavailable`: the provider did not answer in time, answered a non-200, a redirect, or something that is not JSON, answered a code that is its own or the operator's fault (`internal-error`, `bad-request`, `missing-input-secret`, `invalid-input-secret`, `sitekey-secret-mismatch`, `invalid-sitekey`, `missing-sitekey`, `invalid-remoteip`: a rotated secret gives every person one of these), or `maxInFlight` checks were already waiting. `absent`: no token. A passed challenge leaves `class` as it was: it says a provider's test was passed in front of this arrival, not who the arrival is |
|
|
56
|
+
| `partner` | `{ engine, outcome, error? }` | only when `partner` is configured and the route is in `partner.routes`. `verified`: the engine's verdict was signed for this arrival under `partner.keyFile`, and is the `partner` fact. `rejected`: the engine answered with anything else. `unavailable`: it did not answer in time or at all. See [a partner engine's verdict](#a-partner-engines-verdict) |
|
|
67
57
|
| `rate` | `{ by, burst, minute }` | arrivals from the same source in the last 10 and 60 seconds, this one included, whatever was decided about them, counted by this door process alone. `by` is `agent` for a verified arrival (counted by the agent's name across addresses) or `remote` (by address). A pace, not a verdict |
|
|
68
58
|
| `method`, `path`, `route` | strings | what arrived, and the route it fell under |
|
|
69
59
|
|
|
@@ -71,9 +61,9 @@ The door records one fact for every arrival, `arrival`, observed by the door its
|
|
|
71
61
|
|
|
72
62
|
There is no `human` class. The door cannot tell a person from a program that presents nothing, and it does not pretend to. With `challenge` configured, a policy can require a passed challenge on a route instead; without it, a policy that lets `unknown` through on a route is letting everything through on that route, and should say so.
|
|
73
63
|
|
|
74
|
-
**Presenting a passport.** An agent presents its grant exactly as it does to the HTTP gateway: the DSSE envelope as base64url in `Authorization: Bearer <value>` or in `X-Agent-Custody-Grant`. The scopes of the grant are route names. A grant that travelled in `Authorization` is stripped before the request is relayed, so the origin never sees it; one in the custom header is stripped too. The door's own headers are added to the relayed request: `X-Agent-Custody-Receipt` (the receipt id), `X-Agent-Custody-Class`, and `X-Forwarded-For`, `-Host`, `-Proto`, with `X-Real-IP` when `trustProxy` is off.
|
|
64
|
+
**Presenting a passport.** There are two passports, and an agent may present both. A Web Bot Auth signature proves which agent sent the request ([below](#web-bot-auth-signatures)). A grant says what a principal you trust lets that agent do. An agent presents its grant exactly as it does to the HTTP gateway: the DSSE envelope as base64url in `Authorization: Bearer <value>` or in `X-Agent-Custody-Grant`. The scopes of the grant are route names. A grant that travelled in `Authorization` is stripped before the request is relayed, so the origin never sees it; one in the custom header is stripped too. The door's own headers are added to the relayed request: `X-Agent-Custody-Receipt` (the receipt id), `X-Agent-Custody-Class`, and `X-Forwarded-For`, `-Host`, `-Proto`, with `X-Real-IP` when `trustProxy` is off.
|
|
75
65
|
|
|
76
|
-
**A
|
|
66
|
+
**A grant alone is bearer-grade; a grant under its agent's signature is bound to its sender.** The door checks the grant's signature, window, and scope. On its own, that does not show that the sender holds the agent's key. Anyone who holds the grant's bytes is that agent until the grant expires, and every verified receipt carries the grant in `delegation`, so a person who can read one receipt can replay its grant. When the request also carries a Web Bot Auth signature that the door verified, and the grant names that signature agent (`"agent": "https://crawler.example"`), the grant is bound to its sender: a thief has the grant's bytes but not the agent's signing key, and a captured signature serves one request (its nonce) for at most `maxAgeSeconds`. A grant presented under another agent's signature is `wrong-sender`, and the arrival is `claimed`. A grant with no signature, or with one that did not verify, is still verified, bearer-grade, as before, so a route that needs the binding says so in its policy: `context.facts.arrival.grant == "verified" && context.facts.arrival.signature == "verified"` holds only for a bound grant, since a mismatch makes `grant` `wrong-sender`. For bearer grants, issue door grants with short lifetimes (minutes, not days), scope them to the routes they need, bound what a route allows per call in the policy, and treat receipt files and logs as holding live credentials until those grants expire.
|
|
77
67
|
|
|
78
68
|
**Challenging a human.** The door builds no CAPTCHA. With `challenge` configured, a page in front of a protected route renders the provider's widget (Cloudflare Turnstile or hCaptcha) with `siteKey`, and sends the token the widget produced in the `challenge.header` header of its request. The door posts the token and the secret from `secretEnv` to the provider's `siteverify` endpoint, with a timeout, and records the answer as `challenge.outcome`. It adds the arrival's address as `remoteip` only with `trustProxy`, where that address is the client's; without it the socket's address may be a proxy's, and the provider would refuse a token the client solved. It never follows a redirect, which would resend the secret and the token elsewhere. To hCaptcha it also sends `siteKey` as `sitekey`: an hCaptcha secret belongs to the account, and without it a token solved on the account's easiest widget would pass on the hardest. A Turnstile secret belongs to one widget already. `success` alone does not pass: the token must have been issued on one of `hostnames`, and for `action` when one is set, or a token solved on another site that uses this site key, or for another widget, would count. At most `maxInFlight` checks wait on the provider at once; an arrival past that is `unavailable`. The token is stripped before the request is relayed, and neither the token nor the secret is recorded. A policy admits a person on a form route with
|
|
79
69
|
|
|
@@ -253,11 +243,88 @@ The pass run's receipt records `challenge.outcome: "passed"`, and the door relay
|
|
|
253
243
|
|
|
254
244
|
**What this run shows, and what it does not.** Test keys prove the wire path, not bot detection. The door reaches the real `siteverify`, sends the secret and the token, and records the answer. A test secret gives a fixed answer and no widget runs, so the run says nothing about how well Turnstile tells a person from a bot. The run did not exercise the `unavailable` outcome, a hostname mismatch, an action mismatch, the `timeout-or-duplicate` code, or `remoteip` (the config sets no `trustProxy`, so the door sent none). `test/door.test.ts` covers those against a stubbed `siteverify`. In the output above, the two `sha256` digests are shortened to eight characters and `…`. Nothing else is changed. The CLI was `agent-custody` 0.16.2, run from this repository at commit `64285ef`. That version had no note for door receipts, so its `ISSUER` lines end with `unknown issuer kind`; later versions say what a door receipt proves there: the arriving party could not forge it and is attested only when it presented a grant, and a request that reached the origin some other way leaves no receipt.
|
|
255
245
|
|
|
246
|
+
## Web Bot Auth signatures
|
|
247
|
+
|
|
248
|
+
Web Bot Auth is the IETF draft for bots and agents that identify themselves by signing their requests ([draft-meunier-web-bot-auth-architecture-05](https://datatracker.ietf.org/doc/html/draft-meunier-web-bot-auth-architecture-05), with the key directory of [draft-meunier-http-message-signatures-directory-05](https://datatracker.ietf.org/doc/html/draft-meunier-http-message-signatures-directory-05)). The agent signs each request with an RFC 9421 HTTP message signature and names, in the `Signature-Agent` header, the https origin that publishes its keys at `/.well-known/http-message-signatures-directory`. With `webBotAuth` configured, the door fetches that directory and checks the signature. A request that checks, with no grant, is `verified` as the signature agent: the subject and the Cedar principal are the origin, `Agent::"https://crawler.example"`.
|
|
249
|
+
|
|
250
|
+
```json
|
|
251
|
+
"webBotAuth": { "agents": ["https://crawler.example"], "authorities": ["shop.example"] }
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
`agents` lists the signature agents whose directories the door will fetch. `authorities` lists the hosts this door serves. The other fields and their defaults are in [the reference](../../../site/reference/door.md#config).
|
|
255
|
+
|
|
256
|
+
**What the door checks**, in order. The first that fails is the `signatureError`:
|
|
257
|
+
|
|
258
|
+
1. A `Signature-Input` member tagged `web-bot-auth` (the first one, when there are several), and a byte sequence under the same label in `Signature`. A signature with another tag is for some other purpose, and the arrival is `invalid` for this one.
|
|
259
|
+
2. `keyid`, `created`, and `expires` are present; `alg`, when present, is `ed25519`. The keyid is the RFC 7638 thumbprint of the agent's Ed25519 key, as the draft requires. The door checks Ed25519 only, the draft's algorithm; RSA-PSS and ECDSA signatures are `invalid` with that reason.
|
|
260
|
+
3. The signature covers `@authority` and the `Signature-Agent` member that names the directory (`"signature-agent";key="<member>"`, or the whole field in the draft's legacy string form). Without that coverage, anyone could move a signature under another agent's name.
|
|
261
|
+
4. The `Signature-Agent` URI is https, an origin or its directory URL, and one of `agents`. Anything else is refused without a fetch, so an arrival never chooses what the door fetches and cannot point it at an internal address. An `http:` directory and an inline `data:` directory are refused: an inline directory carries its own key and proves nothing.
|
|
262
|
+
5. The window: `created` at most `clockSkewSeconds` (60) in the future, `expires` after `created`, and now no later than `expires`, nor than `created` plus `maxAgeSeconds` (300), each with the skew. The draft allows a 24-hour signature; the door accepts one for five minutes after it was made, whatever `expires` says.
|
|
263
|
+
6. `@authority` is the request's `Host`, lowercase, without `:443` or `:80`, and it must be one of `authorities`. The client writes the `Host`, so without this list a signature made for another site could be sent here with that site's `Host` and verify. Behind a proxy, the proxy must pass the `Host` through.
|
|
264
|
+
7. The nonce. By default (`requireNonce`) a signature must carry one, and a nonce already used with this agent and key is a replay. The door remembers a nonce until the signature it came with could no longer be accepted, so a signature serves one request. A minimal Web Bot Auth signature covers only the authority and the `Signature-Agent`, so without this rule a captured signature would serve any method and path on this site until it aged out. `agent-custody check` warns when `requireNonce` is off.
|
|
265
|
+
8. The directory: `GET <origin>/.well-known/http-message-signatures-directory` over https, with `AbortSignal.timeout(timeoutMs)`, never following a redirect (a redirect is a directory on another origin, and `invalid`), served as `application/http-message-signatures-directory+json`, at most `maxDirectoryBytes`, a JWKS. It is kept `cacheSeconds` (300); a failed fetch is asked again after 30 seconds. One fetch at a time per agent.
|
|
266
|
+
9. The key whose thumbprint is the keyid, inside its `nbf` and `exp` when the directory gives them, and the Ed25519 signature over the RFC 9421 signature base. The base is built from `@method`, `@authority`, `@path`, `@query`, and header fields (whole, or one dictionary member with `;key`). A signature that covers another derived component (`@target-uri`, `@scheme`, `@request-target`, `@query-param`) or a component parameter other than `key` is `invalid`, and the reason names it.
|
|
267
|
+
|
|
268
|
+
| `signature` | when |
|
|
269
|
+
| --- | --- |
|
|
270
|
+
| `verified` | every check above passed |
|
|
271
|
+
| `invalid` | one of them failed: the reason is in `signatureError`. A signature agent not in `agents`, a redirect, the wrong media type, or a directory too large is the agent's fault or an attack, and `invalid` |
|
|
272
|
+
| `unavailable` | the directory did not answer in time, answered a non-200, or the door holds `maxNonces` nonces and cannot record another. The network's or the door's state, not the arrival's |
|
|
273
|
+
| `unchecked` | a `Signature-Input` arrived and the config has no `webBotAuth` |
|
|
274
|
+
| `absent` | no `Signature-Input` and no `Signature` |
|
|
275
|
+
|
|
276
|
+
**What a verified signature does not show.** It shows that a key published at the signature agent's origin signed this request, for this door's authority, in the last few minutes, once. It does not cover the body: the door does not check `Content-Digest`, and a signature over `@authority` alone does not cover the method, the path, or the query either; the receipt records them as they arrived, as `claimed` arguments. It does not show that the origin is a crawler you know or that it behaves well: `agents` is the list of origins you chose to check, and a policy decides what each may do. The door does not check the directory's own response signatures (directory draft, section 5.2, a SHOULD): it fetches the directory over https from the origin the signature names, and the signature covers that name, so a directory that lists another agent's key cannot claim that agent's requests. Nonces are remembered by one door process, so two doors, or one restart, accept a nonce once each; `maxAgeSeconds` bounds that. A key the agent adds to its directory is seen once the cached copy expires.
|
|
277
|
+
|
|
278
|
+
**In the receipt.** A signature-verified arrival without a grant has `agent: { id: "https://crawler.example", provenance: "observed" }` and `principal: { id: null, provenance: "claimed" }`. The agent is the door's own observation, as the egress witness's agent is: the check was against a directory the door fetched, which a reader of the receipt cannot repeat, so it is not `attested`. The arrival fact records `signature`, `signatureAgent`, and `signatureKeyid`. A bound grant's receipt is the verified grant's receipt as before, `attested`, with `signature: "verified"` in the arrival fact. No verifier check changed.
|
|
279
|
+
|
|
280
|
+
**The published vectors.** The tests check the door against the published Ed25519 vectors that use the RFC 9421 test key (appendix B.1.4): RFC 9421's B.2.6 request, whose signature base and signature the door reproduces, and the Web Bot Auth draft's A.2.1 (a signature over `@authority` alone) and A.2.3 (`Signature-Agent` in the legacy string form), whose published signatures verify. The draft's A.2.2, `Signature-Agent` as a dictionary member, prints a signature that does not verify against its own printed signature base, so the tests sign that layout themselves with the RFC's published private key. No test fetches a real directory or uses a real crawler's key: the directories are built in the test and served by a stubbed fetch.
|
|
281
|
+
|
|
282
|
+
A policy that admits one crawler on the API by its signature, and refunds only for a grant bound to its sender:
|
|
283
|
+
|
|
284
|
+
```cedar
|
|
285
|
+
permit(principal == Agent::"https://crawler.example", action == Action::"api", resource)
|
|
286
|
+
when { context.facts.arrival.class == "verified" };
|
|
287
|
+
|
|
288
|
+
permit(principal, action == Action::"refund", resource)
|
|
289
|
+
when {
|
|
290
|
+
context.facts.arrival.grant == "verified" &&
|
|
291
|
+
context.facts.arrival.signature == "verified" &&
|
|
292
|
+
context.args.body.amount > 0 &&
|
|
293
|
+
context.args.body.amount <= 5000
|
|
294
|
+
};
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Tutorial: [47-web-bot-auth.ts](../examples/47-web-bot-auth.ts).
|
|
298
|
+
|
|
299
|
+
## A partner engine's verdict
|
|
300
|
+
|
|
301
|
+
A site that already pays for bot detection (Cloudflare Bot Management, HUMAN, DataDome) can give the door that engine's verdict, signed. The door builds no detector of its own here: it asks the engine, checks the engine's signature, and lets the policy decide on the verdict. The engine sits behind an adapter that holds an Ed25519 key; `scripts/fake-partner.ts` is a stand-in.
|
|
302
|
+
|
|
303
|
+
```json
|
|
304
|
+
"partner": {
|
|
305
|
+
"engine": "datadome",
|
|
306
|
+
"url": "https://bot-adapter.internal/verdict",
|
|
307
|
+
"keyFile": "keys/engine.pub",
|
|
308
|
+
"routes": ["refund", "api"],
|
|
309
|
+
"timeoutMs": 1500,
|
|
310
|
+
"onFailure": "deny"
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
- **The question.** For an arrival on one of `routes` (`["*"]` for all), the door POSTs `url` a JSON body: `{ receiptId, route, method, path, remote, class, headers }`, with `receiptId` the id of the receipt it is writing and `headers` the four the receipt records (`user-agent`, `content-type`, `accept`, `host`). Never the query, the body, the grant, the challenge token, or a cookie. The question carries `AbortSignal.timeout(timeoutMs)`, follows no redirect, and the door reads at most `maxResponseBytes` (16 KiB) of the answer. At most `maxInFlight` (64) questions wait at once.
|
|
315
|
+
- **The answer.** `{ verdict: { engine, verdict, score? }, signature }`, where `signature` is a DSSE envelope in the upstream attestation format (`src/upstream.ts`): payload type `application/vnd.agent-custody.upstream+json`, payload `{ receiptId, tool, contentDigest }` with `tool` the route and `contentDigest` the digest of `verdict`. `signVerdict(verdict, key, receiptId, route)` in `src/door-partner.ts` makes one. `engine` must equal the config's, `verdict` is a short word, `score` an integer, and no other field is accepted.
|
|
316
|
+
- **What the door accepts.** A signature that verifies under `keyFile`, names this receipt and route, and is exactly that plain attestation (one signature, canonical payload, nothing added). Anything else is `rejected`, with the reason in `arrival.partner.error`. Since the receipt id is fresh for every arrival, a verdict signed for one arrival cannot be replayed onto another.
|
|
317
|
+
- **What the policy reads.** An accepted verdict is `context.facts.partner`, `{ engine, verdict, score? }`. Without one there is no `partner` fact, and `arrival.partner` says why. A rule reads it as `context.facts has partner && context.facts.partner.verdict == "human"`, so a missing verdict denies.
|
|
318
|
+
- **When there is no verified verdict** (the engine down, slow, busy, or a bad signature, a verdict for another arrival): `onFailure: "deny"`, the default, refuses the arrival with 503 and a `withheld` receipt, whatever the policy said, and relays nothing. `onFailure: "absent"` lets the policy decide without the fact, so a rule that requires it denies and a rule that does not mention it allows as it would anyway. Neither turns an outage into an allow on a route whose rule needs the verdict. A policy deny still answers 403 first. In observe mode the refusal is printed, not enforced, as a deny is.
|
|
319
|
+
- **What the receipt carries.** `facts.partner` is `{ tool: "door.partner", args: {}, value: <verdict>, resultDigest, provenance: "attested", attestation: <the engine's envelope> }`, and `facts.arrival.partner` records the outcome. Under the door's default capture rule, and any rule that leaves the facts in clear, the envelope stays in clear beside the verdict; under a private facts rule it is withheld with the verdict. The verifier runs `fact partner signature (upstream key)`: given the engine's public key with `--upstream-key` (or `upstreamKeys`), it checks the signature, the receipt id, the route, and the digest of the verdict as recorded. Without the key the check fails, because the receipt says the verdict is attested and the reader cannot confirm it. A verdict pasted from another receipt, or edited, fails it. The TypeScript, browser, and Python verifiers run the same check (vectors `door-partner-attested`, `door-partner-without-key`, `door-partner-wrong-key`, `resigned-door-partner-moved`).
|
|
320
|
+
|
|
321
|
+
What the verdict means, and what it does not, is in [door signals](door-signals.md#the-partner-verdict). Tutorial: [52-door-partner-verdict.ts](../examples/52-door-partner-verdict.ts).
|
|
322
|
+
|
|
256
323
|
## How an arrival becomes a Cedar request
|
|
257
324
|
|
|
258
325
|
| Cedar slot | value |
|
|
259
326
|
| --- | --- |
|
|
260
|
-
| `principal` | `Agent::"<agent>"` for the agent a verified grant names; `Agent::"unknown"` for every other arrival. A declared name and the agent a rejected grant names stay in the arrival fact: a permit on `principal == Agent::"shopping-agent"` cannot be satisfied by sending a header |
|
|
327
|
+
| `principal` | `Agent::"<agent>"` for the agent a verified grant names, or the signature agent of a verified signature (`Agent::"https://crawler.example"`); `Agent::"unknown"` for every other arrival. A declared name and the agent a rejected grant names stay in the arrival fact: a permit on `principal == Agent::"shopping-agent"` cannot be satisfied by sending a header |
|
|
261
328
|
| `action` | `Action::"<route>"` |
|
|
262
329
|
| `resource` | `Tool::"<route>"` |
|
|
263
330
|
| `context.args` | `{ method, path, query, headers, body?, bodyBytes, bodyDigest }`. `query` holds every parameter by name, as own properties, so `?constructor=x` is a parameter. `headers` carries `user-agent`, `content-type`, `accept`, and `host` only. `body` is present for a JSON body of at most 64 KiB; every body the door read is recorded by `bodyDigest` (sha256 of the raw bytes) and `bodyBytes`. A body above `maxBodyBytes` is dropped as it passes the limit and recorded as `bodyBytes` read so far and `bodyOversized: true`, with no digest and no `body`. The policy reads a copy that Cedar accepts: Cedar has no `null` and no non-integer number, and refuses the whole request on either, so in the copy a `null` member is dropped and a number that is not a safe integer becomes its string (`9.99` becomes `"9.99"`). A rule that compares such a value as a number then errors, and that rule's deny is the answer. The receipt keeps the body as it arrived. **Provenance: claimed** |
|
|
@@ -301,6 +368,7 @@ A request that can change something at the origin, any method but GET, HEAD, and
|
|
|
301
368
|
| the request left, and its answer did not arrive: a timeout, a reset, or a body that stopped after the headers | 504 | `{ error, detail, receipt }`, "the origin may have acted on the request ... Do not retry" | `error`, and `execution.error` says the origin may have acted. Find out from the origin before retrying a refund |
|
|
302
369
|
| policy allows, body above `maxBodyBytes` | 413 | `{ error, reason, receipt }` | `withheld`; nothing was relayed |
|
|
303
370
|
| policy allows, the log refused the authorization | 503 | `{ error, reason, receipt }` | `withheld`; nothing was relayed |
|
|
371
|
+
| policy allows, the partner engine gave no verified verdict and `partner.onFailure` is `deny` | 503 | `{ error, reason, receipt }` | `withheld`; nothing was relayed |
|
|
304
372
|
| policy allows, the path does not decode cleanly | 400 | `{ error, reason, receipt }` | `withheld`; nothing was relayed |
|
|
305
373
|
| policy allows, the origin's response above `maxResponseBytes` | 502 | `{ error, receipt }`, and "do not retry" | `executed` or `failed`: the origin acted; `result` carries the status and `bodyOversized: true`, no digest |
|
|
306
374
|
| the receipt could not be written | 500 | `{ error, outcome, receipt }` | none on disk; `outcome` says whether the origin acted, so that a refund is not retried on the strength of a 500 |
|
|
@@ -320,18 +388,47 @@ To record more in clear, give the route a rule of its own, as for the gateway ([
|
|
|
320
388
|
|
|
321
389
|
## The receipt
|
|
322
390
|
|
|
323
|
-
A door receipt is a v0.2 receipt with `issuer.kind: "door"` and `issuer.framework: "http"
|
|
391
|
+
A door receipt is a v0.2 receipt with `issuer.kind: "door"` and `issuer.framework: "http"` (`"authz"` when it answered a proxy's check, [below](#behind-nginx-or-envoy-authz-mode)). The route is the tool, observed. `request.args` is the arrival as the table above describes it, claimed. `facts.arrival` is the door's observation; `facts.partner`, when present, is a partner engine's signed verdict, attested ([above](#a-partner-engines-verdict)). When the arrival was verified by a grant, `principal` and `agent` are attested and `delegation` carries the grant. When it was verified by a signature alone, `principal` is `{ id: null, provenance: "claimed" }` and `agent` is the signature agent, observed. Otherwise `principal` is `{ id: null, provenance: "claimed" }` and `agent` is the subject, claimed. `execution.result` for a relayed call is `{ status, contentType?, bodyBytes, bodyDigest }`: the origin's body is never copied into the receipt, only committed to.
|
|
324
392
|
|
|
325
393
|
The verifier runs `door receipt carries a policy decision` in place of the gateway's two checks, and otherwise the same checks: a verified arrival's receipt passes `delegation binds principal and agent` and `executed tool within delegated scope`; an unknown arrival's passes `principal is claimed, not attested`; a receipt that carries an `authorization` passes the authorization checks, including `authorization logged before execution`. Both verifiers, the Python verifier, and `policy simulate` accept door receipts; the conformance vectors `door-unknown-executed`, `door-unknown-denied`, and `door-verified-executed` pin them.
|
|
326
394
|
|
|
395
|
+
## Behind nginx or Envoy: authz mode
|
|
396
|
+
|
|
397
|
+
A site that already runs nginx or Envoy need not send its traffic through the door. With `"authz": true` in the config the door relays nothing and has no origin: it answers the proxy's external-auth check for each request, and the proxy relays or refuses. `deploy/door/` has a stock [nginx.conf](../../../deploy/door/nginx.conf) (`auth_request`) and a stock [envoy.yaml](../../../deploy/door/envoy.yaml) (`ext_authz`, HTTP mode), with the door config and policy they run against, and `deploy/door/demo.sh` runs each in front of a stand-in site: an allowed read, a refused refund, a verified agent's refund, and every receipt verified.
|
|
398
|
+
|
|
399
|
+
```json
|
|
400
|
+
{ "identity": { "keyFile": "keys/door.key" }, "authz": true, "trustProxy": true, "routes": [...], "policyFile": "policy.cedar", "receiptsDir": "receipts", "logFile": "log.jsonl" }
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
- **What the door reads.** The proxy sets `X-Original-Method` (the original request's method) and `X-Original-URI` (its path and query), and `X-Forwarded-For` (the client's address; `trustProxy` is required, and the door takes the last address), and passes the client's headers the door reads: the grant, `X-Agent-Custody-Agent`, `Signature`, `Signature-Input`, `Signature-Agent`, the challenge header, `User-Agent`, `Accept`, `Content-Type`, and the client's `Host`. The check request's own method and path are the proxy's and are ignored; the door decides, and checks a [Web Bot Auth](#web-bot-auth-signatures) signature, on the original method, target, and `Host`; a check without the two `X-Original-*` headers is answered 400 with no receipt.
|
|
404
|
+
- **What it answers.** 200 with `X-Agent-Custody-Receipt` and `X-Agent-Custody-Class`, which the proxy passes to the origin in place of anything the client sent under those names; 403 on a refusal; 503 when the log refused the authorization of a request that can change something; 400 for a path that does not decode cleanly. nginx relays only on a 2xx, refuses on 401 and 403, and answers 500 for anything else; Envoy relays only on 200 and returns anything else to the client. Both stock configs fail closed when the door is down.
|
|
405
|
+
- **Commit before relay still holds.** Any method but GET, HEAD, and OPTIONS, and any route in `precommit`, is committed to the log before the door answers 200, so the evidence exists before the proxy can relay the request.
|
|
406
|
+
|
|
407
|
+
**What its receipts record: the decision, not the result.** In authz mode the door never sees the request body or the origin's answer. The proxy holds the body and relays it after the 200, and the answer goes from the origin to the client through the proxy. So:
|
|
408
|
+
|
|
409
|
+
- `issuer.framework` is `authz`.
|
|
410
|
+
- `request.args` has `method`, `path`, `query`, and `headers`, and no `body`, `bodyBytes`, or `bodyDigest`. A rule on `context.args.body` errors and denies; a rule on an amount belongs at the origin, or in a door that relays.
|
|
411
|
+
- An allow is `execution.status: "withheld"` with the reason "allowed; the door answered the proxy's authz check and relays nothing ...": the door relayed nothing. A deny is `denied`. No authz receipt is ever `executed`, `failed`, or `error`, and none carries a result: whether the proxy relayed the request, and what the origin answered, is in no receipt.
|
|
412
|
+
- The verifier runs `door authz decided, relayed nothing` on such a receipt, in TypeScript, in the browser, and in Python, and the report says the receipt records a decision. A receipt re-signed to claim a result fails it (vector `resigned-door-authz-executed`); vectors `door-authz-allowed`, `door-authz-denied`, and `door-authz-verified-precommitted` pin the honest ones.
|
|
413
|
+
|
|
414
|
+
**What to get right in the proxy.**
|
|
415
|
+
|
|
416
|
+
- The door believes the proxy's headers. Let only the proxy reach it: anyone who can reach the door can have it write receipts for requests that never happened, and an allow receipt does not prove that the proxy relayed anything. The stock configs keep the door off the published ports.
|
|
417
|
+
- The proxy sets `X-Original-Method`, `X-Original-URI`, and `X-Forwarded-For` itself, replacing any copy the client sent (nginx `proxy_set_header`, Envoy `headers_to_add` with `use_remote_address: true`). A config that passes the client's copies lets the client choose what the door decides on.
|
|
418
|
+
- The door decides on the path as it normalises it (percent-decoded once, empty segments merged) and refuses a segment that decodes to a slash or a dot segment; the proxy relays the path as the client sent it. Relay it unchanged (nginx `proxy_pass` with no URI part, no Envoy rewrite) and let the origin normalise as the door does, or a path the origin reads differently is a way around a route.
|
|
419
|
+
- The stock configs strip `X-Agent-Custody-Grant` and `X-Agent-Custody-Agent` before the origin. `Authorization` reaches the origin unchanged, since the origin may use it: behind a proxy an agent should send its grant in `X-Agent-Custody-Grant`.
|
|
420
|
+
- Envoy sends the door only the client headers in `allowed_headers`. A new header the policy reads, such as a challenge header under another name, goes into that list.
|
|
421
|
+
|
|
327
422
|
## What it does not do yet
|
|
328
423
|
|
|
329
|
-
- Detect agents in web or API traffic.
|
|
330
|
-
-
|
|
424
|
+
- Detect agents in web or API traffic itself. An agent that signs per Web Bot Auth is identified by its signature, and a partner engine's signed verdict can be had; beyond those the only signals are the ones in the arrival fact: `declared` is a claim and `rate` is a pace ([door signals](door-signals.md)).
|
|
425
|
+
- Authenticate to a partner engine. The question carries no credential: put the adapter that holds the engine's API key and the signing key where only the door reaches it.
|
|
426
|
+
- Check AP2 mandates.
|
|
427
|
+
- Check every Web Bot Auth signature: Ed25519 only (no RSA-PSS or ECDSA), the components listed above only, no `Content-Digest`, no response signatures on the directory, and nonces in one process's memory. A signature agent must be listed in `agents`; the door does not fetch the directory of an origin it was not told about.
|
|
331
428
|
- Challenge an arrival with a passkey. Turnstile and hCaptcha are the providers; see [challenging a human](#challenging-a-human).
|
|
332
429
|
- Revoke a grant by a revocation list; a grant stands until it expires.
|
|
333
|
-
- Bind a grant to its sender. A
|
|
430
|
+
- Bind a grant to its sender without a signature. A grant presented alone is bearer-grade; under its agent's Web Bot Auth signature it is bound: see [presenting a passport](#what-the-door-knows-about-an-arrival).
|
|
334
431
|
- Stream a request body: the body is read whole, up to `maxBodyBytes`, so that the policy can read it and the receipt can commit to it.
|
|
335
432
|
- Relay a response larger than `maxResponseBytes`, or stream one: the body is relayed whole so that its digest can be recorded. A larger one is not held: reading stops at the limit, the client gets 502, and the receipt records that the origin answered.
|
|
336
433
|
|
|
337
|
-
|
|
434
|
+
Tutorials: [40-door.ts](../examples/40-door.ts), the proxy; [48-door-app.ts](../examples/48-door-app.ts), in-process; [49-door-authz.ts](../examples/49-door-authz.ts), behind nginx or Envoy; [examples/languages/door](../examples/languages/door), middleware for Go, Rails, Django, and Spring; [52-door-partner-verdict.ts](../examples/52-door-partner-verdict.ts), a partner engine's signed verdict.
|
package/docs/egress.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
# The egress witness
|
|
1
|
+
# The egress witness
|
|
2
|
+
|
|
3
|
+
> How it works and when to use it. Every field, route, and flag is in [the reference](../../../site/reference/egress.md).
|
|
2
4
|
|
|
3
5
|
The gateway holds an agent's tool credentials and receipts every call made through it. An agent that has a credential of its own, or that calls a public API with none, can go around it. The egress witness is for those connections. It is an HTTP forward proxy in the agent's network path, the [door](door.md) turned around to face outbound traffic. For each connection that does not go to the gateway, it:
|
|
4
6
|
|
package/docs/github-action.md
CHANGED
|
@@ -20,7 +20,7 @@ jobs:
|
|
|
20
20
|
runs-on: ubuntu-latest
|
|
21
21
|
steps:
|
|
22
22
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
23
|
-
- uses: svayatta/agent-custody@<commit sha of the release> # 0.16.
|
|
23
|
+
- uses: svayatta/agent-custody@<commit sha of the release> # 0.16.7
|
|
24
24
|
with:
|
|
25
25
|
path: .custody/receipts
|
|
26
26
|
issuer-key: .custody/keys/agent.pub
|
|
@@ -37,7 +37,7 @@ Pin the action to the commit of a release, as you pin every other action. A movi
|
|
|
37
37
|
| `principal-key` | the public key files of the principals whose grants a gateway receipt carries, one path on each line; SDK and Claude Code hook receipts need none | |
|
|
38
38
|
| `log-url` | the URL of the log; the action fetches the log key from it (`verify --log-url`) | |
|
|
39
39
|
| `log-id` | the id that every tree head must name (`verify --log-id`) | |
|
|
40
|
-
| `version` | the `@agent-custody/receipts` version that `npx` runs | `0.16.
|
|
40
|
+
| `version` | the `@agent-custody/receipts` version that `npx` runs | `0.16.7` |
|
|
41
41
|
| `github-token` | a token that can write pull request comments; an empty value writes the job summary only | `github.token` |
|
|
42
42
|
| `comment-author` | the login of the account that `github-token` posts as; the action edits only a comment from this account | `github-actions[bot]` |
|
|
43
43
|
|
package/docs/mandates.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Payment mandates and agent identity
|
|
1
|
+
# Payment mandates and agent identity (planned)
|
|
2
2
|
|
|
3
3
|
Design, not yet built. It tracks issues #185 and #186: fitting the grant and the receipt to the payment networks' standards, so that the networks define the authority and agent-custody keeps the evidence of what was done under it.
|
|
4
4
|
|
package/docs/perathos.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Reading a Perathos log
|
|
2
|
+
|
|
3
|
+
[Perathos](https://github.com/perathos-protocol/perathos) records an agent's tool calls, from hooks inside the agent's host (Claude Code or Cursor) or from its MCP proxy, a separate process in front of an MCP server. It hash-chains them into a session log and seals them with Ed25519 checkpoints: the hooks at the end of each turn, the proxy every `--seal-every` calls and when the client disconnects or the server exits. `agent-custody verify-perathos` checks such a log against the verification rules of the Perathos receipt spec (`docs/specs/RECEIPT_V1.md` in their repository), so an auditor can check either project's records with one tool. The reader was written from that spec alone, not from Perathos code.
|
|
4
|
+
|
|
5
|
+
The two formats record different things, and the report says which one it read. This page lists what the reader checks, what a valid log proves, and how the fields of the two formats correspond.
|
|
6
|
+
|
|
7
|
+
## Run it
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
agent-custody verify-perathos .perathos/sessions/<session>.jsonl \
|
|
11
|
+
--key <recorder public key, 64 hex> \
|
|
12
|
+
--head .perathos/sessions/<session>.head.json
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
PASS every line is a JSON object
|
|
17
|
+
PASS format is perathos.receipt/v1 with a known kind
|
|
18
|
+
PASS seq is 1, 2, 3, ... in file order
|
|
19
|
+
PASS prev_hash chains each receipt to the one before
|
|
20
|
+
PASS receipt_hash recomputes
|
|
21
|
+
PASS one session, and time never goes back
|
|
22
|
+
PASS checkpoint signatures verify
|
|
23
|
+
PASS every checkpoint is signed
|
|
24
|
+
PASS every signer is a trusted key
|
|
25
|
+
PASS the head witness's checkpoint is in the log
|
|
26
|
+
|
|
27
|
+
RESULT: VALID
|
|
28
|
+
|
|
29
|
+
session replay
|
|
30
|
+
receipts 7 (3 tool calls, 2 checkpoints)
|
|
31
|
+
sealed through seq 7
|
|
32
|
+
signers be58168fa007
|
|
33
|
+
time 2026-11-04T08:19:00.000000Z to 2026-11-04T08:19:06.000000Z (host clock)
|
|
34
|
+
denied 1 call(s) stopped by the guard
|
|
35
|
+
|
|
36
|
+
PROVENANCE: perathos.receipt/v1, recorded on the agent's host (claude-code) by hooks or an MCP proxy; the checkpoint key, or the credential for a remote signer, is on that host, so a valid log shows that the key holder sealed this sequence, not that an enforcement point outside the agent saw each call; times are the host's clock, and RFC 3161 anchors were not checked
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
| flag | effect |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `--key <hex>` | pins the recorder's Ed25519 public key (repeatable); a checkpoint signed by any other key fails. Without it, a session sealed by more than one key fails, and the report warns that no key was pinned |
|
|
42
|
+
| `--head <file>` | the head witness, `{ "seq", "receipt_hash" }` of the latest checkpoint (the file also holds its `session_id`, its `ts`, and a copy of its `signature`); a log cut back to an earlier checkpoint fails |
|
|
43
|
+
| `--allow-unsigned` | accepts a log with no checkpoint, or an unsigned one, and reports each as a warning |
|
|
44
|
+
| `--json` | the report as JSON |
|
|
45
|
+
|
|
46
|
+
It exits 0 when the log is valid and 1 when it is not. Receipts after the last checkpoint whose signature verified are reported as an unsealed tail, not an error, because the session may still be running; an unsigned checkpoint, one whose signature fails, or, with `--key`, one signed by a key that is not pinned, seals nothing. The head witness file is checked for shape first. From code: `verifyPerathosLog(text, { trustedKeys?, allowUnsigned?, head? })` and `formatPerathosReport(report)`.
|
|
47
|
+
|
|
48
|
+
## What it checks
|
|
49
|
+
|
|
50
|
+
Rules 1 to 9 of the spec. Two checks go beyond the spec's verification rules and Perathos's own verifier: the fixed `ts` form in rule 5 (the spec's field table gives that form, but its rules and its verifier check only that `ts` never decreases), and, in rule 8, one key for the whole session when no key is pinned (Perathos's own verifier warns when more than one key signed, and does not fail the log).
|
|
51
|
+
|
|
52
|
+
1. Every line is a JSON object, `v` is `perathos.receipt/v1`, and `kind` is `pre`, `post`, or `checkpoint`.
|
|
53
|
+
2. `seq` runs 1, 2, 3, and so on in file order.
|
|
54
|
+
3. Each `prev_hash` is the previous receipt's `receipt_hash`, and the first is 64 zeros.
|
|
55
|
+
4. Each `receipt_hash` recomputes: SHA-256 of the canonical JSON of every field except `receipt_hash` and `signature`, known fields or not.
|
|
56
|
+
5. One `session_id` throughout, and `ts` never goes back. Every `ts` must be in the spec's form, `YYYY-MM-DDTHH:MM:SS.mmmmmmZ`: in that fixed-width UTC form, string order is time order. A `ts` without the microseconds or with an offset could be an earlier instant that sorts as later, and a receipt after the last checkpoint has no signature to stop it, so any other form fails.
|
|
57
|
+
6. Every checkpoint signature verifies: Ed25519 over the 32 raw bytes of `receipt_hash`, by the key in `signer`, which `signature.verify_key` must equal.
|
|
58
|
+
7. At least one checkpoint, and every checkpoint signed. A checkpoint with `signer_error` is named as a signer failure, which explains a missing signature and does not excuse it.
|
|
59
|
+
8. With `--key`, every signer is a pinned key. Without it, one key must seal the whole session: someone without the recorder's key could otherwise append receipts after its last checkpoint and seal them with a key of their own. Pin two keys for a rotation you vouch for. Without `--key` the report also warns that a valid result shows only that the log is consistent with itself, not who sealed it, as our own `verify` requires `--issuer-key` for the same reason.
|
|
60
|
+
9. With `--head`, the log holds the head witness's checkpoint.
|
|
61
|
+
|
|
62
|
+
## What a valid log proves
|
|
63
|
+
|
|
64
|
+
The holder of the checkpoint key sealed this exact sequence, and nothing up to the last checkpoint was edited, removed, inserted, or reordered since. Whoever holds a call's arguments or result can show that they match the recorded hash.
|
|
65
|
+
|
|
66
|
+
It does not prove that an enforcement point outside the agent saw each call. The recorder runs in the agent's host. With the default local signer the checkpoint key is a file on that host; with a remote signer (Vault, Cloud KMS, or a signing command) the key stays in the service, but the credential to use it is usually reachable from the host. So the log is as trustworthy as that host. A log cut back to an earlier checkpoint cannot be shown if the head witness was also deleted and no copy of the anchors is kept elsewhere. Times are the host's clock. The `model` field is self-reported. The spec lists the rest, including a recorder that was not running for part of a session: a hook that failed to write a receipt shows up only in the local, unsigned `~/.perathos/errors.log`.
|
|
67
|
+
|
|
68
|
+
## How the two formats correspond
|
|
69
|
+
|
|
70
|
+
| Perathos `receipt/v1` | agent-custody receipt | note |
|
|
71
|
+
| --- | --- | --- |
|
|
72
|
+
| `agent` | `issuer.kind` | Perathos names the recording integration; agent-custody names the issuer kind and what it is worth ([verification](verification.md)) |
|
|
73
|
+
| `session_id`, `tool_use_id` | `session.id`, `session.toolUseId` | both are the host's correlation ids; agent-custody marks them `claimed` |
|
|
74
|
+
| `seq`, `prev_hash` | leaf index in the RFC 9162 log | a per-session hash chain against one Merkle log; agent-custody proves inclusion with an inclusion proof, Perathos by walking the chain |
|
|
75
|
+
| `receipt_hash` | the leaf hash of the DSSE envelope | both SHA-256 over canonical JSON |
|
|
76
|
+
| `checkpoint` with `signature` | the signed tree head in each bundle | Perathos signs checkpoints only; agent-custody signs every receipt and every tree head |
|
|
77
|
+
| `pre` / `post` | one receipt with `request` and `outcome` | Perathos writes a call as two receipts linked by `tool_use_id` |
|
|
78
|
+
| `tool`, `args_hash`, `result_hash` | `tool.name`, `request.argsDigest`, `outcome.resultDigest` | agent-custody can also carry the arguments, or withhold a field behind a salted commitment or an encrypted value ([private evidence](usage.md#private-evidence)) |
|
|
79
|
+
| `status` | `outcome.status` | `ok` or `error` against `executed`, `failed`, `denied`, `error`, or `withheld` |
|
|
80
|
+
| `model` | `model.id` | self-reported in both; agent-custody marks it `claimed` |
|
|
81
|
+
| `guard.decision`, `guard.rule` | `policy.decision`, `policy.reasons`, `policy.policyDigest` | a guard rule against a Cedar or Rego policy pinned by its digest. A denied call is a `pre` with `decision: "deny"` and no `post`; the rule `guard.error` means the guard failed and denied the call; a rule prefixed `script:` or `write:` matched inside a script the command runs or writes |
|
|
82
|
+
| `guard.precondition` (the hash of a signed safety check) | `delegation` (a principal-signed grant) | signed by a listed approver key, or by the local recorder key when no approver is listed; scoped to a target and reusable until it expires, like a grant |
|
|
83
|
+
| `guard.approval` (the hash of a Perathos Gate receipt) | `approval` (a payload-bound approval) | names a Gate receipt recording a passkey approval; the Gate receipt's `request.args_hash` equals the `pre` receipt's `args_hash`. `perathos evidence verify` checks that binding; this reader does not yet |
|
|
84
|
+
| `perathos.anchor/v1` (RFC 3161) | the log's checkpoints, witness, and chain anchor ([anchoring](anchoring.md)) | a timestamp token is an upper bound on when a checkpoint existed; it shows a cut log only when a copy of the anchors is kept off the recording machine, where agent-custody shows one by consistency with an independently held RFC 9162 tree head |
|
|
85
|
+
|
|
86
|
+
Two Perathos fields have no counterpart above: `event` on a checkpoint names what sealed it (a hook event such as `Stop`, or `mcp-periodic` and `mcp-end` from the proxy), and `result_from: "payload"` on a Cursor `post` means the result hash was taken over the hook payload, because Cursor sent no output.
|
|
87
|
+
|
|
88
|
+
Both use Ed25519, SHA-256, and canonical JSON with sorted keys that matches RFC 8785 for these bodies. The structures differ, so a shared schema would lose detail on both sides. The common ground both can map to is IETF SCITT ([aligning with SCITT](scitt.md)).
|
|
89
|
+
|
|
90
|
+
## Not read yet
|
|
91
|
+
|
|
92
|
+
- RFC 3161 anchors (`perathos.anchor/v1`): verifying a timestamp token means parsing the authority's signed response and chaining it to a pinned root certificate.
|
|
93
|
+
- The rest of a Perathos evidence pack: its signed manifest, anchors, and preconditions. The session log inside a pack is read as above. The head witness file also carries `session_id`, `ts`, and `signature` (a copy of the checkpoint's own signature), which the spec does not define and which are not checked.
|
|
94
|
+
- Signed preconditions (`perathos.precondition/v1`) and Gate approvals.
|
|
95
|
+
|
|
96
|
+
## Tested against a log Perathos wrote
|
|
97
|
+
|
|
98
|
+
`vectors/interop/perathos/pocketos-replay/` holds the session log, head witness, and verifier report from the sample evidence pack in the Perathos repository, copied byte for byte with their licence ([the vector's README](../vectors/interop/perathos/README.md)). `verify-perathos` verifies that log with the recorder's key and the head witness, and agrees with Perathos's own verifier on the session, the receipt, call, and checkpoint counts, the sealed range, the signer, the times, and the two calls the guard blocked. The same log with one receipt edited, cut back to its first checkpoint against the head witness, or checked against another key, fails. So our canonical JSON matches their writer's, and their signatures are hex. Perathos also publishes [test vectors for the receipt spec](https://github.com/perathos-protocol/perathos/tree/main/docs/specs/vectors/receipt_v1): a valid log and three that must fail, each with the verdict and error its verifier gives.
|
|
99
|
+
|
|
100
|
+
The other tests in `test/perathos.test.ts` write logs from the spec, to reach each rule. Example 45 does the same and shows a cut log caught by its head witness and an edited guard decision caught by the chain.
|
package/docs/sdk.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SDK and framework hooks
|
|
2
2
|
|
|
3
3
|
The gateway sees only MCP traffic. The SDK sees whatever the agent framework lets it hook, from inside the agent's own process. It issues the same receipt format, verified by the same command, with one difference a verifier cannot miss: the receipt names its issuer as `sdk`, and every field is `claimed`.
|
|
4
4
|
|
|
@@ -122,6 +122,37 @@ The receipt does not change. It keeps the policy ids and the policy digest, and
|
|
|
122
122
|
|
|
123
123
|
When the denial receipt cannot be issued, the call is blocked all the same, and the reason ends with `(no receipt: <why>)` in place of the receipt id. `<why>` names the kind of failure and nothing more. In TypeScript it is `the receipt could not be recorded`. In Python it is `the sidecar could not be reached`, `the sidecar answered HTTP <status>`, `the sidecar refused the request`, `the sidecar's answer was malformed`, or `an unexpected <exception type>`. The reason goes into the model's context, and the error behind it can carry a log or sidecar URL with credentials in it, or the text of an upstream answer. So the error itself goes to stderr in TypeScript and to the `agent_custody` logger at `WARNING` in Python, never into the reason, and the URL in it is shown without its user, password, or query string. Every adapter that answers a deny with text works this way: Claude Code, the Claude Agent SDK and OpenAI Agents in both languages, OpenClaw, DeepSeek Harness, Hermes, Google ADK, and CrewAI. OpenAI Agents in both languages and CrewAI used to raise the error when the denial receipt failed; they now return the denial text, as the others do, and the tool still does not run. The Vercel AI `wrapTools` and `issuer.wrap` throw `PolicyDeniedError`, which needs a receipt id, so there a failed denial receipt still rejects with the log's error.
|
|
124
124
|
|
|
125
|
+
### Before you install: your past sessions
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npx -y @agent-custody/receipts audit-sessions --since 7d
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
This reads the transcripts Claude Code already keeps on the machine (`~/.claude/projects`, or `$CLAUDE_CONFIG_DIR/projects`), takes every tool call in the window, and evaluates it against the starter policy that `init claude-code` installs, or `--policy <file.cedar>`. It installs no hook, writes no file, and makes no network request, so you can see what the policy would have caught before you decide to install anything.
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
Read 4 tool calls in 1 session.
|
|
135
|
+
Policy: the init claude-code template.
|
|
136
|
+
|
|
137
|
+
The policy would have denied 2 calls:
|
|
138
|
+
|
|
139
|
+
Bash: git push --force origin main
|
|
140
|
+
reason: force push rewrites shared history (git push --force-with-lease is allowed)
|
|
141
|
+
rule: forbid(principal, action == Action::"Bash", resource) when { context.args has command && ( context.args.command like "*git push --force *" || context.args.comm… [policy1]
|
|
142
|
+
when: 2026-11-09T10:04:52.000Z session 4f3a91c2 in shop
|
|
143
|
+
|
|
144
|
+
Bash: terraform destroy -auto-approve
|
|
145
|
+
reason: terraform destroy deletes infrastructure
|
|
146
|
+
rule: forbid(principal, action == Action::"Bash", resource) when { context.args has command && context.args.command like "*terraform destroy*" } [policy5]
|
|
147
|
+
when: 2026-11-10T16:20:40.000Z session 4f3a91c2 in shop
|
|
148
|
+
|
|
149
|
+
PREVIEW: these are the agent host's own transcripts, not receipts. Nothing here is signed or logged, and a transcript can be edited. For a receipt of each call, signed and logged, run: agent-custody init claude-code
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
`--since` takes `7d`, `24h`, `30m`, a date, or `all`. `--counts` prints only the numbers per rule, with no command, path, session, or project, so the output can be shared. `--json` gives the whole result. A call that a forbid rule matched is counted as that rule's denial, even when another rule errored on the same call. A call that no forbid matched, but on which a rule errored (a value Cedar cannot hold, such as a float, or an attribute the call does not have), is listed apart: the hook denies such a call, but no rule decided it. A policy that does not parse is refused with the parse error and exit 1, since otherwise every call would be denied by the error and nothing by a rule. Under a default-deny policy, a call no permit matched is shown as `no permit matched (default deny)`. `--counts` names the policy by its file name only. A Rego policy is refused, because compiling one runs `opa`, which writes files.
|
|
153
|
+
|
|
154
|
+
A transcript is the agent host's own account and can be edited, so this is a preview of what the policy catches, not evidence. The hooks that `init claude-code` installs make a signed receipt of each call.
|
|
155
|
+
|
|
125
156
|
### The report
|
|
126
157
|
|
|
127
158
|
```bash
|
package/docs/threat-model.md
CHANGED
|
@@ -121,7 +121,8 @@ The portal is not part of the evidence: it publishes policy names and mints log
|
|
|
121
121
|
|
|
122
122
|
| attack | defence | kind |
|
|
123
123
|
| --- | --- | --- |
|
|
124
|
-
| Guess or steal a member's password | Optional TOTP MFA on the account. A code works once, wrong codes are throttled per address and per account, and the half-signed-in cookie is never a session. A GitHub or Google sign-in goes through the same code step. | deployment |
|
|
124
|
+
| Guess or steal a member's password | Optional TOTP MFA on the account. A code works once, wrong codes are throttled per address and per account, and the half-signed-in cookie is never a session. A GitHub or Google sign-in goes through the same code step. A recovery code works once in place of a code, counts against the same limit, and is stored only as a hash. New recovery codes need a current code, so a stolen session cannot take them. A password change needs the current password and ends every other session. | deployment |
|
|
125
|
+
| Take over an account through the password reset | The reset request answers the same for every address and looks the address up after it answers. Requests are limited per client and per address. The token is 256 random bits, works once, expires after one hour, and is stored only as a hash. A reset ends every session and does not sign in, so two-step sign-in still applies. A reset of an unverified account removes the providers linked before the address was proved. A member of a tenant that enforces single sign-on gets no reset. | deployment |
|
|
125
126
|
| A member acts beyond their job | Four roles: `readonly` reads, `reviewer` also publishes policy versions, `admin` also manages keys and members below owner, `owner` also manages billing and owners. A new write route needs `admin` unless it is listed. The last owner cannot be removed or demoted. | deployment |
|
|
126
127
|
| Claim an invited address to join a tenant | An invite is accepted only by an account with a verified address, and an account belongs to one tenant. | deployment |
|
|
127
128
|
| Sign in through an IdP the tenant does not own | The operator sets single sign-on, never the tenant. An IdP is trusted only for the email domains of its tenant, and a domain belongs to one tenant. The portal checks the OIDC `id_token` signature against the IdP's key set, or the signed SAML assertion through a maintained library, and ties the sign-in to the request that started it. | deployment |
|
package/docs/tutorials.md
CHANGED
|
@@ -54,6 +54,12 @@ Suggested reading order is the numbering. Output lands in `examples-out/`, which
|
|
|
54
54
|
| 42 | a first egress policy from what the agents did in observe mode | [42-egress-draft.ts](../examples/42-egress-draft.ts) | the witness observes an agent reach a docs mirror three times and a paste site once; `egress draft-policy` verifies the receipts and drafts one permit with a count and first and last time per destination, under a warning that it permits everything the agent did; the review deletes the paste site, and the enforced policy relays the mirror and refuses the paste site | `src/egress-draft.ts` |
|
|
55
55
|
| 43 | an OWASP ACS Guardian whose decisions land in a transparency log | [43-acs-guardian.ts](../examples/43-acs-guardian.ts) | a log runs under a key of its own; the ACS README's sample `steps/toolCallRequest` piped through `agent-custody acs` is allowed, its receipt carries the session's `chain_hash`, and it verifies offline with only the Guardian's and the log's public keys; in one session a read outside `/reports` is denied, a result for an allowed request passes, and a result for an unknown request is denied; a consistency proof shows the log after the deny extends the log that held the first decision (ACS issue #18, directions 1 and 3) | `src/acs.ts`, `src/config.ts` |
|
|
56
56
|
| 44 | the egress witness deciding by Rego | [44-egress-rego.ts](../examples/44-egress-rego.ts) | `policyFile: "policy.rego"`: the witness compiles it with `opa build`; a Rego `deny` refuses CONNECT api.stripe.com:443 with its string as the reason, an `allow` relays the docs mirror for the agent the credential proved, a guessed secret naming that agent is the principal `"unknown"` and gets 407, and an edit that does not compile leaves the policy in force; the refusal verifies | `src/egress.ts`, `src/policy-rego.ts` |
|
|
57
|
+
| 45 | reading another project's records: a Perathos session log | [45-perathos-log.ts](../examples/45-perathos-log.ts) | a session written to the Perathos receipt spec (two calls, one denied by its guard, two signed checkpoints) verifies with the recorder's key pinned and its head witness; the report labels it as recorded inside the agent's host; a log cut back to the first checkpoint still chains but fails against the head witness; a denied delete edited to allow, hash recomputed, breaks the next `prev_hash` | `src/perathos.ts` |
|
|
58
|
+
| 46 | what the policy would have denied in past Claude Code sessions, read-only | [46-audit-sessions.ts](../examples/46-audit-sessions.ts) | three Claude Code transcripts written the way Claude Code writes them (two projects, a subagent, a repeated call); `audit-sessions` reads them against the starter policy and lists a force push and a `terraform destroy` with their rules and reasons; `--counts` shows numbers only; a stale transcript outside `--since 7d` is skipped; the output says a transcript is not a receipt | `src/session-audit.ts`, `src/deny-report.ts` |
|
|
59
|
+
| 47 | the door checks Web Bot Auth signatures | [47-web-bot-auth.ts](../examples/47-web-bot-auth.ts) | a crawler publishes its Ed25519 key in a directory at its own origin (served by a stub here) and signs each request (RFC 9421, tag `web-bot-auth`); unsigned it is unknown and refused, signed it is verified as `https://crawler.example` with no grant and the directory is fetched once; the same request again is a replay, a signature made for another site is refused; a grant naming the crawler under its signature is bound to its sender, another agent's grant under it is `wrong-sender`; the receipts verify | `src/web-bot-auth.ts`, `src/door.ts`, `src/config.ts` |
|
|
60
|
+
| 48 | the door in-process: Express middleware and a Next.js route-handler wrapper | [48-door-app.ts](../examples/48-door-app.ts) | `door.json` without an origin; an Express shop with `app.use(door)` before `express.json()`; an unknown arrival reads the catalogue and is refused a refund that the app never sees; an agent with a grant refunds £45, committed to the log before the app runs, its body reaching `express.json()` and its grant stripped; the same door wraps a fetch-style `POST` handler as a Next.js route; every receipt records the app's status and body digest and verifies | `src/door-app.ts`, `src/door.ts` |
|
|
61
|
+
| 49 | the door behind stock nginx or Envoy: authz checks instead of relaying | [49-door-authz.ts](../examples/49-door-authz.ts) | the door with `authz: true` answers checks as nginx `auth_request` sends them (`X-Original-Method`, `X-Original-URI`): a catalogue read 200 and an unknown refund 403; a verified agent's refund is committed to the log before the 200; a check that names no original request is refused 400 with no receipt; each receipt verifies and its report says it records the decision, not the origin's answer. `deploy/door/demo.sh` runs the real nginx and Envoy | `src/door.ts`, `src/config.ts` |
|
|
62
|
+
| 52 | the door asks a partner detection engine, and the engine signs its verdict | [52-door-partner-verdict.ts](../examples/52-door-partner-verdict.ts) | a stub engine (`scripts/fake-partner.ts`) signs a verdict for each arrival's receipt and route; a browser's `human` verdict is relayed and a bot's refused by a policy on `context.facts.partner`; the receipt carries the verdict as an attested fact and verifies with the engine's key as an upstream key, and not without it; a verdict replayed from another arrival is refused with 503, and so is an arrival when the engine times out (`onFailure: "deny"`), even on a route the policy alone would allow | `src/door-partner.ts`, `src/door.ts` |
|
|
57
63
|
|
|
58
64
|
## How policies are defined, in one paragraph
|
|
59
65
|
|
package/docs/usage.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Running the gateway
|
|
2
|
+
|
|
3
|
+
> How it works and when to use it. Every field, route, and flag is in [the reference](../../../site/reference/gateway.md).
|
|
2
4
|
|
|
3
5
|
This page covers the gateway, the out-of-process producer. For the in-process interceptor that hooks Claude Code, the Claude Agent SDK, or any framework's tool functions, see [sdk.md](sdk.md).
|
|
4
6
|
|
package/docs/verification.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# How verification works
|
|
2
2
|
|
|
3
3
|
A verifier needs three things and no network access:
|
|
4
4
|
|
|
@@ -84,6 +84,7 @@ A refused call's `execution` row carries the reason the receipt records, for exa
|
|
|
84
84
|
| gateway receipt carries a delegation | gateway receipts always embed the signed grant they enforced | an SDK receipt relabelled as gateway |
|
|
85
85
|
| gateway receipt carries a policy decision | gateway receipts always record the Cedar decision | same |
|
|
86
86
|
| door receipt carries a policy decision | a door decides every arrival by policy; it carries a grant only when the arrival presented one, so there is no delegation check for it | a record-only receipt relabelled as door |
|
|
87
|
+
| door authz decided, relayed nothing | only on a door receipt with `issuer.framework: "authz"`: the door answered a proxy's authz check (nginx `auth_request`, Envoy `ext_authz`) and relayed nothing, so an allow is `withheld` and a deny `denied`; the receipt records the decision, never the body or the origin's answer ([the door](door.md#behind-nginx-or-envoy-authz-mode)) | an authz receipt re-signed to claim the request was executed with a result |
|
|
87
88
|
| egress receipt carries a policy decision | an egress witness decides every connection by policy | a record-only receipt relabelled as egress |
|
|
88
89
|
| egress destination observed | the receipt's tool, `host:port`, is the witness's observation and equals the destination fact the policy decided on; an observed bypass of the gateway, not a record of what was sent | a receipt re-signed to name another destination |
|
|
89
90
|
| egress open committed before relaying | a relayed connection carries the authorization the witness committed to the log before any byte moved | a bypass with no record until it closed, or a receipt re-signed to drop the commitment |
|
|
@@ -104,6 +105,7 @@ A refused call's `execution` row carries the reason the receipt records, for exa
|
|
|
104
105
|
| request args digest | the args in the predicate hash to the digest in the subject. Recomputed when the arguments are in clear, disclosed with `--disclose`, or decrypted with `--capture-key-env`; when fields are withheld and neither is given, it passes as committed, the detail saying "committed, not recomputed" and how many fields are withheld | edited arguments, or a disclosure that contradicts a commitment |
|
|
105
106
|
| execution result digest | executed and failed calls: the result in the predicate hashes to `execution.resultDigest`, under the same rules as the arguments; a provider delivery withheld with the result is restored first, since the digest covered it | an edited result, or a disclosure or key that does not match the commitment, or a capture note naming a field that is not a commitment |
|
|
106
107
|
| fact `<name>` value, fact `<name>` args | only for a captured fact: its commitments hold against the disclosed or decrypted value, or pass as committed when neither is given | a disclosure that lies about a fact the policy decided on |
|
|
108
|
+
| fact `<name>` signature (upstream key) | only for a fact marked `attested` (the door's partner verdict): its `attestation` envelope verifies under an upstream key given with `--upstream-key`, names this receipt and tool, and signs the digest of the fact's value as recorded. Without an upstream key it fails, since the receipt says the fact is attested and the reader cannot confirm it. A withheld envelope beside a value in clear fails it; `fact <name> signature not checked` passes with a note when the value itself is withheld | a verdict signed by another key, edited, or moved from another receipt |
|
|
107
109
|
| upstream signature not checked | only when the result is withheld and an upstream key or provider secret was given: the signature cannot be checked against a result the verifier cannot see, so the line passes with a note in place of the signature check; disclose the result or give the key to run it | nothing; it is a note |
|
|
108
110
|
| policy decision consistent with execution | allow went with executed or failed; an enforced deny went with denied; a deny carrying `enforced: false` (observe mode) went with anything but denied, and the detail says "observe mode, not enforced". Skipped when no policy was evaluated | an issuer that executed after a deny |
|
|
109
111
|
| no policy errors on an allow | an allow was not produced while Cedar reported errors | broken fail-closed behaviour |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-custody/receipts",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.7",
|
|
4
4
|
"mcpName": "io.github.svayatta/agent-custody",
|
|
5
5
|
"description": "Proof of what your AI agents did. Give your agents real power, without losing control of them: signed, verifiable receipts for tool calls, an MCP gateway with Cedar or Rego policy, and a Merkle transparency log.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,6 +49,10 @@
|
|
|
49
49
|
"types": "./dist/sdk/deepseek-harness.d.ts",
|
|
50
50
|
"default": "./dist/sdk/deepseek-harness.js"
|
|
51
51
|
},
|
|
52
|
+
"./door": {
|
|
53
|
+
"types": "./dist/door-app.d.ts",
|
|
54
|
+
"default": "./dist/door-app.js"
|
|
55
|
+
},
|
|
52
56
|
"./cli": {
|
|
53
57
|
"types": "./dist/cli.d.ts",
|
|
54
58
|
"default": "./dist/cli.js"
|
|
@@ -83,9 +87,11 @@
|
|
|
83
87
|
"@langchain/core": "1.2.9",
|
|
84
88
|
"@node-saml/node-saml": "5.1.0",
|
|
85
89
|
"@openai/agents": "0.18.0",
|
|
90
|
+
"@types/express": "5.0.6",
|
|
86
91
|
"@types/node": "26.4.1",
|
|
87
92
|
"@vitest/coverage-v8": "5.0.0",
|
|
88
93
|
"ai": "7.0.93",
|
|
94
|
+
"express": "5.2.1",
|
|
89
95
|
"langchain": "1.5.15",
|
|
90
96
|
"tsx": "4.23.13",
|
|
91
97
|
"typescript": "7.0.2",
|