docs: claims WB-remote-1 to 10 and WB-assist-5, the remote door in the interface, parity
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
c9b6614688
commit
0a91656f14
4 files changed
+404
-3
No files matched your search
@@ -477,6 +477,70 @@ didn't open, with why). Protocol version 1: the requests are new, the
|
||||
that ended is not listed; nothing is kept across a server restart.
|
||||
`wanderbooks doctor` prints these lines under "Assistants connected".
|
||||
|
||||
### The remote door (plan/p15-app-and-relay.md section 4, unit B1; WB-remote-1 to 10)
|
||||
|
||||
Web assistants (Claude and ChatGPT on the web; Gemini, Grok and muse.ai best
|
||||
effort) call connectors from their vendor's cloud over HTTPS. The books server
|
||||
has a second HTTP listener for them, on **127.0.0.1 only and off until the app
|
||||
asks** (the relay, unit B2, and the app's line to it with its certificate, unit
|
||||
B3, put it on the internet). The admin socket's requests (owner only) are its
|
||||
whole control:
|
||||
|
||||
- `remote_start { public_url, port? }` turns it on as the **one public address**
|
||||
(`https://name`, no path: the issuer), on a free loopback port unless one is
|
||||
given, and answers where it listens; the same address again is a no-op, another
|
||||
restarts it. `remote_stop` turns it off (it also stops when the server closes).
|
||||
`remote_allow { book, allowed }` offers a company or withdraws it;
|
||||
`remote_status` says all of it.
|
||||
- `remote_pending` lists the assistants waiting to be allowed (the product by
|
||||
where it is sent back to, that address, the caller's address, the company,
|
||||
whether posting was asked, the time left); `remote_decide { id, approve, post }`
|
||||
is the person's answer. `remote_approvals { book? }` lists the connections
|
||||
allowed; `remote_set_post { approval, post }` raises or lowers one;
|
||||
`remote_make_key { book, name, post }` makes a key for a product that takes only
|
||||
a key, and `remote_make_client { name, redirect_uris }` a client id and secret
|
||||
to type into one: each secret is shown once, in the answer, never again.
|
||||
|
||||
**Every connection begins with the relay's PROXY protocol version 2 header**
|
||||
(the exact form `crates/relay` writes: TCP over IPv4 or IPv6, no extensions); the
|
||||
address in it is the caller's, and is what the access record (`from`) and the
|
||||
limits use. Anything else is dropped before a byte of HTTP is read; no
|
||||
`X-Forwarded-For` is ever read. A request whose `Host` is not the public
|
||||
address's host is 421; one with another `Origin` is 403.
|
||||
|
||||
Routes (all for the public address only):
|
||||
|
||||
| Route | What |
|
||||
|---|---|
|
||||
| `/.well-known/oauth-protected-resource` (root, `…/b/{book}/mcp` appended, or `/b/{book}/mcp/…` before it) | RFC 9728 metadata for a company's address (the root's only while one company is offered) |
|
||||
| `/.well-known/oauth-authorization-server`, `/.well-known/openid-configuration` (and the same with a path either side) | RFC 8414 metadata; every address in it is the issuer's |
|
||||
| `POST /register` | dynamic registration (RFC 7591): 1 to 20 redirect addresses, 201 |
|
||||
| `GET /authorize` | parks the request (never approves) and answers a page that says to look at Wanderbooks; 302 straight back only for a product the person already allowed for that company |
|
||||
| `GET /authorize/wait/{id}` | the page's own look: the same page while waiting, then a 302 with `code` (or `error=access_denied`), once |
|
||||
| `POST /token` | `authorization_code` (PKCE S256, `resource` checked) and `refresh_token` (rotated; one used twice ends its family); a client secret as Basic or in the body |
|
||||
| `/b/{book}/mcp` | the company's MCP, stateless, plain JSON, for a good token only: 401 with `WWW-Authenticate: Bearer resource_metadata="…"` otherwise, `initialize` included |
|
||||
|
||||
A client is one of: a client ID metadata document (an https `client_id`, fetched
|
||||
only when every address of its host is public, no redirect, at most 64 KiB, five
|
||||
seconds); a dynamic registration; or a client id and secret the app made. The
|
||||
redirect address must equal a registered one exactly. Access tokens last ten
|
||||
minutes and are kept in memory; refresh tokens last sixty days since last use and
|
||||
are kept (hashed) in `auth/remote.json`, 0600, so a refresh after the app was
|
||||
closed for days still works. Nothing is kept as text but a hash.
|
||||
|
||||
**An approval** is the owner's decision about a product, a company and its
|
||||
permissions: one token of the books' principals (named `web-…`, listed by
|
||||
`token_list` and revoked by id like any, which ends every token and refresh token
|
||||
made under it) plus a record naming the product, so a product that registers
|
||||
again is not asked again. A web approval grants `books:read` and `books:write`
|
||||
(drafts); `books:post` only when the person turns it on; `books:admin` never. A
|
||||
stranger's unsigned request is a 401 and is counted, not written to the access
|
||||
record; a good token's refusal is recorded with the caller's address. Calls go
|
||||
through the same server as local ones (`call_tool`): a write needs its
|
||||
`request_key`, a repeat returns the first answer. Nothing bans an address; what
|
||||
a request creates is bounded (2000 clients, 20 waiting requests, 5 per address,
|
||||
600 calls a minute per approval, and so on).
|
||||
|
||||
## Server instructions
|
||||
|
||||
The MCP `initialize` response carries an `instructions` string, the
|
||||
@@ -518,6 +582,16 @@ overrides and zero-width spaces are dropped), cut to 56 characters.
|
||||
`instructions_budget` (the longest rule, every parties setting) and
|
||||
`the_company_name_is_one_plain_line` check it.
|
||||
|
||||
Some products keep only the first 512 characters of the instructions
|
||||
(ChatGPT) and one is reported to drop them (claude.ai, unverified since), so
|
||||
**the company and the entry point also begin the description of the tools a
|
||||
model reaches for first** (`books.start`, `books.handbook`, `books.chart`,
|
||||
`books.show`, `books.digest`, `books.search_entries`, `books.draft_entry`,
|
||||
`books.post_entry`): "For the books of Acme: call books.start first in every
|
||||
session." (at most 160 characters, added by `list_tools` to the tool's own text
|
||||
of at most 700), for local and remote callers alike.
|
||||
`the_company_and_the_entry_point_are_in_the_first_tools_too` pins both.
|
||||
|
||||
The long guidance is the **handbook**, compiled in from
|
||||
`ledger-mcp/handbook/*.md`, with the receipt rule in force rendered in:
|
||||
|
||||
|
||||
+15
-1
@@ -255,9 +255,23 @@ Three new rows, none above changed status, and the floor stands.
|
||||
|---|---|---|---|
|
||||
| Books home: a visible folder per book, `<Documents>/Wanderbooks/<id>`, holding `AGENTS.md`, `CLAUDE.md`, `.mcp.json` and `.claude/settings.json` and nothing of the books | A QBO/Xero company has no counterpart; the point is the agent's workplace (D-27) | partial | `books_home_holds_no_books_data`, `a_books_home_made_again_keeps_what_a_person_kept` (`crates/ledger-host/tests/books_home.rs`); `partial` until the macOS home is tried |
|
||||
| Agent dock: Claude Code or Codex in a terminal along the bottom of the viewer, started in the books home; never required | QBO's assistant panel is a cross-check only | partial | `dock_runs_the_chosen_agent`, `agent_missing_offers_the_installer` (`crates/ledger-gui/tests/dock.rs`); Linux checked; macOS by the CI run; Windows not offered (ConPTY unchecked) |
|
||||
| Assistants in the window: each company's state (none, connected, working) as a shape and a word, "Ask your assistant" where a button that edits would be, the Connect page (a row per local tool, the keys with who is on each, Revoke), and a warning before closing the window or a tab with an assistant connected (plan P15 3.3, D-79) | QBO's "Accountant" invitations and Xero's "Advisor" access are a cross-check only | partial | WB-assist-1 to WB-assist-4; `crates/ledger-gui/tests/assistants.rs`; local assistants only: the web half is plan units B1 and B3, the Claude desktop extension C1 |
|
||||
| Assistants in the window: each company's state (none, connected, working) as a shape and a word, "Ask your assistant" where a button that edits would be, the Connect page (a row per local tool, the keys with who is on each, Revoke), and a warning before closing the window or a tab with an assistant connected (plan P15 3.3, D-79) | QBO's "Accountant" invitations and Xero's "Advisor" access are a cross-check only | partial | WB-assist-1 to WB-assist-4; `crates/ledger-gui/tests/assistants.rs`; local assistants, and (unit B1) the question to the person when a web assistant asks and what each web connection may do; the web switch, address and steps are unit B3's, the Claude desktop extension C1 |
|
||||
| First run with no terminal: the viewer sets up the private folder, the owner passphrase, the first books and an agent | QBO's "set up your company" flow | partial | `first_run_onboards_with_no_terminal` (`crates/ledger-gui/tests/welcome.rs`); the AppImage's whole path is the EM's to try on a clean machine |
|
||||
|
||||
## P15 B1: the remote door (2026-11-21, D-83, D-86)
|
||||
|
||||
One new row below; none above changed status, so the floor stands. A second
|
||||
HTTP door in the books server, on 127.0.0.1 and off until the app asks, is the
|
||||
sign-in server web assistants knock on (WB-remote-1 to WB-remote-10,
|
||||
`docs/mcp-interface.md` "The remote door"); the window asks the person when a
|
||||
web assistant wants to connect. It is `partial`: the door is not on the
|
||||
internet until the relay's client and certificates (unit B3) exist, and no
|
||||
product's own sign-in has been tried against it yet.
|
||||
|
||||
| Area | Counterpart (a cross-check, not the spec) | Status | Notes |
|
||||
|---|---|---|---|
|
||||
| Web assistants reach a company over HTTPS and sign in with OAuth 2.1, approved by the person in the app's window; read and draft by default, posting per connection | QBO's and Xero's "connected apps" consent screens are a cross-check only | partial | WB-remote-1 to WB-remote-10, WB-assist-5; `ledger-mcp` unit tests in `src/local/remote/` (`tests.rs`, `proxy.rs`, `cimd.rs`, `pages.rs`), `ledger-gui` `tests/assistants.rs`; open: reached through the relay (B3), tried with Claude and ChatGPT on the web, uploads and downloads over this door |
|
||||
|
||||
## P15 T1: every write is one transaction, exactly once (2026-11-21, D-88, D-89)
|
||||
|
||||
| Area | Counterpart (a cross-check, not the spec) | Status | Notes |
|
||||
|
||||
@@ -88,11 +88,41 @@ when it connected and last acted, and "Revoke", asked once, which calls what
|
||||
`wanderbooks token revoke` calls (the server ends the key and the sessions on
|
||||
it; its copy in the token file is removed). The window writes no books. The
|
||||
web half of the page (the switch, the address, the steps for Claude and
|
||||
ChatGPT) is plan unit B3's; `connect::State::web_section` is its place, and
|
||||
the "Claude desktop app" row (a one-click extension) is unit C1's.
|
||||
ChatGPT) is plan unit B3's, and the "Claude desktop app" row (a one-click
|
||||
extension) is unit C1's. What unit B1 puts in `connect::State::web_section` is
|
||||
the question to the person when a web assistant asks to connect (WB-remote-5):
|
||||
a card that says who is asking, where it is sent back to, the address it asked
|
||||
from and what it will be able to do (read and draft; posting only if ticked),
|
||||
with "Allow" and "Don't allow", over any page of the company
|
||||
(`connect::State::web_prompt`) and on the Connect page; and, for each web
|
||||
connection allowed, what it may do, with "Let it post entries" and "Stop
|
||||
letting it post". Revoke is the same row of "Who can reach these books".
|
||||
*Enforced:* `ledger_gui::connect::State::show`, `ledger_host::commands`
|
||||
(`bridge_serve_args`, `command_line`, `ensure_key`, `forget_token_file`),
|
||||
`ledger_host::app_server::AppServer::revoke_token`.
|
||||
*Checked:* `ledger-gui` `tests/assistants.rs`
|
||||
(`the_top_bar_state_opens_the_connect_page_which_lists_and_revokes`,
|
||||
`the_connect_buttons_do_what_connect_does`).
|
||||
|
||||
**WB-assist-5** The company's name and "call books.start first" stand in the first tools' own descriptions too.
|
||||
|
||||
```text
|
||||
GOAL: a product that keeps only the first 512 characters of the server's
|
||||
instructions, or drops them, still tells its model which company this is
|
||||
and where to begin.
|
||||
SOURCE: plan/p15-app-and-relay.md 3.4 (ChatGPT uses only the first 512
|
||||
characters; claude.ai is reported to drop them, unverified since).
|
||||
INVARIANTS:
|
||||
1. The first 512 characters of the instructions stand alone and name the
|
||||
company, books.start and books.handbook.
|
||||
2. The descriptions of books.start and of the tools a model reaches for
|
||||
first begin with the company and "call books.start first in every
|
||||
session", for local and remote callers alike; the lead is at most 160
|
||||
characters.
|
||||
SCENARIOS:
|
||||
1. A list of tools names the company in each of the first tools and in
|
||||
no other.
|
||||
```
|
||||
|
||||
*Enforced:* `first_tools_lead`, `connect_text`, `list_tools` (the server's `BooksServer`).
|
||||
*Checked:* `ledger-mcp` unit test `the_company_and_the_entry_point_are_in_the_first_tools_too`.
|
||||
@@ -0,0 +1,283 @@
|
||||
# Claims: the remote door
|
||||
|
||||
The product rules of how web assistants (Claude and ChatGPT on the web; Gemini,
|
||||
Grok and muse.ai best effort) reach a company, and the sign-in behind it (plan
|
||||
P15, unit B1; decisions D-81, D-83, D-86, D-88 in `plan/p15-app-and-relay.md`;
|
||||
the ten sign-in rules of its section 4). No authority outside this product
|
||||
states them: they are wanderbooks' own (`WB-remote-<n>`). They stand on public
|
||||
specifications for the protocol (OAuth 2.1, RFC 7636, 7591, 8414, 8707, 9728 and
|
||||
9700, the MCP authorization specification) and on nothing else. The code is the
|
||||
`remote` module of the books server (`crates/ledger-mcp/src/local/remote/`).
|
||||
|
||||
The door listens on 127.0.0.1 only, off until the app asks. The relay (unit B2)
|
||||
and the app's line to it with its certificate (unit B3) put it on the internet;
|
||||
the relay writes the caller's address in a PROXY header before the caller's own
|
||||
bytes (WB-relay-6), and this door reads it.
|
||||
|
||||
Rules: none from bookspec.
|
||||
|
||||
---
|
||||
|
||||
## Product rules
|
||||
|
||||
**WB-remote-1** The door is off until asked, is loopback only, and knows each caller's address only from the relay's header.
|
||||
|
||||
```text
|
||||
GOAL: nothing reaches the books from the internet unless the app turned the
|
||||
door on, and the address of a caller is the one place no caller can
|
||||
write.
|
||||
SOURCE: WB-relay-6 (the caller's address), D-80, D-83 in
|
||||
plan/p15-app-and-relay.md; the PROXY protocol specification version 2;
|
||||
plan/p15-app-and-relay.md section 4, rule 8.
|
||||
INVARIANTS:
|
||||
1. The door listens only after a RemoteStart admin request, on 127.0.0.1;
|
||||
it stops on RemoteStop and when the server closes. It serves a company
|
||||
only while that company is offered (RemoteAllow) and open.
|
||||
2. Every connection begins with the relay's exact header (a version 2
|
||||
PROXY header for TCP over IPv4 or IPv6); anything else, a cut header,
|
||||
or silence for five seconds is dropped before a byte of HTTP is read.
|
||||
3. The address in the header is what the access record and the limits use;
|
||||
no HTTP header (X-Forwarded-For and its kind) is read for it; a second
|
||||
header sent inside the caller's own bytes is HTTP text, refused as such.
|
||||
4. Connections are bounded, and a request's headers must arrive in time.
|
||||
SCENARIOS:
|
||||
1. A call through the door is recorded with the address in the header, not
|
||||
with the one a caller's forwarding headers claim.
|
||||
2. A connection with no header, or with a header inside a request, gets
|
||||
nothing.
|
||||
3. The door is off before it is asked, and refuses connections after it is
|
||||
stopped.
|
||||
```
|
||||
|
||||
*Enforced:* `read_header`, `accept_loop`, `start_door`, `stop_door`, `Asked` (the server's `local` module).
|
||||
*Checked:* `ledger-mcp` unit tests `the_relays_header_reads_back_its_source`, `anything_but_the_exact_form_is_refused`, `the_recorded_address_is_the_relays_and_a_forged_one_changes_nothing`, `the_door_is_off_until_asked_and_stops_when_told`.
|
||||
|
||||
**WB-remote-2** There is one public address, and every address the door says is built from it.
|
||||
|
||||
```text
|
||||
GOAL: a product that learns where to sign in is never told another place,
|
||||
whatever it sends in its request.
|
||||
SOURCE: RFC 9728 and RFC 8414 (the metadata documents and where they are
|
||||
found); plan/p15-app-and-relay.md section 4, rule 1 (a year of
|
||||
breakage in another project came of building these from the request).
|
||||
INVARIANTS:
|
||||
1. The issuer is the address given to RemoteStart (https, a host, no path)
|
||||
and no other; a request for another Host is refused (421).
|
||||
2. The protected-resource document is served at the root, after the
|
||||
well-known name with the resource's path appended, and before it; the
|
||||
authorization server's at its two well-known names, with a path
|
||||
appended or prepended too. Every address in them is the issuer's.
|
||||
3. A token, code or refresh token made under one issuer is refused under
|
||||
another.
|
||||
SCENARIOS:
|
||||
1. Every place a product looks answers the same document.
|
||||
2. The public address changes: what was made under the old one stops.
|
||||
```
|
||||
|
||||
*Enforced:* `start_door`, `server_document`, `resource_document`, `Remote::authenticate`.
|
||||
*Checked:* `ledger-mcp` unit tests `the_metadata_is_the_pinned_address_at_every_place_products_look`, `an_expired_token_and_a_token_for_another_issuer_are_refused`.
|
||||
|
||||
**WB-remote-3** An unsigned request is a 401 that says where to sign in, `initialize` included, and is never written to the books' record.
|
||||
|
||||
```text
|
||||
GOAL: a product that was told nothing finds the sign-in; a stranger cannot
|
||||
fill the disk by knocking.
|
||||
SOURCE: RFC 6750 (the challenge), RFC 9728; plan/p15-app-and-relay.md section
|
||||
4, rule 4 (one product shows "connected" and never signs in when its
|
||||
first request is let through).
|
||||
INVARIANTS:
|
||||
1. A request to a company's path with no token, a wrong one or an expired
|
||||
one is a 401 whose WWW-Authenticate names that company's
|
||||
protected-resource metadata; a presented bad token adds
|
||||
error="invalid_token". `initialize` is no exception.
|
||||
2. A key made for the local socket opens nothing on this door.
|
||||
3. Such a request is counted in memory and not written to the access record
|
||||
(a request with a good token that is refused is).
|
||||
SCENARIOS:
|
||||
1. initialize, a tool call and a notification, unsigned, are each 401.
|
||||
2. Twenty more unsigned requests leave the access record where it was.
|
||||
```
|
||||
|
||||
*Enforced:* `unauthorized`, `Remote::authenticate`, `door` (the server's `local` module).
|
||||
*Checked:* `ledger-mcp` unit test `an_unsigned_request_is_a_401_that_says_where_to_sign_in_initialize_included`.
|
||||
|
||||
**WB-remote-4** A client introduces itself in one of three ways, and is sent back only to an address it registered.
|
||||
|
||||
```text
|
||||
GOAL: any of the products can sign in, and none can be sent to an address a
|
||||
stranger chose.
|
||||
SOURCE: RFC 7591 (dynamic registration), the IETF draft for OAuth client ID
|
||||
metadata documents, RFC 6749 section 10.15 (open redirectors), RFC
|
||||
7636 (PKCE), RFC 8707 (resource); plan/p15-app-and-relay.md section 4,
|
||||
rules 2 and 3.
|
||||
INVARIANTS:
|
||||
1. A client is a client ID metadata document (an https address, fetched
|
||||
only if every address its host has is public, with no redirect, at most
|
||||
64 KiB, within five seconds, its client_id the address it came from),
|
||||
a dynamic registration, or a client id and secret the app made.
|
||||
2. A redirect address is https, a loopback http address, or an app's own
|
||||
scheme, with no fragment or userinfo; a client may carry up to twenty;
|
||||
the one asked for must equal one registered exactly. A mismatch is a
|
||||
page, never a redirect.
|
||||
3. PKCE with S256 is required, and its verifier is checked in constant
|
||||
time; `resource` must be one company's address under the issuer (or
|
||||
absent where one company is on offer); a code is single-use, lives
|
||||
sixty seconds, and ends what it made if used twice; the consent is a
|
||||
302.
|
||||
4. A secret (a client's, a code, a token) is kept as its SHA-256 only.
|
||||
SCENARIOS:
|
||||
1. Each of the three kinds signs in end to end and reads the books.
|
||||
2. Wrong redirect, no PKCE, the plain method, a wrong resource, a wrong
|
||||
verifier and a reused code are each refused.
|
||||
```
|
||||
|
||||
*Enforced:* `Remote::register`, `Remote::resolve_client`, `Remote::authorize`, `Remote::token`, `parse` (client documents), `is_public`, `valid_redirect`.
|
||||
*Checked:* `ledger-mcp` unit tests `a_registered_client_signs_in_and_reads_the_books`, `a_client_metadata_document_signs_in`, `a_typed_client_id_and_secret_signs_in`, `a_redirect_that_is_not_registered_is_never_redirected_to`, `pkce_the_resource_and_the_verifier_are_required`, `only_public_addresses_are_fetched`, `a_document_must_be_what_it_says_it_is`.
|
||||
|
||||
**WB-remote-5** No assistant connects without the person, in the app's window.
|
||||
|
||||
```text
|
||||
GOAL: nothing a stranger sends over the internet can approve a connection.
|
||||
SOURCE: D-83 in plan/p15-app-and-relay.md (a new assistant is approved in
|
||||
the app's window, by whoever is at the machine).
|
||||
INVARIANTS:
|
||||
1. /authorize never approves: it parks the request for five minutes and
|
||||
answers a page that says to look at Wanderbooks (no form, no button,
|
||||
no script, every outside word escaped) and looks again by itself.
|
||||
2. Only an admin request (the owner-only admin socket) turns a waiting
|
||||
request into a code, by an id that is not the browser's: the page's own
|
||||
id only reads the outcome, once (302 with the code, or with
|
||||
access_denied after a refusal or a timeout).
|
||||
3. The window is told who is asking: the product by where it is sent
|
||||
back to (never by what it calls itself), that address, the caller's
|
||||
address, the company, whether posting was asked for.
|
||||
4. Waiting requests are bounded in all and per address.
|
||||
SCENARIOS:
|
||||
1. The person allows: the browser is sent back with a code.
|
||||
2. The person refuses, or no one answers: the browser is sent back with
|
||||
access_denied, and nothing was made.
|
||||
3. A guess of the browser's id decides nothing.
|
||||
```
|
||||
|
||||
*Enforced:* `Remote::authorize`, `Remote::wait`, `Remote::decide`, `Remote::pending_list`, `waiting` and `problem` (the page), `ledger_gui::connect::State::web_prompt`, `ledger_host::app_server::AppServer::web_decide`.
|
||||
*Checked:* `ledger-mcp` unit tests `the_window_is_told_who_asks_and_the_page_only_says_to_look`, `a_refusal_and_a_timeout_send_the_browser_back_denied_and_make_nothing`, `waiting_requests_are_bounded_per_address_and_in_all`, `a_strangers_words_never_become_markup`; `ledger-gui` `tests/assistants.rs` (`a_web_assistant_asking_is_put_to_the_person_over_any_page_in_plain_words`, `refusing_and_allowing_with_posting_are_their_own_answers`, `a_request_that_ran_out_goes_away_and_posting_is_turned_on_and_off_on_the_connect_page`).
|
||||
|
||||
**WB-remote-6** An approval is the owner's decision about a product, a company and what it may do, and it survives a product registering again.
|
||||
|
||||
```text
|
||||
GOAL: Claude and Grok register anew on most sign-ins; the person is not
|
||||
asked again, and revoking ends everything made under the approval.
|
||||
SOURCE: plan/p15-app-and-relay.md section 4, rule 6; RFC 9700 (refresh token
|
||||
rotation and reuse); D-86.
|
||||
INVARIANTS:
|
||||
1. An approval is one token of the books' principals (so "Who can reach
|
||||
these books" lists it, and revoking it by id ends it) plus a record
|
||||
naming the product (by its known redirect hosts, or its document
|
||||
address, or its name and redirects) and the company.
|
||||
2. A sign-in from the same product for the same company, while its
|
||||
principals' token is live and it was used within sixty days, is sent
|
||||
back with a code at once; for another company it is a new question.
|
||||
3. An access token lives ten minutes and is memory only; a refresh token
|
||||
lives sixty days since last use, is kept (hashed) across restarts, is
|
||||
rotated at every use, and one used twice ends its whole family.
|
||||
4. A revoked connection's access token is a 401 at once, and its refresh
|
||||
token is invalid_grant; a new sign-in asks the person again.
|
||||
SCENARIOS:
|
||||
1. A second registration of Claude is signed in without a question.
|
||||
2. A refresh after ten days, and after a restart, still works.
|
||||
3. Revoke in the list ends access and refresh.
|
||||
```
|
||||
|
||||
*Enforced:* `Remote::decide`, `Remote::issue`, `Remote::refresh`, `Remote::authenticate`, `Remote::save`.
|
||||
*Checked:* `ledger-mcp` unit tests `an_approval_survives_a_product_registering_again`, `a_code_used_twice_ends_what_it_made_and_so_does_a_refresh_token`, `revoking_the_connection_ends_the_access_token_and_the_refresh_token`, `refresh_tokens_survive_a_restart_and_only_their_hashes_are_kept`.
|
||||
|
||||
**WB-remote-7** A failure to sign in never bans an address; what a request creates is bounded.
|
||||
|
||||
```text
|
||||
GOAL: a stranger can fill neither memory nor disk, and a vendor's shared
|
||||
address is never shut out for another's failures.
|
||||
SOURCE: plan/p15-app-and-relay.md section 4, rule 7 (the vendors' addresses
|
||||
are shared; rate-limit per approval instead).
|
||||
INVARIANTS:
|
||||
1. Registered clients (2000 in all, thirty an hour from one address,
|
||||
600 an hour in all), waiting requests (twenty, five per address), codes,
|
||||
access tokens, refresh tokens, approvals, families, fetches of client
|
||||
documents and the limiter's own table are all bounded.
|
||||
2. A registration nobody used for a sign-in goes after an hour; the oldest
|
||||
unused goes first when the table is full; none unused and full is a
|
||||
refusal.
|
||||
3. Nothing bans an address; a refusal says to wait. An approval's own
|
||||
calls are limited to 600 a minute.
|
||||
SCENARIOS:
|
||||
1. Thirty-one registrations from one address: the thirty-first waits;
|
||||
another address is not shut out.
|
||||
2. Unused registrations expire.
|
||||
```
|
||||
|
||||
*Enforced:* `Remote::allow`, `Remote::make_room`, `Remote::sweep`.
|
||||
*Checked:* `ledger-mcp` unit tests `registration_is_bounded_and_unused_registrations_expire`, `waiting_requests_are_bounded_per_address_and_in_all`.
|
||||
|
||||
**WB-remote-8** A token for one company never reaches another, and a company not offered is not there.
|
||||
|
||||
```text
|
||||
GOAL: the lock on the front door is per company.
|
||||
SOURCE: D-78 in plan/p15-app-and-relay.md (a connection names its company and
|
||||
is never redirected to another).
|
||||
INVARIANTS:
|
||||
1. An access token carries the company of its approval; at another
|
||||
company's path it is a 403, recorded as that token's refusal with the
|
||||
caller's address.
|
||||
2. A company that is not offered (or not open) answers 404 on its path and
|
||||
has no metadata.
|
||||
3. A code and a refresh token carry their company and never make a token
|
||||
for another.
|
||||
SCENARIOS:
|
||||
1. A token for acme at beta's path is 403; with beta not offered, 404.
|
||||
```
|
||||
|
||||
*Enforced:* `door` (the server's `local` module), `Remote::is_allowed`, `resource_document`.
|
||||
*Checked:* `ledger-mcp` unit test `a_token_for_one_company_never_reaches_another`.
|
||||
|
||||
**WB-remote-9** A web assistant may read and draft; posting is the owner's to turn on, per connection.
|
||||
|
||||
```text
|
||||
GOAL: an assistant that also reads email, and can be steered by it, cannot
|
||||
post by default.
|
||||
SOURCE: D-86 in plan/p15-app-and-relay.md.
|
||||
INVARIANTS:
|
||||
1. An approval grants read and write (drafts), not post and never admin;
|
||||
the access record (admin) is not reachable through this door whatever
|
||||
the token says.
|
||||
2. The owner raises or lowers posting per approval (RemoteSetPost): the
|
||||
token that carries it is replaced by one with the new scopes in one
|
||||
principals record, and the same access tokens carry on.
|
||||
3. A key made for an assistant that takes only a key (RemoteMakeKey) is a
|
||||
principals token the door accepts, shown once, with the same scopes;
|
||||
no other principals token is accepted here.
|
||||
SCENARIOS:
|
||||
1. A new connection can't post; raised, it can; lowered, it can't.
|
||||
```
|
||||
|
||||
*Enforced:* `scopes_for`, `Remote::set_post`, `Remote::make_key`, `Remote::authenticate`.
|
||||
*Checked:* `ledger-mcp` unit tests `the_default_is_read_and_draft_and_the_person_raises_it_to_post`, `an_unsigned_request_is_a_401_that_says_where_to_sign_in_initialize_included` (an agent's own key opens nothing here).
|
||||
|
||||
**WB-remote-10** A remote call is the same call: one write path, plain JSON, no session.
|
||||
|
||||
```text
|
||||
GOAL: a write through the door is exactly once (D-88), and the door adds no
|
||||
second way to the books.
|
||||
SOURCE: D-88 in plan/p15-app-and-relay.md; WB-format-8 to 10.
|
||||
INVARIANTS:
|
||||
1. Every remote call is handled by the same server as a local one
|
||||
(`call_tool`): a write without its request_key is refused, and a repeat
|
||||
of a key returns the first answer and writes nothing. The remote door
|
||||
has no tool of its own.
|
||||
2. It is stateless and answers plain JSON: no session id is made, and one
|
||||
a caller names is not heard.
|
||||
SCENARIOS:
|
||||
1. A draft without a key is refused; with one, twice, it is one draft and
|
||||
the same answer.
|
||||
```
|
||||
|
||||
*Enforced:* `mcp_via` (the server's `local` module), `call_tool` (the server's `BooksServer`).
|
||||
*Checked:* `ledger-mcp` unit tests `a_remote_write_needs_its_request_key_and_a_repeat_returns_the_first_answer`, `a_registered_client_signs_in_and_reads_the_books`.
|
||||
Reference in new issue
Block a user