6.4 KiB
WI-1 lease broker security notes
- Trusted identity comes only from Linux
SO_PEERCREDplus/procstarttime, never request identity fields. - Descendant authorization is anchored to
(pid,starttime)and uses a complete second starttime pass to fail closed on disappearance or PID-reuse races. - Runtime generations are monotonic per anchor; a bump revokes prior-incarnation tokens before persistence commits. WI-3 stores the live generation in an owner-only locked file so same-PID Pi reload/new/resume/fork and Claude resume/clear transitions cannot inherit a VERIFIED lease.
- Session IDs and cycle tokens use the OS cryptographic RNG.
Math.randomand model output are not token sources. - Framing and persistence failures fail closed. Sensitive tokens are not logged.
- Built-in
0700/0600filesystem modes provide same-principal hardening only, not socket authenticity against the same UID. WI-1 provides no distinct-principal isolation. That stronger deployment requires an external protected proxy, ACL, or service boundary, and the boundary must preserve authenticated client identity for the broker'sSO_PEERCREDand ancestry authorization rather than substituting a shared proxy identity. - WI-2 whole-class authorization denies every consequential, unknown, and custom tool while UNVERIFIED; it does not inspect shell strings or trust wrapper selection. First-class Claude/Pi, both Claudex dispatch modes, PRDY, QA remediation, coord, orchestrator, and fleet starts converge on broker register-before-exec; Claudex additionally installs the mandatory all-tools hook inside its preserved isolated config and fails closed on unsafe settings.
- The permanent
check-runtime-launches.pysuite/CI guard scans production source for direct literal, absolute-path, process-API, command-array, and dynamic Claude/Pi launches. It has no bypass allowlist: an unrecognized launch form fails CI until routed through the common boundary. - WI-2 promotion consumes a WI-1 cycle token before VERIFIED becomes visible. Observer revocation, runtime-generation replacement, broker restart, and monotonic TTL expiry remove authority.
- WI-3 wires redundant Claude
PreCompact/SessionStart(compact)and Pisession_before_compact/post-session_compactcontextobservers to that same revoke action. If broker confirmation fails after an observer fires, the revoker advances the private generation as a local fence; subsequent authorization revokes the stale broker incarnation before any consequential allow. - Dual observer absence while a lease remains live is the named bounded residual stale window: consequential tools remain allowed until monotonic expiry, with no claimed within-window action bound. After expiry they are denied. Total observer-plus-gate absence remains T-C.
- Receipt observation, payload construction, and constrained recovery implementation remain later surfaces. A receipt can become a promotion prerequisite but is never the safety mechanism.
Named residual: promote-lease-lost-ACK (WI-3 D2-v5)
A valid promote_lease can leave a session VERIFIED in the broker while the client never learns of it. This is a named, bounded D2-v5 T-A residual — an authority-observability divergence, not an authority divergence, not an ALLOW-risk, and not a retry double-apply. It is disclosed here, not laundered.
Window — where it can occur. The broker commits token consumption and durable VERIFIED state before the success reply becomes visible (see the promotion order in lease-broker-protocol.md). The residual is confined to the interval after that commit+fsync when the broker→client reply or peer-ACK is lost — for example an extreme-contention send failure or peer disconnect after handle() has already mutated and persisted state (the #838 fail-closed transport path). The lease mutation is already durable broker-side; only the acknowledgement to the client is lost. No uncommitted or partially-applied state is involved: the commit either happened (and is authoritative) or it did not (and no lease exists).
Fail-safe direction — the client can only under-claim. Broker intent is the ceiling; client authority is always ≤ broker intent, never more. Client-side authority-belief is granted only by a received acknowledgement; a lost acknowledgement conveys nothing, so the client cannot conclude "verified" and continues to treat itself as UNVERIFIED (it re-verifies or recovers). If the client retries promote_lease with the same token, the token is already consumed and the broker rejects the retry (PROMOTION_TOKEN_MISMATCH / INVALID_LEASE_TRANSITION); there is no double-apply. The committed VERIFIED state the broker holds is authority the lease legitimately earned from a real promotion — the broker authorizing consequential tools under it is correct, not inflation. Divergence is therefore strictly toward less client authority than the broker granted; it never produces authority the broker did not grant.
Bound — TTL plus the observer/gen-bump revoke backstop, self-healing. The orphaned VERIFIED lease is indistinguishable to the broker from any other legitimately verified lease, so the identical D2-v5 revocation backstops dispose of it: any compaction observer (PreCompact / SessionStart(compact) for Claude; session_before_compact / post-session_compact context for Pi), any same-PID runtime-generation bump (reload/new/resume/fork), broker restart, or monotonic-time expiry returns the session to UNVERIFIED. Monotonic TTL expiry (capped at 300 seconds) is unconditional — it requires no observer at all — so the maximum exposure of the orphaned lease is one TTL, ≤ 300 s, after which the next consequential tool is denied with LEASE_EXPIRED. Any observer that fires shortens the window further. The residual self-heals: "≥1 observer fires OR expiry ⇒ revoke" catches the lost-ACK lease on the same terms as every other stale lease. As with the dual-observer-miss stale window, WI-3 makes no claim that the mutator gate bounds actions inside the residual interval; the interval is bounded by TTL and the revoke backstop, and the server-side branch-protection / required-CI / independent-review line remains the irreducible backstop for protected-repository mutations.
Coordinator security review must rerun the real socket/peercred and mutator-gate acceptance suites on an unrestricted Linux runner and obtain the mandated independent Opus-SECREV review before integration.