0054 - Route trust: bids from the bidder's repo, record bytes against their content id
Status: approved by the owner 2026-11-20 (the two controls, in his words, below; decision 71: bids and receipts signed by a key bound to the bidder)
Why
Callers reach a requester or a bidder through an ingress route (prod: the relay at xrpc.fedproxy.com, where TLS ends). Whoever controls a route answers in the victim's place. Two places trusted such answers.
- Owner: "The requester takes bids from a bidder's answer as given: fetch each bid from the bidder's own repo."
- Owner: "Record reads trust the content id the server reports: check the bytes against the id asked for."
- Owner, decision 71: "verify the signature on every bid before it is queued, and prove the key-binding record is really in the bidder's repo by verifying the repo's signed commit against the DID document's key (the same check the vouch walk already does)": "Bids and receipts, in the batch".
Steps
- The requester reads no bid from the submitRfp answer; of a submitBid it takes
uriandcidonly and reads the bid from the issuer's repo; the winning bid'sconfigmust be a record in that repo. - A record read with a known content id hashes the value as dag-cbor (CIDv1, sha2-256) and fails hard on a mismatch:
internal/atproto/recordcid, used by the market readers, the remote repo, pdsclient, the stream sink and the policy engine's record reads. - Prove the encoder against real prod records of every type we read (a scratch program, counts per collection).
- Prove on a local market with a man-in-the-middle proxy: main takes a forged bid; this build reads the real one, refuses a bid in another repo, fails hard on altered bytes; two normal rentals to Held and release.
- Docs:
docs/security/proposed-controls.md(built),docs/protocol/market.md,docs/protocol/flow.md. - Review (D1, D2, D5, D6): what is enforced (issuer = bid URI authority, not "the DID the RFP went to"); another version of a record is delivered or not found, never a forgery; exact integers; the policy engine compares the verified tree's cid.
- Decision 71:
verifyBidbefore every queue, the verifiedbadgeBlueKeysbinding (identlink.Remote.GetVerifiedRecord), receipts under the same rule, guest events on the same binding; proofs on a local market; prod records checked.
Order
- Steps 1 and 2, then 3, then 4, then 5.
Proof (2026-11-20, hat-8, local market rtrust, one bidder; dev builds main 7eb2b985 and this branch 700f3f50)
The bidder's PDS endpoint was moved by a signed PLC operation to a loopback proxy (the route) that rewrote its
market.offering endpoints to a second proxy in front of its market endpoint; a third served an attacker DID's records.
- (a) main: a submitRfp answer with a forged bid (the real bid URI, a made-up cid, the attacker's config) won the round before the real bid arrived; the requester read the attacker's config; the main bidder took the accept and signed a receipt naming the made-up cid; the guest's secrets failed (2 min). Altered config bytes with the cid kept (main): read and used, secrets failed the same way. A bid URI in the attacker's repo (main): chosen and accepted.
- (b) this branch: the same forged answer is ignored; the bid is read from the bidder's repo; Held, secrets fetched; the attacker's PDS got no request. (c) a bid URI in the attacker's repo: ignored, the real bid wins, Held.
- (d) this branch: altered config bytes with the cid kept: one read, then
the record bytes do not hash to the content id asked for, the contract Failed, no retry. - (e) two rentals of this branch to Held and Released; round from RFP to winner 2.5 s and 3.0 s (main 6.2 s; window 30 s).
- Skew: main requester with this bidder, and this requester with the main bidder: Held and Released. A main requester that accepted a forged cid against this bidder: the bidder refuses the accept (another version of its bid).
Proof of decision 71 (2026-11-20, local market rtrust, one bidder; main 7eb2b985, this branch 3daedb5a)
A Go proxy sat in front of the bidder's PDS (its DID document moved there by a signed PLC operation) and served, per rules,
a bid re-signed by an attacker key, a forged badgeBlueKeys binding for that key (plain getRecord), a receipt re-signed by
a random key, or 503 for the binding's sync.getRecord. Logs: ~/.tmp/route-trust/proof-<run>.log, -core.log, forge.log.
- main: an unsigned bid in the submitRfp answer won (run a-main above). An attacker-signed bid with the forged binding was taken through the bid mailbox and won; the bidder's receipt names the forged cid (run a1-main). A receipt signed by a random key was accepted and the contract Held (run a2-main; its release then failed: the bidder refused a destroy naming that receipt; the VM went with dev down).
- this branch: the attacker-signed bid is refused,
requester_bid_refused"signed by did:key:zQ3sheHdk5..., which is neither a DID document key of did:plc:uuhl... nor bound by its verified badgeBlueKeys record"; the real bid wins; Held, Released (b1f-new). The random-key receipt is refused,requester_receipt_signaturesigOk false bindOk true; the contract Failed "the receipt signature or accept binding is invalid" (b2-new). The real receipt verifies in every normal run. - the binding read: 503 once,
requester_bid_verify_unavailable, then the bid is taken and the contract Held (c1-new); 503 for ever, tried every 2 s and left out after 2 min,requester_bid_verify_gave_upfor each of the 4 rounds' bids; the contract waits for capacity (c2-new). - normal: two rentals Held and Released, RFP to winner 2.18 s and 2.28 s (d1-new, d2-new); before: 6.20 s (main), 3.52 s (main requester, new bidder). Skew: main requester with this bidder, this requester with the main bidder: Held, Released.
- not exercised live: an unsigned bid through the catch-up read on this branch (twice the stream's real bid came first and
the catch-up never ran); it is the same check (
no signature verifies).
Proof of review D-A and D-B (2026-11-20, local market rtrust, one bidder; main 7eb2b985, before the fix 3daedb5a, after c5c05a3f, merged route-trust-on-reads)
The same proxy re-signed each bid with the attacker's own key and named that key's issuer: issuer the attacker's did:plc
(did:plc:xwiu..., whose DID document lists the key) or the did:key itself. The proxy answers every read of the bid, so the
stream and the catch-up read (requester_bid_catch_up) both bring the forged bid into the bid mailbox. Logs:
~/.tmp/route-trust/proof-<run>.log, proof-<run>-core.log, forge.log, series6.log..series8.log.
- main, issuer did:plc: the forged bid won; the bidder's receipt names cid bafyreicmjus..., its real bid is bafyreignohx... (m-iss-plc).
- before the fix, issuer did:key: taken by the catch-up read and the mailbox and won; receipt names bafyreib3plp..., real bafyreiafmeb... (o-iss-key; the guest then failed to come on network, the forged bid's terms).
- after the fix, both issuers, and on
route-trust-on-reads: every forged bid refused from the mailbox, stream and catch-up copies alike,requester_bid_refused"its signatures name another issuer (did:key:zQ3shVAp... | did:plc:xwiu...), not did:plc:65ll..."; no bid taken, the contract Failed "no bids received" (n-iss-key, n-iss-plc, r-iss-plc). A receipt re-signed with issuer did:plc:xwiu... is refused the same way; Failed "the receipt signature or accept binding is invalid" (n-receipt-plc). - D-B requester: the binding's sync.getRecord answered 404 for 25 s. Before the fix "not bound" was kept 5 min: 14 bids
refused, the contract Failed after 2 rounds (o-neg). After: the first bid after the 404 window was taken; Held, Released
(n-neg).
route-trust-on-readskeeps no negative at all. - D-B bidder: the bidder logs "the bidder's badge.blue attestation key is bound" before "the bidder offering is refreshed" at every start (23:05:02.394 then .399) and its first bid after the start won (b-first). The failure case (first binding write fails) was not made live: a PDS restart on the dev market takes 0.15 s and the write goes through the bidder's repo, not the routed PDS.
- normal: n-d1, n-d2, r-d1 (on
route-trust-on-reads) Held, the guest read the secret, Released. route-trust-on-reads2a166592 (batch acea7b28 + rc-reads 5a843691), requester and bidder: one normal rental Held, secret read, Released (r2-d1); the forged bid with issuer did:plc:xwiu... refused on the stream and catch-up copies, 4requester_bid_refused, Failed "no bids received" (r2-iss-plc).
Findings (reported, not built: no approval)
- submitRfp
declined {kind, reason}and the submitAccept status are taken from the answer: upstream by design. market.offeringand the heartbeat are unsigned and read by URI: upstream by design.- A route can replay an older signed commit (freshness), and TLS ends at the relay: upstream by design.
badgeBlueKeysis unsigned and itsservicegives no purpose separation: upstream by design.- An invalid receipt leaves the bidder's VM running (main too): ours, proposed in
docs/security/proposed-controls.md. - A policy input that cannot be read fails open (
recordInput,bid-payload): ours, proposed there too.
Prod records under the new rules (2026-11-20, hack/recordcheck)
- The four prod bidders (did:plc:2l2wdry77c7jtucbslstagkj, 4vcig7s43z3nyqrnepmcfzqt, 7fj5jk5jxadrqtc5txp7xitp, kmccrdloxyziyhvga37tdg67), up to 100 per collection: 3793 records, every content id right; 3361 signed records (400 bids, 400 bids.free, 304 receipts, 319 market.event, the compute.events.vm.* and guest.* payloads), every one verifies under the new rule, all by the badgeBlueKeys binding read with sync.getRecord and the commit check (no bid is signed by a DID document key). The config records (400) carry no signature: the signed bid binds them by cid.
- Eight prod repos (also bob, alice, john, socialweb.computer), up to 60 per collection, second run with the repo-DID-only rule: 8060 records, 0 content id or round trip failures; 3658 signed, 3586 verify (0 by a DID document key, 3586 by the verified binding); 69 signature entries name another issuer and 0 records would pass only through one; 72 do not verify: 60 bids and 9 receipts in alice's repo and 3 guest.signalWebRTC payloads in bob's, signed by keys their repos bind no longer (old records from when those accounts ran a bidder); the requester reads none of them today. 12 reads of one repo's social.grain.photo failed at bsky.network (HTTP), not a check.
- Synthetic: max and min int64, 2^53+1, a negative and zero hash to the cid of their dag-cbor encoding; 1.5 is refused. The first recordcid (before D5) gave a false mismatch for 2^53+1 and refused max int64.
Record types read with an expected cid, and the sample
hack/recordcheck (go run ./hack/recordcheck -n 60 <repos...>) reads up to N records per collection with getRecord and checks
the content id, a dag-cbor round trip and every signature under the requester's rule. Read with an expected cid by the code,
and sampled on prod: market.bid, bids.free, bids.x402, compute.config.wif.simple, compute.vm, market.rfp, market.accept,
accepts.x402, market.receipt, receipts.x402, market.event, compute.events.vm.* and compute.events.guest.* payloads,
ingress.webRTC, computer.socialweb.ingress.answer and .listen, computer.socialweb.temp.policy.ghalite (the policy workflow),
market.association, link.ident.endorsement, software.release.version and .manifest. Not in any sampled repo:
market.associationRequest (written in a guest requester's own repo, none live) and accepts.free / receipts.free (no writer).
Merge notes for the lead
- On
swc/batch:runner.gosolicitBids iserr := submitRFPWithin(cctx, r.q.market, bidder, SubmitRFPRequest{URI: rfpURI, CID: rfpCID, WindowEnd: windowEnd})(done in this branch). - With
swc/secrets-on-batch: itsinstallResumedVerifier(secrets.go:590in the merged tree) callsresolveBidConfig(ctx, reader, winnerDID(st), bid.Value): the bidder DID is now an argument. - With
swc/rc-reads: done in branchroute-trust-on-reads(route-trust with rc-reads merged, onswc/batch):attest.gokeepsCheckRecordSignaturesas the one API and rc-reads'VerifyRecordSignaturesErris a wrapper (refused =errors.Is(err, ErrUnsignedRecord), else the lookup error), with rc-reads'NewDirectoryKeyListerreturning a non-NotFound lookup error;events.gotakes route-trust's check inside rc-reads' loop and keepserrGuestEventUnverifiedfor a failed lookup;inbox.gotakes route-trust's;runner.gobestBid takes rc-reads';secrets.gokeeps route-trust'swinner.DIDinside rc-reads'untilSettled.