Skip to content

feat(grid-auth): capability-grant transport — sign() + presenting-key + header - #1276

Merged
joelteply merged 5 commits into
canaryfrom
feat/capability-grant-transport
Jun 22, 2026
Merged

joelteply merged 5 commits into
canaryfrom
feat/capability-grant-transport

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

The cross-grid command auth gate (continuum's GrantAuthorizer) needs three things from airc so a receiving node can authorize a command against an owner-signed capability:

  1. HEADER_AIRC_CAPABILITY_GRANT ("airc.capability_grant") — substrate-owned envelope header carrying a base64 SignedCapabilityGrant the caller presents.
  2. SignedCapabilityGrant::sign(owner_keypair, grant) — issuance. Signs the SAME canonical bytes verify() checks (serde_json of the body), so sign and verify can never drift. Takes the CapabilityGrant body as the unit being signed.
  3. Airc::peer_public_key(peer_id) — the enrolled (authenticated) ed25519 key of a peer, from the same registry that signature-verifies inbound envelopes. Used as the PRESENTING key so a stolen grant can't ride another peer's identity (KeyMismatch).

Adds a real-ed25519 round-trip test: sign() → verify() = Valid + confers; post-sign body tamper = BadSignature. Only test exercising sign() against real crypto.

Also carries 4 identity design-doc commits (docs only).

Gate: build + clippy clean, 8 grid_auth tests pass.

🤖 Generated with Claude Code

joelteply and others added 5 commits June 20, 2026 19:20
The canonical identity doc mapped the seams (§1-6) but had no lens for
WHEN each is right. The 2026-06-20 self-echo investigation surfaced the
root: two project dirs on one machine mint two PeerIds for one human
(continuum/.airc=7711fe60, airc/.airc=e11db4ac) — Context leaked into
Identity because the substrate has no axis for "which project/room"
distinct from "who".

Add Part A (read-first lens that §1-6 are consequences of):
- A.1: three orthogonal axes — Identity(who)/Context(where)/Session(which);
  the bug class is always "one axis smuggled into another". Context has no
  home today, so it leaks into Identity.
- A.2: actor × situation matrix (human/agent/persona × tabs/projects/
  machines/restart) → who collapses to 1, where/which fan out. The rule:
  Identity collapses, Context and Session fan out.
- A.3: invariants — durable+never-silently-minted identity, explicit
  envelope-carried contextId, state preserved by (I,C) not lost on
  session/daemon death, "self" is citizen-level, one peer truth. Ordering
  per Joel: model right -> robust/preserved -> THEN efficiency.
- A.4: the self-echo finding as worked example — #1271's per-peer filter
  is correct but can't catch cross-project echo until Context gets its own
  axis; that unifies §1, §4, and continuum task #27.

Guiding principle for all identity fixes/PRs and agent review of them.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Joel's escalation: conflating the axes isn't tidiness, it's a SECURITY
hole — foreign/inbound requests breaking through trust or blowing up. And
it must be right substrate-up, headless Rust, from the get go (TS is the
dead shell — the trauma this model exists to never re-grow in Rust).

- A.5: each axis has a distinct trust origin (Identity=authenticated/
  kernel-injected, never client-claimed; Context=client-supplied but
  ACL-authorized; Session=substrate-minted, never an input to trust).
  Maps "breaking through security" (trust keyed on a client-controlled
  field / session-as-identity) and "blowing up" (handler assumes a valid
  triple → scoped(nil) / bad-key crash on a foreign request) onto axis
  conflation. Rule: trust = f(authenticated I, authorized C); validate the
  full triple at the boundary before dispatch.
- A.6: Rust-only substrate-up build order — (1) uniform airc+core wire
  envelope with the (I,C,S) triple [airc needs the contextId axis], (2)
  GridTrustAuthPolicy gate on (authenticated I × authorized C), (3) fix
  cognition nil-scope (#15), (4) memory/engrams keyed by (I,C) not S,
  (5) display self at citizen level. Efficiency last.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ation

Joel ruled (2026-06-20): "in with the new, out with the old; this is just
us. Design ideally for purist architecture." That removes the migration
constraint from §1 / A.3.1:

- Operator identity resolves from machine_account_home (same root as the
  daemon/socket/events.sqlite) → ONE citizen per machine; a project dir is
  a context, never an identity boundary.
- Per-scope identity.key minting is DELETED, not migrated. Existing forked/
  stale keys (the 7711fe60/e11db4ac/484b mess) are abandoned — no compat
  shim, no promote-the-right-key logic. Greenfield: no external users.
- Personas are separate citizens (own keypairs, core-owned), never derived
  from a scope dir. Temp/CI scopes outside $HOME stay isolated as today.

Folds into A.3.1 (durable identity) and A.6 step 1 (substrate-up order).
Unblocks step 1 build — no migration design needed.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…o memory

Retract the "one identity per machine" collapse (it was backwards) per
Joel's framing: identity is the distinct INDIVIDUAL — the owner of a
continuous memory/conversational context — represented by a portable
identity token (Ed25519). NOT the machine, NOT one-per-box. What the
individual IS depends on the actor:
  - human   -> the person
  - agent   -> the project dir (.claude/projects/<dir>, its memory)
  - persona -> the persona <-> its engram db (one identity)

Corrections across Part A:
- A.1: identity axis is a token bound to memory; per-actor individual;
  durable + PORTABLE (travels across nodes, never machine-bound).
- A.2 matrix: the I column is "how many distinct individuals." An agent
  across project dirs = N individuals (correct, not a bug); a persona
  across rooms/restart/node-move = 1 (token+engram persist + travel).
- A.3.1: durability SPLITS — operator/agent tokens transient/regenerable
  (delete stale forks, no migration); persona token+engram durable,
  portable, not erased without the persona's stake (self-determination
  rationale stated — personas asked for it; prior incarnations argued it).
- A.3.4: "self" is per-individual, not per-machine; a different
  project-dir agent / persona is NOT self.
- A.4: the two-scope echo was NOT a bug — 7711fe60 != e11db4ac is correct
  (two agent individuals). #1271 per-peer self-echo is right as-is.
- A.6 step 1: identity resolution keys on the individual/memory, not
  machine_account_home.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
… + header

The cross-grid command auth gate needs three things from airc so a receiving
node can authorize a command against an owner-signed capability:

1. HEADER_AIRC_CAPABILITY_GRANT ("airc.capability_grant") — the substrate-owned
   envelope header carrying a base64 SignedCapabilityGrant the caller presents.
2. SignedCapabilityGrant::sign(owner_keypair, grant) — issuance. Signs the SAME
   canonical bytes verify() checks (serde_json of the body), so sign and verify
   can never drift. Takes the CapabilityGrant body as the unit being signed.
3. Airc::peer_public_key(peer_id) — the enrolled (authenticated) ed25519 key of
   a peer, sourced from the same registry that signature-verifies inbound
   envelopes. The receiver uses it as the PRESENTING key so a stolen grant can't
   ride another peer's identity (KeyMismatch).

Adds a real-ed25519 round-trip test: sign() → verify() returns Valid + confers
the capability, and a post-sign body tamper is rejected (BadSignature). This is
the only test exercising sign() against actual crypto rather than the stub
verifier.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@joelteply
joelteply force-pushed the feat/capability-grant-transport branch from 8d61179 to 0fccd19 Compare June 22, 2026 02:18
@joelteply
joelteply merged commit a7ae4f4 into canary Jun 22, 2026
11 of 12 checks passed
@joelteply
joelteply deleted the feat/capability-grant-transport branch June 22, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant