pgw#1008: the arm gate compares WHO THE CELL WAS FOR, not just who signed it - #533
Merged
Conversation
…gned it Twin of th#1657 (merged: tensorhub c2175b44 + fb23fa33). Makes this repo's own §6.14 note actionable — "adoption authority must be tied to the producing identity, not merely to a matching key". THE DEFECT, in this repo's own code. `owning_endpoint_id` has ridden the hub-signed receipt since pgw#709 and was decoded straight into `Receipt` (receipts.py:93, populated :248) — and compared against nothing. `verify_delivered_artifact` checked signature -> digest -> integral size -> embedded metadata -> packed cell key, and armed. A valid signature was read as "this cell is genuine" instead of "the hub signed this cell for THIS pod", so endpoint A's cell dlopen()ed on endpoint B's pods in another org. We were already paying for the attestation and throwing away the field that made it a trust decision. Discovery did not save us either: `aot_cells._discover_inner` lists the SHARED platform repo root/family-<f> and filters on the DECLARE contract — not on endpoint, not on org, not even on equality with this pod's own computed key. The only producer property any layer checked was th#1643's cloud tier, which is a statement about the HARDWARE. THE RULE, verbatim from Paul's ruling: a cell must have come from THIS endpoint, or from a publisher the platform vouches for. - `Receipt` gains the th#1657 v2 claims `publisher_tier` + `publisher_org_id`. - `refuse_untrusted_publisher` runs LAST in `verify_delivered_artifact`: after the signature (a tier means nothing until the claims are proven) and before the return (the caller's next act is to arm and load native code). Typed class `publisher_untrusted` on the existing `cell_receipt_refused` event, so it is countable beside every other reject class (pgw#824). - This pod's identity comes from `cell_read_endpoint_id` on the hub-issued worker JWT (th#1335 grant + th#1657) — not config, not an env var. The payload is decoded WITHOUT signature verification on purpose: it is our own bearer token, not an input, and the hub verifies it on every call. The RECEIPT is the untrusted thing, and it is verified before the comparison. - Every route to "wider" is closed: the tier normalizes to `org` unless it is exactly `platform` (no third value, no unknown branch); an org receipt naming no endpoint is adoptable by nobody; a pod that cannot name itself is narrowed to platform-tier only; and RECEIPT_VERSION moves to cell-receipt-v2 so a v1 receipt is REFUSED, not read as a v2 one with the trust fields missing. RED-VERIFIED. With the one call stubbed out, 9 of the 12 new tests fail — including "a genuine, correctly-signed, un-revoked receipt for ANOTHER endpoint" arming. The 3 that still pass are exactly the controls (our own cell arms; platform tier arms; a v1 receipt is refused by version), which is the shape that proves the suite is not passing by refusing everything. The 25 pre-existing receipt tests were updated to mint v2 fixtures with a MATCHING org-tier publisher, so the new gate is live in every one of them rather than only in the cases that name it. Gates: mypy (235 files clean), ruff, http-timeout guard, unreached-surface guard, config-read guard (74 pairs, no new env conditional), full suite 3448 passed / 37 skipped / 1 xfailed. Nothing in the fleet changes behaviour today — every endpoint is currently platform-authored, so every cell publishes at platform tier and arms as before. That is exactly why it is cheap now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Worker half of the cell trust boundary. Hub half is th#1657, merged: tensorhub
c2175b44(schema + signed tier + listing visibility) andfb23fa33(the push-path fallback deleted).Makes this repo's own §6.14 note actionable — "adoption authority must be tied to the producing identity, not merely to a matching key".
The defect, in this repo's own code
owning_endpoint_idhas ridden the hub-signed receipt since pgw#709. It is decoded straight intoReceipt(receipts.py:93, populated:248) — and compared against nothing.verify_delivered_artifactchecked signature → digest → integral size → embedded metadata → packed cell key, and armed. A valid signature was read as "this cell is genuine" instead of "the hub signed this cell for this pod". So endpoint A's celldlopened on endpoint B's pods, in another org. We were already paying for the attestation and throwing away the one field that made it a trust decision.Discovery did not save us either:
aot_cells._discover_innerlists the shared platform reporoot/family-<f>and filters on the DECLARE contract — not on endpoint, not on org, not even on equality with this pod's own computed key. The only producer property any layer checked was th#1643's cloud tier, which is a statement about the hardware, not about whose code ran on it.The rule — Paul's ruling verbatim
Receiptgains the th#1657 v2 claimspublisher_tier+publisher_org_id.refuse_untrusted_publisherruns last inverify_delivered_artifact: after the signature (a tier means nothing until the claims are proven) and before the return (the caller's next act is to arm and load native code). Typed classpublisher_untrustedon the existingcell_receipt_refusedevent, so it is countable beside every other reject class (pgw#824).cell_read_endpoint_id, stamped on the th#1335 cell-read grant by th#1657. Not config, not an env var. The JWT payload is decoded without verifying its signature, deliberately: it is our own bearer token, not an input, and the hub verifies it on every call. The receipt is the untrusted thing, and it is signature-verified before it reaches the comparison.Every route to "wider" is closed
publisher_tierexactlyplatformorg,"",None,PLATFORM,platform-ishcell-receipt-v1That last row is §4.24 point 4: the
omitemptycollapse is how a limit silently stops existing, and here it would silently delete the boundary.RED verification
With the single
refuse_untrusted_publisher(...)call stubbed out, 9 of the 12 new tests fail — including:That case is a genuine, correctly-signed, un-revoked receipt — signature verifies, digest matches, size matches, packed key matches, family matches, pair not revoked. It is simply not ours, and before this PR that made no difference at all.
The 3 that still pass under the stub are exactly the controls — our own cell arms, platform tier arms, a v1 receipt is refused by version — which is what proves the suite isn't passing by refusing everything.
The 25 pre-existing receipt tests were updated to mint v2 fixtures with a matching org-tier publisher, so the new gate is live in every one of them rather than only in the cases that name it.
Gates
mypy (235 files, clean) · ruff · http-timeout guard · unreached-surface guard · config-read guard (74 pairs, no new env conditional) · full suite 3448 passed, 37 skipped, 1 xfailed.
Blast radius today: none
Every endpoint is currently platform-authored, so every cell publishes at
platformtier and arms exactly as before. That is precisely why it is cheap now — the boundary has to exist before third-party endpoint authoring goes live, not after.Follow-on (not this PR)
cell_read_org_idon the grant. Named in the tracker.🤖 Generated with Claude Code