diff --git a/docs/spec/claims/link.md b/docs/spec/claims/link.md index c31ac90e..ba470557 100644 --- a/docs/spec/claims/link.md +++ b/docs/spec/claims/link.md @@ -39,6 +39,13 @@ INVARIANTS: identity is made. 5. No key, label or token is in a log, an error, a status's debug text or a test's output. + 6. The label is not a secret from the network. It travels in the caller's + TLS hello (the server name) and in the DNS queries that find the + address, so the relay, the vendor's resolvers and the path in between + all see it. The sign-in is the lock; the label only stops listing and + guessing. Nothing here says otherwise to the person. + 7. The address kept is read from the folder once and held: the window + asks every frame, and the key beside it is read only where it signs. SCENARIOS: 1. The first turn-on makes an address; off and on again, and a restart of the app, give the same one, and the name is claimed once. @@ -47,7 +54,7 @@ SCENARIOS: ``` *Enforced:* `Identity::load_or_create`, `Identity::new_label`, `Identity::reset`, `new_label`, `write` (module `private`, crate `ledger-link`). -*Checked:* `ledger-link` `tests/link.rs` (`the_key_the_certificate_and_the_label_are_private`, `a_new_address_stops_the_old_one`, `off_closes_the_line_and_the_address_is_the_same_on_again_and_after_a_restart`, `a_relay_that_lost_the_name_says_so_and_a_new_address_carries_on`) and unit tests in `src/identity.rs` and `src/private.rs`. +*Checked:* `ledger-link` `tests/link.rs` (`the_key_the_certificate_and_the_label_are_private`, `a_new_address_stops_the_old_one`, `off_closes_the_line_and_the_address_is_the_same_on_again_and_after_a_restart`, `a_relay_that_lost_the_name_says_so_and_a_new_address_carries_on`, `the_kept_address_is_read_once_not_every_frame`) and unit tests in `src/identity.rs` and `src/private.rs`. **WB-link-2** The app holds one outbound line to the relay and keeps it, by itself, through anything. @@ -66,7 +73,12 @@ INVARIANTS: app's own process and ends with it, so it can never keep a door open for books that closed. 2. A failed dial waits a growing, jittered time (at most five minutes); - a nudge or a held line starts it again. + a nudge starts it again. A line that held for a minute is redialled + after a wait spread over 0 to 30 seconds, and only then does the + backoff start over; a line that ended sooner (a relay that accepts and + drops) waits as a failed dial does. So a relay that restarts is not + met by every app in the same second, and one that misbehaves is not + redialled at a steady rate for ever. 3. The line is pinged every 30 seconds and a ping not answered in 15 ends it and a new one is made. 4. A wall-clock step much longer than the time that passed (a sleep) ends @@ -80,8 +92,8 @@ SCENARIOS: 3. A relay that is not there is dialled with a backoff, not in a loop. ``` -*Enforced:* `Backoff`, `WakeDetector`, `Timing` (module `line`) and `Inner::hold` and `Inner::line_loop` (module `link`), crate `ledger-link`. -*Checked:* `ledger-link` `tests/link.rs` (`the_line_comes_back_after_the_relay_drops_it`, `pings_keep_an_idle_line_and_silence_loses_it`, `an_unreachable_relay_says_so_in_words_and_recovers_by_itself`) and unit tests in `src/line.rs` (`the_backoff_grows_stays_under_its_ceiling_and_resets`, `a_wall_clock_jump_with_no_monotonic_jump_is_a_sleep`). +*Enforced:* `Backoff`, `Redial`, `WakeDetector`, `Timing` (module `line`) and `Inner::hold` and `Inner::line_loop` (module `link`), crate `ledger-link`. +*Checked:* `ledger-link` `tests/link.rs` (`the_line_comes_back_after_the_relay_drops_it`, `pings_keep_an_idle_line_and_silence_loses_it`, `an_unreachable_relay_says_so_in_words_and_recovers_by_itself`) and unit tests in `src/line.rs` (`the_backoff_grows_stays_under_its_ceiling_and_resets`, `a_wall_clock_jump_with_no_monotonic_jump_is_a_sleep`, `a_line_that_ends_young_keeps_the_backoff_and_one_that_held_is_spread`). **WB-link-3** The app ends the web caller's TLS itself, with its own certificate, and hands the plain stream to the remote door after the secret and the relay's header. @@ -105,6 +117,12 @@ INVARIANTS: does not finish in time is dropped; with no door, a caller is turned away at once. 4. Nothing the relay could use to read traffic leaves the machine. + 5. Who can read what, said plainly: the relay that carries the + connection cannot read it. The assistant's maker (for example + Anthropic or OpenAI) reads what the person lets that assistant read, + which is what it is sent. "Nobody can read what passes through" is + not true and is not said; the Connect page says the two sentences + above. SCENARIOS: 1. A caller's TLS through the relay reaches a stand-in door, which is given the secret first, then the caller's address as the relay saw @@ -121,8 +139,11 @@ SCENARIOS: ```text GOAL: a certificate for the app's own name, ordered with a key made here, kept so a restart orders nothing, renewed when the authority says (or - two thirds through its life), from whichever authority the relay lists - so a swap needs no release. + two thirds through its life), from whichever of a fixed set of public + authorities the relay lists, so a swap among them needs no release; + and nothing the relay says can make the app believe a certificate + from an authority it made up, or send a request to a server it + named. SOURCE: D-87, plan/p15-app-and-relay.md section 5 ("Authorities are data, not code"; the proof record is published by the relay for the app's own name); RFC 8555 (ACME, DNS-01, external account binding); @@ -143,16 +164,46 @@ INVARIANTS: naming the certificate it replaces; the certificate in use serves until it ends if a renewal fails. 5. An account binding is sent only when the relay gave one for this app. + 6. A certificate is believed only if its chain ends at one of the public + roots the program ships, for the app's wildcard, at issue and at every + load (`CertTrust`; only a test builds one of its own roots, and + nothing at run time can). A lifetime over 100 days is refused, and a + renewal is planned no later than two thirds of the life or 60 days, + whichever is sooner. A kept certificate that fails any of this is + ignored and ordered again. The same name keeps a good wildcard across + "Get a new address"; a name that is given up (a lost one, a first claim + that found it taken) has none carried over. + 7. A certificate is never served at or after its end, however far off + the next renewal try is: the resolver refuses it, no wait runs past it, + and the state stops saying it is in place. + 8. The app sends a request only to an authority's directory on a host + compiled into it (`DIRECTORY_HOSTS`: Let's Encrypt production and + staging, Google Trust Services, ZeroSSL, Buypass and SSL.com, each + from its own documentation), over https and with no port or name in + the address. The relay still chooses which of them and in what order; + one on any other host is skipped and said so. A kept account is used + only if its directory is on the list too. Adding a brand-new + authority therefore takes a release of the app: that is the price of + the relay not being trusted with where the app sends its requests. + 9. The certificate work starts when the line is up, so it is for the name + the relay accepted; a first claim that finds the name taken picks + another before any certificate is ordered, and the door is started as + the address that was settled (`Link::wait_settled`). SCENARIOS: 1. Order, store, reuse across a restart: one order in all. 2. The renewal window opens: a second order names the first. 3. The first authority fails and the second issues; one needing a binding the relay has none for is never asked. 4. Every authority failing says so in words and mends when one works. + 5. A certificate from an authority the relay made up, or that lives over + 100 days, is refused and never stored or served; one on disk is + discarded; one that has ended is not served; a directory on another + host is not contacted; a name taken on the first claim is replaced + before any order. ``` -*Enforced:* `StoredCert`, `CertStore`, `default_renewal` (module `certs`), `AcmeIssuer` (module `acme`), `Inner::cert_loop` and `Inner::order` (module `link`), crate `ledger-link`. -*Checked:* `ledger-link` `tests/link.rs` (`the_first_authority_fails_and_the_second_issues`, `an_authority_that_is_not_usable_is_skipped`, `every_authority_failing_is_said_and_retried_until_one_works`, `the_certificate_is_renewed_at_the_authoritys_suggested_time`, `without_renewal_information_it_renews_two_thirds_through`) and `tests/acme.rs` (`an_order_goes_through_account_proof_finalize_and_download`, `a_renewal_reuses_the_account_names_what_it_replaces_and_reads_the_window`, `a_binding_is_sent_when_there_is_one_and_never_invented`, `a_refusal_comes_back_in_the_authoritys_words`). +*Enforced:* `StoredCert`, `CertStore`, `CertTrust`, `Resolver`, `renewal_cap` (module `certs`), `AcmeIssuer`, `DIRECTORY_HOSTS` (module `acme`), `Link::wait_settled`, `Inner::cert_loop` and `Inner::order` (module `link`), crate `ledger-link`. +*Checked:* `ledger-link` `tests/link.rs` (`the_first_authority_fails_and_the_second_issues`, `an_authority_that_is_not_usable_is_skipped`, `every_authority_failing_is_said_and_retried_until_one_works`, `the_certificate_is_renewed_at_the_authoritys_suggested_time`, `without_renewal_information_it_renews_two_thirds_through`) and `tests/acme.rs` (`an_order_goes_through_account_proof_finalize_and_download`, `a_renewal_reuses_the_account_names_what_it_replaces_and_reads_the_window`, `a_binding_is_sent_when_there_is_one_and_never_invented`, `a_refusal_comes_back_in_the_authoritys_words`, `a_directory_on_a_host_the_app_does_not_know_is_refused_before_any_request`, `a_kept_account_for_an_unlisted_directory_is_not_used`) and `tests/link.rs` (`a_certificate_from_an_authority_the_relay_made_up_is_never_stored_or_served`, `a_stored_certificate_from_a_made_up_authority_is_discarded_and_ordered_again`, `a_name_taken_on_the_first_claim_settles_before_the_certificate_and_the_address`, `an_expired_certificate_is_not_served_and_the_state_says_so`) and unit tests in `src/certs.rs` (`a_certificate_from_an_authority_the_relay_made_up_is_refused`, `a_lifetime_over_the_cap_is_refused`, `renewal_is_never_later_than_two_thirds_or_sixty_days`, `a_stored_certificate_that_fails_is_ignored_when_read`, `the_resolver_serves_only_its_host_and_only_until_the_certificate_ends`) and `src/acme.rs` (`every_listed_host_is_accepted_at_its_directory_and_no_other_is`). **WB-link-5** Every state of the link ends in plain words and mends by itself. @@ -175,6 +226,11 @@ INVARIANTS: and a new address makes a new identity. 4. The link's state is read from memory and never waits; the window and the local assistants never depend on the network. + 5. The window's words are the app's own, chosen from the kind of + failure. What the relay or an authority said is shown only as a short + quoted detail: control and invisible characters removed, white space + made single spaces, cut to about 120 characters, and the whole text + of failures bounded (`detail`, `clean`). SCENARIOS: 1. Each trouble has words; the mending ones say so. 2. A relay that is not there is "can't reach its relay ... keeps @@ -184,7 +240,7 @@ SCENARIOS: ``` *Enforced:* `Trouble`, `LinkStatus`, `Step` (module `status`), `trouble_of_io`, `trouble_of_refusal` (module `line`), crate `ledger-link`. -*Checked:* `ledger-link` `tests/link.rs` (`an_unreachable_relay_says_so_in_words_and_recovers_by_itself`, `no_internet_is_said_as_that`, `a_wrong_clock_is_said_as_that`) and unit tests in `src/status.rs` and `src/line.rs` (`errors_read_as_the_right_trouble`). +*Checked:* `ledger-link` `tests/link.rs` (`an_unreachable_relay_says_so_in_words_and_recovers_by_itself`, `no_internet_is_said_as_that`, `a_wrong_clock_is_said_as_that`, `an_authority_that_shouts_is_shown_short_and_plain`) and `tests/acme.rs` (`what_the_authority_says_is_short_plain_and_quoted`) and unit tests in `src/status.rs`, `src/text.rs` (`long_text_with_tricks_comes_out_short_and_plain`) and `src/line.rs` (`errors_read_as_the_right_trouble`). **WB-link-6** Web assistants are on per company, off by default, and the line and the door are open only while some company is on. @@ -205,6 +261,13 @@ INVARIANTS: 3. The switches are kept in a private file and put back for the companies that are open; a failure at any step leaves nothing half-on. + 4. Off is only off when the books server said so. A refusal, or any + reply but its success, leaves the company shown as on, with the error + in words (it is still reachable by anyone holding a token); a server + that cannot be reached at all closes the whole line and the door, for + every company, and says so. + 5. The door is started as the address the relay has accepted: the name is + claimed and settled first. SCENARIOS: 1. On, a web assistant signs in through the relay and reads the books; off, the line and the door are gone and the address is kept; on again, @@ -212,4 +275,4 @@ SCENARIOS: ``` *Enforced:* `WebAssistants` (`turn_on`, `turn_off`, `new_address`, `restore`) in `crates/ledger-host/src/web.rs`. -*Checked:* `ledger-cli` `tests/web_link.rs` (`a_web_assistant_signs_in_through_the_relay_and_reads_the_books`, `off_closes_the_line_and_the_door_and_on_again_is_the_same_address`, `a_new_address_refuses_what_the_old_one_signed_in`, `the_switches_are_put_back_at_the_next_start`). +*Checked:* `ledger-cli` `tests/web_link.rs` (`a_web_assistant_signs_in_through_the_relay_and_reads_the_books`, `off_closes_the_line_and_the_door_and_on_again_is_the_same_address`, `a_new_address_refuses_what_the_old_one_signed_in`, `the_switches_are_put_back_at_the_next_start`) and unit tests in `crates/ledger-host/src/web.rs` (`one_company_off_is_unreachable_at_once_while_another_still_works`, `a_refusal_leaves_the_company_shown_as_on_with_the_reason`, `an_unreachable_server_closes_the_whole_line_and_door_and_says_so`). diff --git a/plan/p15-app-and-relay.md b/plan/p15-app-and-relay.md index d74731ef..25decbf1 100644 --- a/plan/p15-app-and-relay.md +++ b/plan/p15-app-and-relay.md @@ -367,8 +367,19 @@ app's certificate code knows that protocol and nothing about any one authority. At each issuance it asks the relay service for the list to try, in order: for each authority its directory address, whether it needs an account binding, and if so a binding credential the relay -service obtained for this app. Changing or adding an authority is a -change to that list on our server, with no new release of the app. What +service obtained for this app. Choosing among the authorities the app +knows, and their order, is a change to that list on our server, with no +new release of the app. **Adding a brand-new authority needs a release** +(B3 review, 2026-11-21): the app sends requests only to directory hosts +compiled into it (Let's Encrypt production and staging, Google Trust +Services, ZeroSSL, Buypass, SSL.com: `DIRECTORY_HOSTS` in +`crates/ledger-link/src/acme.rs`, each host from the authority's own +documentation), because a relay that could name any host in the list +could make every app send requests to a server of its choice. For the +same reason the app believes a certificate only if it chains to the +public roots it ships, for its own wildcard, and lives no longer than +100 days; the relay's list can choose among authorities but cannot make +the app trust a new one. What differs between authorities beyond the protocol (renewal information, lifetimes, limits) sits behind one small trait. The tests issue from a local test authority configured two ways, one with an account binding @@ -382,6 +393,17 @@ then show only the wildcard. The words are for recognition; the secret label stops listing and guessing; the sign-in is the lock. One name per installation; each company is a path under it. +**What the label does not hide, and who can read what** (B3 review, +2026-11-21). The secret label is in the caller's TLS hello (the server +name) and in the DNS queries that find the address, so the relay, the +vendor's resolvers and the network path all see it. It is not a secret +from them; it stops listing and guessing, and the sign-in is the lock. +The relay cannot read the traffic (its certificate is not there to read +it with). The assistant's own company (Anthropic, OpenAI and the like) +reads what it is sent, which is what the person lets that assistant read. +The Connect page says these two things and not "nobody can read what +passes through". + **State (D-85).** Durable: name, public key, created, blocked. In memory: name to open line. Transient: proof records, minutes each. @@ -481,6 +503,8 @@ From unit B3 (the app's side of the relay), left out on purpose: and the unit's brief left it for later if the plan left it open. It needs a log monitor choice (crt.sh and the like are third-party services the app would call with the app's name), so it waits for the owner's word. + Until it is built, a relay that misuses its DNS control to get a + certificate for a user's name would not be detected. - The steps for ChatGPT, Gemini, Grok and muse.ai are not written: the plan has none it stands behind (section 7: OpenAI's two pages disagree), so the page says "we haven't tested this yet". The steps for Claude on the