@agent-custody/receipts 0.16.11 → 0.16.12
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 +14 -5
- package/dist/check.js +12 -0
- package/dist/cli.js +116 -3
- package/dist/config.d.ts +3 -0
- package/dist/config.js +13 -0
- package/dist/door-app.js +1 -1
- package/dist/door-core.d.ts +13 -1
- package/dist/door-core.js +16 -2
- package/dist/door-error-rates.d.ts +102 -0
- package/dist/door-error-rates.js +178 -0
- package/dist/door-form.d.ts +7 -2
- package/dist/door-form.js +52 -4
- package/dist/door-measure.d.ts +153 -0
- package/dist/door-measure.js +325 -0
- package/dist/door-signals.d.ts +414 -0
- package/dist/door-signals.js +555 -0
- package/dist/door-test-set.d.ts +43 -0
- package/dist/door-test-set.js +117 -0
- package/dist/door-worker.d.ts +16 -1
- package/dist/door-worker.js +26 -2
- package/dist/door.js +2 -2
- package/dist/index.d.ts +8 -0
- package/dist/index.js +4 -0
- package/dist/lock.d.ts +5 -0
- package/dist/lock.js +1 -1
- package/docs/door-error-rates.md +490 -0
- package/docs/door-languages.md +3 -1
- package/docs/door-middleware.md +6 -1
- package/docs/door-quickstart.md +2 -2
- package/docs/door-signals.md +112 -2
- package/docs/door-worker.md +13 -0
- package/docs/door.md +32 -5
- package/docs/github-action.md +2 -2
- package/docs/tutorials.md +4 -0
- package/package.json +2 -1
package/docs/door-signals.md
CHANGED
|
@@ -34,6 +34,70 @@ Three labels run through the table:
|
|
|
34
34
|
| `partner.outcome` | checked, against the engine's key | Only when `partner` is configured and the route is in `partner.routes`. `verified`: the partner engine answered with a verdict whose signature verified under `partner.keyFile` and binds this receipt and route; the verdict is then the `partner` fact (below). `rejected`: the engine answered, and it was not a verdict signed for this arrival: a signature by another key, one for another receipt or route, a verdict of another engine, a malformed verdict, or an envelope carrying more than the attestation (`error` says which). `unavailable`: no answer within `timeoutMs`, an error status, a redirect, or `maxInFlight` questions already waiting | Anything about the arrival when it is not `verified`. Under `onFailure: "deny"` (the default) an arrival without a verified verdict is refused with 503 whatever the policy says; under `"absent"` the policy decides without the `partner` fact |
|
|
35
35
|
| `method`, `path`, `route` | observed | What arrived, the path percent-decoded once, and the route it fell under | |
|
|
36
36
|
|
|
37
|
+
## The behaviour and fingerprint signals
|
|
38
|
+
|
|
39
|
+
The door adds two fields to the arrival fact when its config has a `behaviour` object: `fingerprint` (what the request and its connection look like) and `behaviour` (how the source acts over time). Without `behaviour` in the config, the arrival fact has neither field, and the door reads no TLS header and no form report. The config is in [the door](door.md#behaviour-and-fingerprint-signals).
|
|
40
|
+
|
|
41
|
+
Nine of the values are flags: booleans that mark an arrival. A flag is not a verdict. The door never refuses an arrival because of a signal. Only your policy reads the signals, and the receipt records each one that the policy read.
|
|
42
|
+
|
|
43
|
+
Each flag is wrong for some people and for some programs. The method that measures how often, and the measured rates, are in [door error rates](door-error-rates.md). `agent-custody door measure` replays a labelled set through the same signal functions, and `agent-custody door labels` exports a labelled set from the receipts of your own door. Measure a flag on your own traffic before a rule reads it.
|
|
44
|
+
|
|
45
|
+
The flags:
|
|
46
|
+
|
|
47
|
+
| signal | label | what it means | what it does not mean |
|
|
48
|
+
| --- | --- | --- | --- |
|
|
49
|
+
| `fingerprint.headers.mismatch` | observed, against a claim | The `User-Agent` states a browser, and the request that the door received lacks a header that this browser sends on every request. The rule always reads `accept-language`. When the door knows that the client used https, the rule also reads `sec-fetch-site`, `sec-fetch-mode`, and `sec-fetch-dest` (Chromium from 80, Firefox from 90, Safari from 17) and `sec-ch-ua` (Chromium from 100; not an Android WebView, a WebView browser with `Version/` before `Chrome/`, Electron, a browser that says `like Chrome/`, or an application that names itself before `Chrome/`). On a POST, PUT, PATCH, or DELETE, on any scheme, the rule also reads `origin` (the same versions as `sec-fetch-*`); a browser sends it on every write, with the value `null` when it hides the origin. An OPTIONS request and an upgrade are checked for `accept-language` only. `missing` names the headers | That the client is a program. The flag is true for a person behind a privacy browser, an extension, or a company proxy that removes one of these headers, for a person whose extension changes the `User-Agent`, and for a Chromium browser that sends no client hints. A proxy in front of the door that drops one of these headers makes every browser a mismatch. It does not mean that an arrival without the flag is a browser: a program that sends the headers of a browser has no mismatch, and a program that states its own name is never a mismatch |
|
|
50
|
+
| `fingerprint.headers.hintsMismatch` | observed, against a claim | The arrival sent `sec-ch-ua`, the `User-Agent` states a browser, and the two do not state the same browser: the `User-Agent` states Firefox or Safari, which send no `sec-ch-ua`, or the major version of the `Chromium` brand is not the major version in the `User-Agent`. A Chromium that is given another `User-Agent` keeps its own `sec-ch-ua`. The rule reads values, so it also works in authz mode when the proxy forwards `sec-ch-ua` | That the client is a program. The flag is true for a person whose extension changes the `User-Agent` and not the client hints. It does not mean that an arrival without the flag is a browser: a program that copies the `User-Agent` of the Chromium that it runs has no flag, and a program can set the client hints too. The rule reads no brand name: in the recorded capture, headless Chrome sends the brands of Chrome |
|
|
51
|
+
| `fingerprint.headers.fetchInvalid` | observed | The `sec-fetch-*` headers have a combination that the Fetch Metadata specification rules out: `sec-fetch-user` without `sec-fetch-mode: navigate`, or `sec-fetch-mode: navigate` with a `sec-fetch-dest` that is not `document`, `iframe`, `frame`, `embed`, `object`, or `fencedframe`. The rules come from the specification, not from data | That an arrival without the flag is a browser: a program that copies a full set of these headers from a browser has no flag. `sec-fetch-site: none` on a write is not in the rule, because a browser extension sends it |
|
|
52
|
+
| `fingerprint.tls.mismatch` | observed, against a claim | The `User-Agent` states a browser of a version that offers TLS 1.3 (Chromium from 70, Firefox from 63, Safari from 13), and the JA4 of a TCP ClientHello shows no TLS 1.3 or no ALPN | That the client is a program. A proxy that inspects TLS between the person and the site (a company network, some antivirus products) sends its own ClientHello, so a person behind one can be a mismatch. So can a person whose organisation turns TLS 1.3 off. It does not mean that an arrival without the flag is a browser: the rule reads two properties of the ClientHello, and a program can have both. A QUIC ClientHello is not checked |
|
|
53
|
+
| `fingerprint.tls.knownTool` | observed | The JA4 is in the door's table of fingerprints of known tools, `KNOWN_TOOL_JA4` | That the tool is hostile, or that a tool not in the table is absent. The table holds six fingerprints, recorded from one build each of curl, Python, Go, Node, and Bun; another build of the same tool can have another fingerprint. A person behind a proxy that uses the same TLS library has the same fingerprint |
|
|
54
|
+
| `behaviour.timing.regular` | checked | The source arrived at a steady pace: at least 5 gaps between its remembered arrivals, a median gap of at least 100 ms, and a difference between the longest gap and the shortest gap of at most 10 % of the median | That the source is a program that you do not want. The flag is true for a page that polls or refreshes on a timer in the browser of a person (a dashboard, a status page), and for the monitoring tool or the health check that you run yourself. It does not mean that an arrival without the flag is a person: a program that varies its pace is not regular, and one more source at the same address breaks the pace |
|
|
55
|
+
| `behaviour.navigation.directWrite` | observed | A POST, PUT, PATCH, or DELETE arrived, the source loaded no HTML document through this door in the last 30 minutes, the `Referer` is absent or names another host, the `Origin` is absent or names another host, and the request has no `Sec-Fetch-Site: same-origin` | That the arrival is a program. The flag is true for every API client that loads no page, a verified agent and a webhook included. It is true for a person whose address changed after the page load, who kept the form open for more than 30 minutes, whose page came from a cache in front of the door, or whose page load went to another door process, when the browser also sends no same-origin `Referer`, no same-origin `Origin`, and no `Sec-Fetch-Site: same-origin` (a form page on another host of the site, or a browser that hides the origin on a site that is not https). It does not mean that an arrival without the flag is a person. The `Referer`, the `Origin`, and `Sec-Fetch-Site` are the client's word: a program that sends a GET for the page first, a `Referer` or an `Origin` that names the host, or `Sec-Fetch-Site: same-origin` has no flag. For a program that loads the page first, read `sincePageMs` |
|
|
56
|
+
| `behaviour.form.fast` | a claim | The form report states at least 8 key presses, and a fill time of less than 20 ms for each key press | That a program filled the form. A device or a tool that types for a person is fast too: a barcode scanner, a security key, a text expander, a password manager that types. The form report is the word of the client's script: a program can send a report that is not fast |
|
|
57
|
+
| `behaviour.form.noInput` | a claim | The form report states a submit with no key press and no pointer press | That a program sent the form. The flag is true for a person whose browser or password manager fills the form and submits it, and for an assistive tool that submits without a key press or a click. A program can send a report that states input |
|
|
58
|
+
|
|
59
|
+
The fields beside the flags:
|
|
60
|
+
|
|
61
|
+
| signal | label | what it means | what it does not mean |
|
|
62
|
+
| --- | --- | --- | --- |
|
|
63
|
+
| `fingerprint.headers.client`, `family`, `version` | a claim | What the `User-Agent` states: `browser` (`chromium`, `firefox`, `safari`), `agent` (an AI agent that names itself; see `vendor` and `purpose` below), `tool` (the name of the tool, or `crawler`), `other`, or `unstated`, and the major version of a browser | What the client is. Any client can send any `User-Agent`. A `User-Agent` with a product name that ends in `bot/`, `crawler/`, or `spider/`, or with a `+http` address, is a `tool` with the family `crawler` |
|
|
64
|
+
| `fingerprint.headers.vendor`, `purpose` | a claim | Only for the client `agent`: the vendor (`openai`, `anthropic`, `perplexity`, `google`) and what the vendor says the agent fetches for: `training` (to train a model), `search` (to build a search index), or `user` (one user asked for this page). The table is `AI_AGENTS` in `src/door-signals.ts`; each entry is from the vendor's own page, and the source is beside it. `family` is the product token in lowercase (`gptbot`, `claude-user`) | That the arrival is that agent. Any client can send the name. The door does not check the address against the ranges that a vendor publishes. A signature is the check: [Web Bot Auth](door.md) makes `signature: "verified"`. A token that a vendor documents for another purpose is a `crawler` |
|
|
65
|
+
| `fingerprint.headers.hints` | observed | Only when the arrival sent `sec-ch-ua`: `version`, the major version of the `Chromium` brand, when the header has one. The header itself is not recorded | |
|
|
66
|
+
| `fingerprint.headers.http` | observed, through Cloudflare | In a Worker only: the HTTP version between the client and Cloudflare (`1.1`, `2`, `3`). A number for your policy, not a flag | That a browser on HTTP/1.1 is a program. A proxy that inspects traffic between the person and the site speaks HTTP/1.1 for the person |
|
|
67
|
+
| `fingerprint.network.asn`, `organization` | observed, through Cloudflare | In a Worker only: the number of the autonomous system of the address and the name of its holder, as Cloudflare gives them. A rule can ask for a challenge when the network is a hosting provider | That an arrival from a hosting network is a program. A person behind a VPN, a company gateway, or a private relay comes from such a network. The Node door has no source for this |
|
|
68
|
+
| `fingerprint.seen` | checked | How many arrivals in the last 60 seconds had this fingerprint (the JA4 and the header order), from every source, this one included. A client that changes its address and keeps its TLS stack and header order is still one fingerprint. Absent when the arrival has no JA4 and no header order. The count stops at 1,000 | That the arrivals are one client. Every copy of one browser version has the same fingerprint, so a busy site sees a high count for a current browser. A number for your policy, not a flag. One process's memory: at most 10,000 fingerprints |
|
|
69
|
+
| `fingerprint.headers.order`, `count` | observed | A hash of the lowercase header names in the order that the door received them, and how many there were, without the door's own headers. No header value is in the hash | The identity of a client. Two clients of the same kind have the same order. A proxy in front of the door can reorder, add, or drop headers, and the door records what it received |
|
|
70
|
+
| `fingerprint.tls.ja4` and the fields from it (`protocol`, `version`, `sni`, `ciphers`, `extensions`, `alpn`) | observed, through your proxy or Cloudflare | The JA4 of the ClientHello, as your proxy wrote it in `behaviour.tlsHeader` or as Cloudflare gives it to a Worker. `malformed` is true when a value arrived that is not a JA4; the door then reads nothing from it | The identity of a client: every copy of one browser version has the same JA4. The door does not see the handshake. When the proxy does not overwrite the header, the value is the client's own |
|
|
71
|
+
| `fingerprint.tls.negotiated`, `cipher`, `extensionsSha1`, `helloLength` | observed, through Cloudflare | In a Worker only: the negotiated TLS version and cipher, Cloudflare's hash of the extensions, and the length of the ClientHello | |
|
|
72
|
+
| `behaviour.timing.gaps`, `medianGapMs`, `minGapMs`, `maxGapMs` | checked | How many gaps the door remembers between the arrivals of this source (at most 16), and their median, their shortest, and their longest in milliseconds. A rule can read the shape: a program that sleeps a random time has gaps inside a band, and a person has long pauses. The source is the name of a verified agent, else the address (for IPv6, its /64) | The pace of one person. One address serves many people |
|
|
73
|
+
| `behaviour.navigation.pageLoaded` | observed | The source sent a GET for an HTML document in the last 30 minutes (`Sec-Fetch-Dest: document`, or without that header an `Accept` that names `text/html`) | That a browser showed the page, or that the same person sends this arrival |
|
|
74
|
+
| `behaviour.navigation.sincePageMs` | checked | Only when `pageLoaded` is true: the milliseconds from that page load to this arrival. On a write, it is the time that the source took to read and fill the page | That a short time is a program: a browser that restores a filled form sends fast. One address serves many people, so the page load can be another person's |
|
|
75
|
+
| `behaviour.navigation.subresources` | checked | Only when `pageLoaded` is true: how many GET requests that are not page loads the source sent after that page load and before this arrival, at most 17. A browser loads the scripts, styles, and images of a page; a program that fetches only the HTML has 0 | Anything when the assets do not go through the door: a site that serves them from a CDN or from another host has 0 for every person. A cached page has 0 too. A number for your policy, not a flag |
|
|
76
|
+
| `behaviour.navigation.origin` | observed | As `referer`, for the `Origin` header. `Origin: null`, which a browser sends when it hides the origin, is `cross-origin`. A `Referrer-Policy` does not remove the `Origin` of a write. The `Origin` itself is not recorded | Where the arrival came from. The client writes the `Origin` |
|
|
77
|
+
| `behaviour.navigation.referer` | observed | `same-origin` when the host of the `Referer` is the `Host` of the request (with `trustProxy`, the `X-Forwarded-Host`); a default port, `:443` or `:80`, on one side only does not change the result. Else `cross-origin`, or `absent`. The `Referer` itself is not recorded | Where the arrival came from. The client writes the `Referer` |
|
|
78
|
+
| `behaviour.navigation.site`, `mode`, `dest` | observed | `sec-fetch-site`, `sec-fetch-mode`, and `sec-fetch-dest` as sent, lowercase; `other` for a value that is not a token | That a browser sent them. A program can send the same values |
|
|
79
|
+
| `behaviour.form.report` and its counts (`fillMs`, `keys`, `pointers`, `pasted`, `trusted`, `moves`, `keySpreadMs`, `readyMs`) | a claim | The form protector script counted the events in the form and sent the counts in `X-Agent-Custody-Form`. `moves` is the count of pointer and touch moves over the form: a tool that types through the browser's debugging interface makes none. `keySpreadMs` is the longest gap between two key presses minus the shortest: a tool that types with a fixed delay has a small one. `readyMs` is the time from the start of the script to the first key press, pointer press, click, or paste. `claimed`: the report is well formed. `malformed`: a value arrived that is not exactly a report; the door then reads nothing from it and sets no flag. The script reads no field value and no key | What happened in a browser. Any client can send the header with any counts. The flags catch only a client that runs the script and does not act as a person does |
|
|
80
|
+
|
|
81
|
+
Limits of these signals:
|
|
82
|
+
|
|
83
|
+
- **The history is one process's memory.** The timing and navigation signals read what this door process remembers: at most 10,000 sources, 17 arrival times for each source, and 30 minutes. The history starts empty when the door starts, and two door processes do not share it. In a Worker, each isolate has its own. A client that sends from many new addresses can make the door forget another source early.
|
|
84
|
+
- **One address is one source.** People behind one address share a history: a page load by one of them is a page load for all, and their arrivals share one pace. A program behind the same address as a person gets that person's page load. The door does not add the `User-Agent` to the key: a client that changes its `User-Agent` would then look new on each arrival.
|
|
85
|
+
- **An IPv6 source is its /64.** One device uses many addresses of its /64, so the door keeps one history for the /64. `rate` still counts by the full address. A browser can load the page over IPv6 and send the form over IPv4. The door then sees two sources, and `pageLoaded` is false for that person; a same-origin `Referer`, `Origin`, or `Sec-Fetch-Site` keeps `directWrite` false.
|
|
86
|
+
- **The door must know that the client used https.** A browser sends `sec-fetch-*` and `sec-ch-ua` to an https site only. The door knows https from the URL of a Worker request, or from `X-Forwarded-Proto: https` with `trustProxy`. Without that, `fingerprint.headers.mismatch` reads `accept-language` only.
|
|
87
|
+
- **Authz mode records no header order.** The proxy selects the headers of a check, so `order` and `count` are absent and `fingerprint.headers.mismatch` is always false. The other signals need the proxy to forward `Referer`, `Origin`, `Accept`, `Sec-Fetch-*`, `Sec-CH-UA`, and `X-Agent-Custody-Form`.
|
|
88
|
+
- **A proxy in front of the door changes what the door receives.** It can reorder or drop headers. The order hash is then the proxy's order, and a dropped header is a mismatch for every browser.
|
|
89
|
+
- **The TLS fingerprint comes from your proxy or from Cloudflare.** `behaviour.tlsHeader` needs `trustProxy`, and your proxy must overwrite the header on every request. In a Worker the data comes from `request.cf`, and a config with `behaviour.tlsHeader` is refused. `ja4` needs Cloudflare Bot Management on the zone. Without it, `tls` has the Cloudflare fields only and `tls.mismatch` is always false.
|
|
90
|
+
- **The form report is a claim.** The script runs in the client's browser, and a program can send the header without the script. The door serves the script only when `challenge` is configured.
|
|
91
|
+
|
|
92
|
+
## Privacy
|
|
93
|
+
|
|
94
|
+
The signals are data about the device and the conduct of a person, so your privacy duties apply to them. The door does not decide whether you may collect them. That assessment is yours.
|
|
95
|
+
|
|
96
|
+
- **The form report runs in the visitor's browser.** With `behaviour` and `challenge` in the config, the form protector script listens for key, pointer, click, paste, and move events on the form. It keeps counts and times only: no field value, no key identity, and no pointer position. It sends them with the form. Reading events on the device of a visitor is in the scope of rules such as Article 5(3) of the ePrivacy Directive (see the EDPB Guidelines 2/2023 on its technical scope). Whether a security purpose covers it on your site is a question for you and your data protection officer.
|
|
97
|
+
- **A receipt with `behaviour` holds a device fingerprint beside the address.** `fingerprint` (the JA4, the header order hash, in a Worker the network) and `remote` are in the same arrival fact. Together they can identify a device, so treat such a receipt as personal data.
|
|
98
|
+
- **Facts are in clear by default.** The door's default capture rule keeps the arrival fact in clear. A `capture` rule for a route with `"facts": { "mode": "digest" }` or `"encrypted"` keeps the arrival fact out of the readable receipt for that route ([what the receipt records](door.md)). The rule withholds the whole fact, and `door error-rates` and `door labels` then skip those receipts.
|
|
99
|
+
- **The labelled export holds no address.** `agent-custody door labels` writes labels and flags only ([door error rates](door-error-rates.md#measure-on-your-own-door)).
|
|
100
|
+
|
|
37
101
|
## The partner verdict
|
|
38
102
|
|
|
39
103
|
A second fact, `partner`, is present only when a partner detection engine (Cloudflare Bot Management, HUMAN, DataDome, behind an adapter that holds an Ed25519 key) signed a verdict for this arrival. The policy reads it as `context.facts.partner`; the receipt records it with provenance `attested` and the engine's signature beside it.
|
|
@@ -90,6 +154,52 @@ when { context.facts.arrival.class == "verified" };
|
|
|
90
154
|
|
|
91
155
|
Decide what `unavailable` means for each route before the provider has its first outage: a forbid on `outcome != "passed"` closes the route then, and the receipts show that the provider, not the arrivals, was the reason.
|
|
92
156
|
|
|
157
|
+
The behaviour and fingerprint signals are reasons to ask for more, never reasons to decide what the arrival is. Each flag is wrong for some people ([door error rates](door-error-rates.md)), so a rule that reads a flag gives the arrival a way through: a challenge for a person, a grant for an agent. The next rule asks an arrival for the challenge when a write follows no page load. A verified agent and an arrival that passed the challenge go on:
|
|
158
|
+
|
|
159
|
+
```cedar
|
|
160
|
+
forbid(principal, action == Action::"refund", resource)
|
|
161
|
+
when {
|
|
162
|
+
context.facts.arrival.behaviour.navigation.directWrite &&
|
|
163
|
+
context.facts.arrival.class != "verified" &&
|
|
164
|
+
context.facts.arrival.challenge.outcome != "passed"
|
|
165
|
+
};
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The door answers a refused arrival with 403, the rule's id, and how to pass the challenge. This rule needs `challenge` in the config.
|
|
169
|
+
|
|
170
|
+
`fingerprint.tls` and `behaviour.form` are present only on some arrivals: `tls` when a TLS fingerprint arrived, `form` when the arrival sent a form report. Test for each with `has` before a rule reads it. A rule that reads an absent field is an error, and the door denies an arrival when a rule errors. So a rule without the test refuses every arrival that has no TLS fingerprint or no form report:
|
|
171
|
+
|
|
172
|
+
```cedar
|
|
173
|
+
forbid(principal, action, resource)
|
|
174
|
+
when {
|
|
175
|
+
(context.facts.arrival.fingerprint.headers.mismatch ||
|
|
176
|
+
(context.facts.arrival.fingerprint has tls && context.facts.arrival.fingerprint.tls.mismatch)) &&
|
|
177
|
+
context.facts.arrival.class != "verified" &&
|
|
178
|
+
context.facts.arrival.challenge.outcome != "passed"
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
forbid(principal, action == Action::"contact", resource)
|
|
182
|
+
when {
|
|
183
|
+
context.facts.arrival.behaviour has form &&
|
|
184
|
+
(context.facts.arrival.behaviour.form.fast || context.facts.arrival.behaviour.form.noInput) &&
|
|
185
|
+
context.facts.arrival.challenge.outcome != "passed"
|
|
186
|
+
};
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
An arrival with no form report passes the second rule. The report is a claim, so do not write a permit that depends on a report that looks like a person: a program can send one.
|
|
190
|
+
|
|
191
|
+
A steady pace on an API route is a reason to ask the program for a grant. A verified agent is counted by its name, and this rule lets it through:
|
|
192
|
+
|
|
193
|
+
```cedar
|
|
194
|
+
forbid(principal, action == Action::"api", resource)
|
|
195
|
+
when {
|
|
196
|
+
context.facts.arrival.behaviour.timing.regular &&
|
|
197
|
+
context.facts.arrival.class != "verified"
|
|
198
|
+
};
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
`fingerprint` and `behaviour` exist only when the config has `behaviour`. A policy that must also work on a door without it tests `context.facts.arrival has behaviour` first. Use observe mode to see what a new rule refuses before you enforce it: the receipts record each flag and each decision. Tutorial: [58-door-behaviour-signals.ts](../examples/58-door-behaviour-signals.ts).
|
|
202
|
+
|
|
93
203
|
A partner verdict is read through the `partner` fact, which exists only when the engine's signature verified. Test for it before reading it, so a missing verdict denies rather than errors:
|
|
94
204
|
|
|
95
205
|
```cedar
|
|
@@ -99,6 +209,6 @@ when { context.facts has partner && context.facts.partner.verdict == "human" };
|
|
|
99
209
|
|
|
100
210
|
With `onFailure: "absent"`, the arrival still reaches this rule when the engine is down or its signature is bad, and the rule denies it, because the fact is not there. A rule that does not mention `partner` admits it whatever the engine said, so set `partner.routes` to the routes whose rules read it, or keep the default `onFailure: "deny"`, which refuses the arrival before the policy's answer counts. No setting lets an engine outage become an allow on a route whose rule needs the verdict.
|
|
101
211
|
|
|
102
|
-
## What
|
|
212
|
+
## What no signal says
|
|
103
213
|
|
|
104
|
-
Nothing in the arrival fact says whether an arrival that presents nothing is a program. A Web Bot Auth signature identifies an agent that
|
|
214
|
+
Nothing in the arrival fact says whether an arrival that presents nothing is a program or a person. A Web Bot Auth signature identifies an agent that signs; it says nothing about the agents that do not. A partner engine's verdict is the judgement of that engine, signed, with the error rate of that engine. The behaviour and fingerprint signals of the door mark an arrival that does not look or act as its `User-Agent` states. Each flag is wrong for some people and misses some programs, and [door error rates](door-error-rates.md) gives the method and the measured rates. There is no `human` class and no `bot` class. A policy has the grant, the signature, the challenge, the claims, the address, the pace, and the flags, and the receipt records which of them the policy read.
|
package/docs/door-worker.md
CHANGED
|
@@ -18,6 +18,8 @@ It is the same code as the reverse proxy, the in-process door, and authz mode, w
|
|
|
18
18
|
| the arrival's address | the socket, or `X-Forwarded-For` with `trustProxy` | `CF-Connecting-IP`, which Cloudflare sets |
|
|
19
19
|
| Web Bot Auth nonces | one process's memory | a Durable Object per nonce, which every isolate reaches (the `NONCES` binding) |
|
|
20
20
|
| arrival rates | one process's memory | one isolate's memory |
|
|
21
|
+
| the history behind the timing and navigation signals | one process's memory | one isolate's memory |
|
|
22
|
+
| the TLS fingerprint | the header that `behaviour.tlsHeader` names, set by your proxy | `request.cf`, which Cloudflare sets; `behaviour.tlsHeader` is refused |
|
|
21
23
|
|
|
22
24
|
## What reaches the policy
|
|
23
25
|
|
|
@@ -25,6 +27,16 @@ Everything the Node door gives it: the arrival fact, the request's arguments, an
|
|
|
25
27
|
|
|
26
28
|
Where the zone has Cloudflare Bot Management, its score and verified-bot flag enter as a fact named `cloudflare`, labelled `observed`. They reach the policy as `context.facts.cloudflare.score` and `context.facts.cloudflare.verifiedBot`. Cloudflare does not sign them, unlike a partner engine's verdict, which enters `attested`. The fact is read only when `request.cf.botManagement` carries an integer score and a boolean flag, and is never required. A policy that reads it should test for it first: `context.facts has cloudflare && context.facts.cloudflare.score < 30`.
|
|
27
29
|
|
|
30
|
+
With `behaviour` in `DOOR_CONFIG` (an empty object is sufficient), the arrival fact has the door's [behaviour and fingerprint signals](door.md#behaviour-and-fingerprint-signals). In a Worker they differ from the Node door in four ways:
|
|
31
|
+
|
|
32
|
+
- `request.cf` also gives the HTTP version (`fingerprint.headers.http`) and the network of the address (`fingerprint.network.asn` and `organization`) on every zone. The Node door has neither.
|
|
33
|
+
- The TLS fingerprint comes from `request.cf`, never from a header. A config with `behaviour.tlsHeader` answers 500 with the reason and relays nothing. `fingerprint.tls` has `negotiated`, `cipher`, `extensionsSha1`, and `helloLength` from the fields that every zone gets. It has `ja4`, and the fields the door reads from it, only where the zone has Bot Management. Without a JA4, `fingerprint.tls.mismatch` is always false.
|
|
34
|
+
- The Worker cannot see the order of the headers, so `fingerprint.headers.order` is absent. `count` leaves out Cloudflare's own `cf-*` and `cdn-loop` headers.
|
|
35
|
+
- The Worker knows from the request URL whether the client used https. For an https request, `fingerprint.headers.mismatch` also reads `sec-fetch-*` and `sec-ch-ua`.
|
|
36
|
+
- The history behind the timing and navigation signals is one isolate's memory.
|
|
37
|
+
|
|
38
|
+
The signals are not verdicts: [door signals](door-signals.md#the-behaviour-and-fingerprint-signals) says what each flag does and does not mean, and [door error rates](door-error-rates.md) gives the method and the measured rates.
|
|
39
|
+
|
|
28
40
|
## When R2 or the log is unavailable
|
|
29
41
|
|
|
30
42
|
The rules are the door's own. A request that can change something (any method but `GET`, `HEAD`, and `OPTIONS`, and every route in `precommit`) reaches the origin only after its authorization is committed. That means appended to the log and stored in the bucket. If either fails, the request is answered 503 and not relayed.
|
|
@@ -42,6 +54,7 @@ There is no lock between isolates. Two flushes at once can each append the same
|
|
|
42
54
|
- **What the Node door does that the Worker does not:** authz mode for nginx and Envoy, a partner engine, OpenTelemetry and Splunk export, a local receipts directory, a local log file, `trustProxy`, and reloading the policy or the revocation list without a deploy.
|
|
43
55
|
- **Each Web Bot Auth signature costs a Durable Object request.** See [Web Bot Auth nonces](#web-bot-auth-nonces): one claim per verified signature that carries a nonce, and a wait of up to 3 seconds when the object is slow.
|
|
44
56
|
- **Arrival rates live in one isolate too.** A pace rule sees what one isolate counted.
|
|
57
|
+
- **The history behind the timing and navigation signals lives in one isolate too.** A page load that one isolate saw is unknown to another isolate, so a form post that follows it can be `behaviour.navigation.directWrite` there when it carries no same-origin `Referer`. `behaviour.timing` reads only the arrivals that one isolate saw.
|
|
45
58
|
|
|
46
59
|
## Web Bot Auth nonces
|
|
47
60
|
|
package/docs/door.md
CHANGED
|
@@ -39,7 +39,7 @@ To run it as a service, the gateway image has a `door` mode (`docker run ... ghc
|
|
|
39
39
|
|
|
40
40
|
Every field of the config, with its type and default, is in [the door reference](../../../site/reference/door.md#config).
|
|
41
41
|
|
|
42
|
-
`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 revocation file, 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.
|
|
42
|
+
`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 `behaviour` signals (with a warning that the proxy must overwrite `behaviour.tlsHeader`), the revocation file, 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.
|
|
43
43
|
|
|
44
44
|
## What the door knows about an arrival
|
|
45
45
|
|
|
@@ -57,9 +57,11 @@ The door records one fact for every arrival, `arrival`, observed by the door its
|
|
|
57
57
|
| `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 |
|
|
58
58
|
| `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) |
|
|
59
59
|
| `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 |
|
|
60
|
+
| `fingerprint` | `{ headers, tls? }` | only when `behaviour` is configured. What the request and its connection look like: what the `User-Agent` states, a hash of the header order, and the TLS fingerprint when the door has one. See [behaviour and fingerprint signals](#behaviour-and-fingerprint-signals) |
|
|
61
|
+
| `behaviour` | `{ timing, navigation, form? }` | only when `behaviour` is configured. How the source acts over time: its pace, whether a page load came before a write, and the form report when the arrival sent one. Signals, not a verdict |
|
|
60
62
|
| `method`, `path`, `route` | strings | what arrived, and the route it fell under |
|
|
61
63
|
|
|
62
|
-
[Door signals](door-signals.md) says, for each field, what it establishes and what it does not, and how a policy should read it.
|
|
64
|
+
[Door signals](door-signals.md) says, for each field, what it establishes and what it does not, and how a policy should read it. [Door error rates](door-error-rates.md) measures how often `class` is wrong for each kind of arrival, with the method, and scores your own receipts against your labels with `agent-custody door error-rates`.
|
|
63
65
|
|
|
64
66
|
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.
|
|
65
67
|
|
|
@@ -354,6 +356,28 @@ A site that already pays for bot detection (Cloudflare Bot Management, HUMAN, Da
|
|
|
354
356
|
|
|
355
357
|
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).
|
|
356
358
|
|
|
359
|
+
## Behaviour and fingerprint signals
|
|
360
|
+
|
|
361
|
+
The door can add its own signals to the arrival fact: what the request looks like, and how its source acts over time. They are off until the config has a `behaviour` object:
|
|
362
|
+
|
|
363
|
+
```json
|
|
364
|
+
"trustProxy": true,
|
|
365
|
+
"behaviour": { "tlsHeader": "x-ja4" }
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
An empty object, `"behaviour": {}`, is sufficient. Without `behaviour`, the arrival fact is unchanged, and the door reads no TLS header and no form report.
|
|
369
|
+
|
|
370
|
+
- **What the door adds.** `arrival.fingerprint` has `headers` (what the `User-Agent` states, a hash of the header names in the order received, their count) and, when the door has a TLS fingerprint, `tls`. `arrival.behaviour` has `timing` (the pace of the source), `navigation` (whether the source loaded a page before it writes), and, when the arrival sent a form report, `form`. Each value is a string, an integer, or a boolean. The exact fields are in [the reference](../../../site/reference/door.md#the-arrival-fact).
|
|
371
|
+
- **The flags.** Nine booleans mark an arrival: `fingerprint.headers.mismatch`, `fingerprint.headers.hintsMismatch`, `fingerprint.headers.fetchInvalid`, `fingerprint.tls.mismatch`, `fingerprint.tls.knownTool`, `behaviour.timing.regular`, `behaviour.navigation.directWrite`, `behaviour.form.fast`, and `behaviour.form.noInput`. [Door signals](door-signals.md#the-behaviour-and-fingerprint-signals) says what each flag establishes and who gets flagged wrongly. [Door error rates](door-error-rates.md) gives the method and the measured rates.
|
|
372
|
+
- **The door refuses nothing because of a signal.** Only your policy reads the signals. A rule tests `context.facts.arrival.fingerprint has tls` and `context.facts.arrival.behaviour has form` before it reads those groups, because a rule that reads an absent group is an error and the door then denies the arrival. Treat a flag as a reason to ask for a challenge or a grant: [reading them in a policy](door-signals.md#reading-them-in-a-policy).
|
|
373
|
+
- **`tlsHeader`.** The door does not see the TLS handshake. Your proxy does. `tlsHeader` names the request header in which the proxy puts the JA4 fingerprint of the client. It needs `trustProxy: true`; without that the config does not load. The proxy must overwrite the header on every request. If the proxy passes the header through, a client can send its own fingerprint. If the proxy appends to the header, the door records the value as malformed. Without `tlsHeader` the arrival fact has no `fingerprint.tls`.
|
|
374
|
+
- **https.** A browser sends `sec-fetch-*` and `sec-ch-ua` to an https site only. The door serves plain HTTP, so it knows that the client used https only from `X-Forwarded-Proto: https` with `trustProxy`. Without that, `fingerprint.headers.mismatch` reads `accept-language` only.
|
|
375
|
+
- **A proxy in front of the door.** The door records the headers that it received. A proxy that reorders headers changes `fingerprint.headers.order`, and a proxy that drops `accept-language`, `sec-fetch-*`, or `sec-ch-ua` makes every browser a mismatch.
|
|
376
|
+
- **The history.** The timing and navigation signals read the history of the source: a verified agent by its name, else the address, as `rate` does. The history is one process's memory: at most 10,000 sources, 17 arrival times for each source, and 30 minutes. It starts empty when the door starts, and two door processes do not share it.
|
|
377
|
+
- **The form report.** With `challenge` and `behaviour` configured, the [form protector](#protecting-a-form-with-one-line) script also counts key presses, pointer presses, clicks, and pastes in each form, and sends the counts in `X-Agent-Custody-Form`. The script reads no field value and no key. The door removes the header before it relays the request. The report is a claim by the script in the client's browser: a program can send any report.
|
|
378
|
+
|
|
379
|
+
`agent-custody door labels` exports a labelled set from the receipts of your own door, and `agent-custody door measure` replays a labelled set through the same signal functions and prints how often each flag is wrong ([door error rates](door-error-rates.md)). Tutorial: [60-door-behaviour-signals.ts](../examples/60-door-behaviour-signals.ts).
|
|
380
|
+
|
|
357
381
|
## How an arrival becomes a Cedar request
|
|
358
382
|
|
|
359
383
|
| Cedar slot | value |
|
|
@@ -435,6 +459,7 @@ A site that already runs nginx or Envoy need not send its traffic through the do
|
|
|
435
459
|
```
|
|
436
460
|
|
|
437
461
|
- **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.
|
|
462
|
+
- **The behaviour signals.** With `behaviour` in the config, the door reads the signals from the check. The proxy selects the headers of a check, so the door records no header order and no header count, and `fingerprint.headers.mismatch` is always false. For the other signals the proxy must forward `Referer`, `Origin`, `Accept`, `Sec-Fetch-Site`, `Sec-Fetch-Mode`, `Sec-Fetch-Dest`, `Sec-Fetch-User`, `Sec-CH-UA`, `X-Agent-Custody-Form`, and the header that `behaviour.tlsHeader` names. The proxy must set the `tlsHeader` itself and replace any copy from the client. The door relays nothing in authz mode, so the proxy also passes `X-Agent-Custody-Form` to the origin unless you remove it there.
|
|
438
463
|
- **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.
|
|
439
464
|
- **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.
|
|
440
465
|
|
|
@@ -451,11 +476,13 @@ A site that already runs nginx or Envoy need not send its traffic through the do
|
|
|
451
476
|
- 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.
|
|
452
477
|
- 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.
|
|
453
478
|
- 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`.
|
|
454
|
-
- 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.
|
|
479
|
+
- 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. For `behaviour`, the stock config has `referer`, `sec-fetch-site`, `sec-fetch-mode`, `sec-fetch-dest`, and `x-agent-custody-form` in that list. It does not have the `behaviour.tlsHeader`: add the header that you named, and make Envoy set it.
|
|
455
480
|
|
|
456
481
|
## What it does not do yet
|
|
457
482
|
|
|
458
|
-
- 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
|
|
483
|
+
- 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, `rate` is a pace, and the [behaviour and fingerprint signals](#behaviour-and-fingerprint-signals) are flags that are wrong for some arrivals ([door signals](door-signals.md), [door error rates](door-error-rates.md)). No signal is a verdict.
|
|
484
|
+
- Share the history behind the timing and navigation signals between door processes, or keep it across a restart.
|
|
485
|
+
- Know the TLS fingerprint of every tool. The table behind `fingerprint.tls.knownTool` holds six fingerprints, recorded from one build each of curl, Python, Go, Node, and Bun on one machine. Another build or another tool is not in it, and the flag has no measured rate ([door error rates](door-error-rates.md)).
|
|
459
486
|
- 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.
|
|
460
487
|
- Check AP2 mandates.
|
|
461
488
|
- 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 (the Worker keeps them in a Durable Object that every isolate reaches: [the door as a Cloudflare Worker](door-worker.md#web-bot-auth-nonces)). A signature agent must be listed in `agents`; the door does not fetch the directory of an origin it was not told about.
|
|
@@ -464,4 +491,4 @@ A site that already runs nginx or Envoy need not send its traffic through the do
|
|
|
464
491
|
- 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.
|
|
465
492
|
- 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.
|
|
466
493
|
|
|
467
|
-
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; [56-door-worker.ts](../examples/56-door-worker.ts), the door as a Cloudflare Worker, in workerd.
|
|
494
|
+
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; [56-door-worker.ts](../examples/56-door-worker.ts), the door as a Cloudflare Worker, in workerd; [58-door-error-rates.ts](../examples/58-door-error-rates.ts), the error rates; [60-door-behaviour-signals.ts](../examples/60-door-behaviour-signals.ts), the behaviour and fingerprint signals.
|
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.12
|
|
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.12` |
|
|
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/tutorials.md
CHANGED
|
@@ -66,6 +66,10 @@ Suggested reading order is the numbering. Output lands in `examples-out/`, which
|
|
|
66
66
|
| 55 | a grant that names its agent by a did:key, checked at the door | [55-did-key-grant.ts](../examples/55-did-key-grant.ts) | an agent's Ed25519 key and its did:key; a principal's grant for the did:key is verified at the door; a garbled did:key, and a grant whose agentKey is another key, are claimed; nothing presented is unknown; every receipt verifies |
|
|
67
67
|
| 56 | the door as a Cloudflare Worker | [56-door-worker.ts](../examples/56-door-worker.ts) | the Worker built as `wrangler deploy` builds it and run in workerd (Miniflare): the key a secret binding, the policy and config variables, receipts to an R2 bucket and a local log over HTTP; an order with no grant refused before the origin, an order under a grant committed to the log first and relayed; both receipts verified with the Worker's public key and the log's |
|
|
68
68
|
| 57 | human in the loop: the gateway asks, a person signs from the command line, the agent retries | [57-approval-requests.ts](../examples/57-approval-requests.ts) | a refund that needs approval arrives with none and is refused, leaving a request; `agent-custody approvals list` and `show` give the approver the exact arguments, `approve` signs them with their key; the same call again is forwarded once and its receipt verifies with the approver's key; a third send, and the same refund for one penny more, are each refused and wait for a person again |
|
|
69
|
+
| 58 | published error rates for the door's signals | [58-door-error-rates.ts](../examples/58-door-error-rates.ts) | twelve kinds of arrival built to a known label (a browser, two scripts, two genuine agents, seven impostors) decided by the door core; every receipt verified and each kind scored on its own with a 95% interval: `verified` goes to the genuine agents only, and a script that presents nothing is `unknown` like the browser; an operator's label is its own row, and a receipt edited to say `verified` is skipped and moves nothing |
|
|
70
|
+
| 59 | Demo 1, the refund (API leg): the door and the gateway together | [59-refund-demo.ts](../examples/59-refund-demo.ts) | a shop with the door in front of its refund API and two payment lanes through the gateway; a shopping agent with a passport is paid £25 once, even on retry; £80, and a forged passport, are refused at the door and never reach the shop; an agent with no passport goes to a person, who approves the exact refund with `agent-custody approvals approve`, and is then paid once; an auditor with public keys and a read-only view of Stripe verifies all ten receipts and finds the £10 refund made in Stripe directly; `bun run demo:refund` |
|
|
71
|
+
| 60 | the door's behaviour and fingerprint signals, read by a policy as reasons to ask for a challenge | [60-door-behaviour-signals.ts](../examples/60-door-behaviour-signals.ts) | a door with `behaviour` and a challenge in front of a contact form; a browser's page load and form post carry no flag and pass; a tool's direct post is `directWrite`, and a script that states a browser has four flags, and each is refused with the rule's id and how to pass the challenge; a person whose address changed, and whose form page is on another host of the site, is flagged too, and passes with a challenge token; the site never receives the form report header; every receipt verified, with its flags |
|
|
72
|
+
| 61 | the false-positive rate of each door flag, measured on a labelled set | [61-door-measure.ts](../examples/61-door-measure.ts) | the labelled set recorded from real clients is replayed through the door's signal functions; each flag's false-positive rate and detection rate are printed per session and per arrival with the 95% interval; no real browser is flagged, and the interval is still wide because the set is small |
|
|
69
73
|
|
|
70
74
|
## How policies are defined, in one paragraph
|
|
71
75
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-custody/receipts",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.12",
|
|
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",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"test": "vitest run",
|
|
71
71
|
"coverage": "vitest run --coverage.enabled",
|
|
72
72
|
"demo": "tsx scripts/demo.ts",
|
|
73
|
+
"demo:refund": "node examples/59-refund-demo.ts",
|
|
73
74
|
"vectors": "tsx scripts/vectors.ts",
|
|
74
75
|
"bench": "node scripts/hot-path-bench.ts"
|
|
75
76
|
},
|