panel handover: the capability is handed to ANY live session of the member, not the one that completed the armed sign-in — a stale panel session can take the steward's passcode #1969

Closed
opened 2026-09-28 17:06:00 +00:00 by matou-build-agent · 2 comments

The gap

#1967 landed the handover capability and delivered it over the OIDC channel, as ruled. But the gate stashes it keyed by identity, and hands it to any live session of that identity — not to the session that completed the armed sign-in.

// internal/controlapi/panelhandover.go
pending map[string]handoverPending      // keyed by the OIDC subject
...
sub, ok := resolver.Resolve(r)          // whoever holds a session for that subject
capability, _ := store.Take(sub)

The route's own doc comment states the intent and then misses it:

"only the panel that COMPLETED the sign-in — holding that identity's session — can read its capability, AC 5"

Holding that identity's session is not the same as having completed that sign-in. #1967's AC 5 says "a panel that completed the armed sign-in can read the capability, and nothing that did not complete that sign-in can." The first half holds. The second does not.

panelhandover_test.go tests only a different identity (Estranger reads empty). A second session of the same member is never exercised — and it would succeed.

Why it matters

A control-panel session is a 12 h HMAC cookie that grants the panel. It does not grant the steward's passcode — that is the whole point of d.6's sealed box: the box opens only in the tab that minted the sealing key.

With identity-keying, a stale panel session of the steward's own — an abandoned tab on a shared machine, a second device, a browser left signed in — can, within the 5-minute stash window after the steward's next armed sign-in somewhere else, call GET /api/v1/panel/handover, take the capability, bind its own sealing key and collect the sealed passcode. It opens it and holds the steward's whole identity.

That converts panel access for 12 h into the identity, permanently. It is the escalation d.6 exists to prevent, arriving through the mechanism built to protect it. It is narrower than #1966 (the caller must already hold a valid session as that member, so this is not reachable by a stranger) — but it is still a privilege escalation, and it is the case Ben's ruling named when it said the capability must be bound to that one sign-in.

Note too that the ruling said "the AID is not an input at any point". The mint is properly random and not AID-derived — but the delivery is keyed by the OIDC subject, which is the AID. The AID became an input at the last hop.

What to build

Bind the stash to the sign-in that armed it, not to the identity:

  • key the pending capability by something only the completing session holds — the gate session minted from that exact code exchange, or a nonce written into that session at /authz/signin and required on the read;
  • a second, concurrent, or older session for the same member must read empty, exactly as a stranger does;
  • a fresh armed sign-in still supersedes an uncollected earlier capability (today's behaviour, keep it);
  • everything else #1967 landed stays: the mint gated on armed && panel, the userinfo carrier, one-shot Take, the 5-minute ceiling, and the resting-substrate empty answer.

Acceptance criteria

  • Given an armed sign-in that stashed a capability, when a different session of the same member reads the route, then it receives nothing and the capability remains for the session that earned it.
  • Given the session that completed the armed sign-in, when it reads, then it receives the capability exactly once, as today.
  • Given a second armed sign-in by the same member, then it supersedes any uncollected capability (unchanged).
  • Given an unauthenticated caller or a different identity, then 401 / empty as today — no regression.
  • Given the tests, then the same-member-second-session case is explicit and is RED before the fix.

Blocked by

  • None — #1967 has landed; this corrects its last hop.

Notes

Found reviewing #1967's close-report against the carrier hazard raised on that ticket before it was claimed ("the carrier must not be an identity lookup"). The agent moved delivery off /me as asked and built a dedicated route, which is right; the keying is the part that still resolves by identity.

## The gap #1967 landed the handover capability and delivered it over the OIDC channel, as ruled. But the gate stashes it **keyed by identity**, and hands it to **any** live session of that identity — not to the session that completed the armed sign-in. ```go // internal/controlapi/panelhandover.go pending map[string]handoverPending // keyed by the OIDC subject ... sub, ok := resolver.Resolve(r) // whoever holds a session for that subject capability, _ := store.Take(sub) ``` The route's own doc comment states the intent and then misses it: > *"only the panel that COMPLETED the sign-in — holding that identity's session — can read its capability, AC 5"* Holding **that identity's session** is not the same as **having completed that sign-in**. #1967's AC 5 says *"a panel that completed the armed sign-in can read the capability, and nothing that did not complete that sign-in can."* The first half holds. The second does not. `panelhandover_test.go` tests only a **different** identity (`Estranger` reads empty). A *second session of the same member* is never exercised — and it would succeed. ## Why it matters A control-panel session is a 12 h HMAC cookie that grants the panel. It does **not** grant the steward's passcode — that is the whole point of d.6's sealed box: the box opens only in the tab that minted the sealing key. With identity-keying, a **stale panel session of the steward's own** — an abandoned tab on a shared machine, a second device, a browser left signed in — can, within the 5-minute stash window after the steward's *next* armed sign-in somewhere else, call `GET /api/v1/panel/handover`, take the capability, bind its own sealing key and collect the sealed passcode. It opens it and holds the steward's whole identity. That converts *panel access for 12 h* into *the identity, permanently*. It is the escalation d.6 exists to prevent, arriving through the mechanism built to protect it. It is narrower than #1966 (the caller must already hold a valid session as that member, so this is not reachable by a stranger) — but it is still a privilege escalation, and it is the case Ben's ruling named when it said the capability must be **bound to that one sign-in**. Note too that the ruling said *"the AID is not an input at any point"*. The mint is properly random and not AID-derived — but the **delivery** is keyed by the OIDC subject, which is the AID. The AID became an input at the last hop. ## What to build Bind the stash to **the sign-in that armed it**, not to the identity: - key the pending capability by something only the completing session holds — the gate session minted from that exact code exchange, or a nonce written into that session at `/authz/signin` and required on the read; - a second, concurrent, or older session for the **same** member must read empty, exactly as a stranger does; - a fresh armed sign-in still supersedes an uncollected earlier capability (today's behaviour, keep it); - everything else #1967 landed stays: the mint gated on `armed && panel`, the userinfo carrier, one-shot `Take`, the 5-minute ceiling, and the resting-substrate empty answer. ## Acceptance criteria - [ ] **Given** an armed sign-in that stashed a capability, **when** a *different session of the same member* reads the route, **then** it receives nothing and the capability remains for the session that earned it. - [ ] **Given** the session that completed the armed sign-in, **when** it reads, **then** it receives the capability exactly once, as today. - [ ] **Given** a second armed sign-in by the same member, **then** it supersedes any uncollected capability (unchanged). - [ ] **Given** an unauthenticated caller or a different identity, **then** 401 / empty as today — no regression. - [ ] **Given** the tests, **then** the same-member-second-session case is explicit and is RED before the fix. ## Blocked by - None — #1967 has landed; this corrects its last hop. ## Notes Found reviewing #1967's close-report against the carrier hazard raised on that ticket before it was claimed (*"the carrier must not be an identity lookup"*). The agent moved delivery off `/me` as asked and built a dedicated route, which is right; the keying is the part that still resolves by identity.
Author
Member

swarm-claim host=bens-mac-04 run=35148
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=35148 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #1969 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1969,
  "status": "success",
  "commits": [
    "f60d942b86bac877f421df1437e4815b74f7c75e"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/controlapi/authgate.go",
    "internal/controlapi/panelepoch.go",
    "internal/controlapi/panelhandover.go",
    "internal/controlapi/panelhandover_internal_test.go",
    "internal/controlapi/panelhandover_test.go",
    "internal/controlapi/session.go",
    "internal/controlapi/signin.go",
    "internal/controlapi/signin_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/controlapi/",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/controlapi/",
      "exit_code": 0
    },
    {
      "command": "go build ./...",
      "exit_code": 0
    },
    {
      "command": "golangci-lint run ./internal/controlapi/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Given an armed sign-in that stashed a capability, when a different session of the same member reads, then it receives nothing and the capability remains for the session that earned it": "internal/controlapi/panelhandover_test.go TestPanelHandover_TurnsAwayASecondSessionOfTheSameMember + panelhandover_internal_test.go TestHandoverStore_BoundToTheArmingSignInNotTheIdentity — a mismatched binding reads empty and does not spend the entry (HandoverStore.Take in panelhandover.go)",
    "Given the session that completed the armed sign-in, when it reads, then it receives the capability exactly once": "internal/controlapi/panelhandover_test.go TestPanelHandover_ReadOnceByTheSignedInPanel — matching binding delivers once then empty",
    "Given a second armed sign-in by the same member, then it supersedes any uncollected capability (unchanged)": "internal/controlapi/panelhandover_internal_test.go TestHandoverStore_FreshSignInSupersedes — identity-keyed Put overwrites; the superseded session reads empty, the new session reads the new cap",
    "Given an unauthenticated caller or a different identity, then 401 / empty as today — no regression": "internal/controlapi/panelhandover_test.go TestPanelHandover_TurnsAwayTheUnauthenticatedAndOthers (401 + stranger empty) and TestPanelHandover_RestingSubstrateAnswersEmpty",
    "Given the tests, then the same-member-second-session case is explicit and is RED before the fix": "Demonstrated: temporarily removing the `p.binding != binding` guard in panelhandover.go turned TestHandoverStore_BoundToTheArmingSignInNotTheIdentity, TestPanelHandover_TurnsAwayASecondSessionOfTheSameMember and the callback's own stash assertion (TestAuthzSignin_StashesHandoverCapability) RED; restoring the guard turned them green"
  },
  "summary": "The panel-handover capability is now bound to the sign-in that armed it (its session's binding token), so a second/older session of the same member reads nothing while the earning session collects it once.",
  "blockers": []
}
**close-report** for #1969 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1969, "status": "success", "commits": [ "f60d942b86bac877f421df1437e4815b74f7c75e" ], "changed_files": [ "STATUS.md", "internal/controlapi/authgate.go", "internal/controlapi/panelepoch.go", "internal/controlapi/panelhandover.go", "internal/controlapi/panelhandover_internal_test.go", "internal/controlapi/panelhandover_test.go", "internal/controlapi/session.go", "internal/controlapi/signin.go", "internal/controlapi/signin_test.go" ], "tests": [ { "command": "go test ./internal/controlapi/", "exit_code": 0 }, { "command": "go vet ./internal/controlapi/", "exit_code": 0 }, { "command": "go build ./...", "exit_code": 0 }, { "command": "golangci-lint run ./internal/controlapi/", "exit_code": 0 } ], "criteria": { "Given an armed sign-in that stashed a capability, when a different session of the same member reads, then it receives nothing and the capability remains for the session that earned it": "internal/controlapi/panelhandover_test.go TestPanelHandover_TurnsAwayASecondSessionOfTheSameMember + panelhandover_internal_test.go TestHandoverStore_BoundToTheArmingSignInNotTheIdentity — a mismatched binding reads empty and does not spend the entry (HandoverStore.Take in panelhandover.go)", "Given the session that completed the armed sign-in, when it reads, then it receives the capability exactly once": "internal/controlapi/panelhandover_test.go TestPanelHandover_ReadOnceByTheSignedInPanel — matching binding delivers once then empty", "Given a second armed sign-in by the same member, then it supersedes any uncollected capability (unchanged)": "internal/controlapi/panelhandover_internal_test.go TestHandoverStore_FreshSignInSupersedes — identity-keyed Put overwrites; the superseded session reads empty, the new session reads the new cap", "Given an unauthenticated caller or a different identity, then 401 / empty as today — no regression": "internal/controlapi/panelhandover_test.go TestPanelHandover_TurnsAwayTheUnauthenticatedAndOthers (401 + stranger empty) and TestPanelHandover_RestingSubstrateAnswersEmpty", "Given the tests, then the same-member-second-session case is explicit and is RED before the fix": "Demonstrated: temporarily removing the `p.binding != binding` guard in panelhandover.go turned TestHandoverStore_BoundToTheArmingSignInNotTheIdentity, TestPanelHandover_TurnsAwayASecondSessionOfTheSameMember and the callback's own stash assertion (TestAuthzSignin_StashesHandoverCapability) RED; restoring the guard turned them green" }, "summary": "The panel-handover capability is now bound to the sign-in that armed it (its session's binding token), so a second/older session of the same member reads nothing while the earning session collects it once.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#1969
No description provided.