Skip to content

feat(security): attenuate positron AI observers — confused-deputy clamp - #1733

Merged
joelteply merged 1 commit into
canaryfrom
feat/positron-observer-attenuation
Jul 3, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/positron-observer-attenuation

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

What

A positron session multiplexes two principals over one socket: the human at the surface, and any AI observer that PERCEIVES that surface and acts back through a CommandEnvelope. They must not share authority.

Before this, ExecutorDispatch discarded envelope.source and minted a fixed CallerIdentity::ws(nil) for both — so the instant socket auth exists, an AI observing a human's screen would ride the human's authority up. That is the confused-deputy escalation (the Instagram-hack shape) positron exists to prevent.

The fix (source-side, load-bearing)

  • auth_policy.rs — new CallerSource::PositronObserver { observer_id } + CallerIdentity::positron_observer constructor. Empty granted_capabilities — the tier clamp IS the attenuation; that field is only ever for owner-signed escalation grants, never a deny-list. observer_id is audit-only, never affects the ceiling.
  • grid_trust_policy.rs — both source→trust maps gain a PositronObserver arm. The divergence from Ws lives in resolve_trust: the observer is clamped at a FIXED Provisional that NEVER consults the trust bridge, so it cannot rise when the same peer_id is registered Owner. Today both Ws and observer are plain Provisional; the moment socket auth elevates the human's Ws socket, the observer stays put — the divergence is structural and activates automatically.
  • positron_dispatch.rs — ExecutorDispatch now branches on envelope.source via a pure, total caller_for_source() helper: Human → ws(nil) (unchanged), Observer → positron_observer(nil, id). Isolated as a pure mapping so the security decision is unit-tested without an executor.

The observer keeps the full AiSafe surface (perceive + ai/generate) — it is capped, not muted. Realizes "ceiling strictly below the human's" without overclaiming a strictly-lower-today number.

Tests (one per touched file, each with // what this catches:)

  • positron_observer_carries_its_observer_id_and_no_grants — constructor keeps the id, no grants.
  • positron_observer_never_rides_the_human_socket_authority_up — THE clamp: same Owner-registered peer_id → Ws allowed code/shell, observer forbidden (bridge ignored); observer still allowed ai/generate.
  • observer_and_human_sources_map_to_distinct_attenuated_identities — dispatch maps the two sources to distinct identities.

Validation

cargo check clean + all 3 tests green (--features metal,accelerate). Pre-existing warnings only; no new ones from this change.

🤖 Generated with Claude Code

A positron session multiplexes two principals over ONE socket: the human at
the surface, and any AI observer that PERCEIVES that surface and acts back
through a CommandEnvelope. They must not share authority. Before this, the
dispatch bridge (ExecutorDispatch) discarded envelope.source and minted a
fixed ws(nil) identity for BOTH — so the instant socket auth exists, an AI
observing a human's screen would ride the human's authority up. That is the
confused-deputy escalation (Instagram-hack shape) positron exists to prevent.

Fix, source-side and load-bearing:

- New CallerSource::PositronObserver { observer_id } + CallerIdentity::
  positron_observer constructor (auth_policy.rs). Empty granted_capabilities —
  the tier clamp IS the attenuation; that field is only ever for owner-signed
  escalation grants, never a deny-list.
- Both source→trust maps in grid_trust_policy.rs gain a PositronObserver arm.
  The divergence from Ws lives in resolve_trust: the observer is clamped at a
  FIXED Provisional that NEVER consults the trust bridge, so it cannot rise
  when the same peer_id is registered Owner. caller_trust gives it the same
  AiSafe ceiling statically. Today both are plain Provisional; the moment
  socket auth elevates the human's Ws socket, the observer stays put.
- ExecutorDispatch now branches on envelope.source via a pure, total
  caller_for_source() helper: Human → ws(nil) (unchanged), Observer →
  positron_observer(nil, id). Isolated as a pure mapping so the security
  decision is unit-tested without an executor.

The observer keeps the full AiSafe surface (perceive + ai/generate) — it is
capped, not muted. Realizes "ceiling strictly below the human's" without
overclaiming a strictly-lower-today number.

Tracked precondition (task #29, documented in both files, not asserted away):
the PositronObserver *identity* is locally minted, but WHICH identity is
minted is selected by the positron envelope's client-declared `source` field.
The clamp presumes an HONEST source — a compromised observer self-labeling
`source: Human` would be minted Ws. Harmless today (Ws == Provisional); the
clamp is only COMPLETE once the same GH-auth handshake that raises the Ws
ceiling also authenticates the positron principal. Doc corrected from an
inaccurate "unforgeable over the wire" claim per spawned security review.

Tests (one per touched file, each with // what this catches:):
- positron_observer_carries_its_observer_id_and_no_grants (constructor)
- positron_observer_never_rides_the_human_socket_authority_up (THE clamp:
  same Owner-registered peer_id → Ws allowed code/shell, observer forbidden,
  bridge ignored; observer still allowed ai/generate)
- observer_and_human_sources_map_to_distinct_attenuated_identities (dispatch)

Validated: cargo check + the 3 tests green (metal,accelerate).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the feat/positron-observer-attenuation branch from f12a49a to 66b4900 Compare July 3, 2026 04:42
@joelteply

Copy link
Copy Markdown
Contributor Author

Spawned security review: APPROVE-WITH-NITS — no critical findings in the three edited files.

Confirmed by the reviewer:

  • Both trust maps handle PositronObserver; resolve_trust's observer arm is a fixed Provisional with no trust_of() call (the clamp is correct).
  • caller_for_source is a total match (no _ wildcard); CommandSource is not #[non_exhaustive], so a future variant fails closed at compile time.
  • No sibling ingress builds a positron-derived CallerIdentity — positron commands route exclusively through run_session → ExecutorDispatch → caller_for_source. The other ws(nil) site (ws.rs RPC frame) has no source field and can't carry Observer.
  • granted_capabilities empty cannot grant (gate consumes it as an allow-list add).
  • Tests non-tautological, one mod per file, each with // what this catches:. Compiles clean.

Nit addressed (pushed): my doc claimed the observer source was "unforgeable over the wire." That was inaccurate — the PositronObserver identity is locally minted, but WHICH identity is minted is selected by the positron envelope's client-declared source field. Reworded to state the clamp presumes an honest source, and added a TODO(task #29) in resolve_trust noting the same GH-auth handshake that raises the Ws ceiling must also authenticate the positron principal (else a compromised observer self-labels source: Human). Harmless today (Ws == Provisional); load-bearing the instant socket auth lands.

Merging to canary (staging).

@joelteply
joelteply merged commit 539dab2 into canary Jul 3, 2026
2 checks passed
@joelteply
joelteply deleted the feat/positron-observer-attenuation branch July 3, 2026 04:42
@github-actions github-actions Bot added size: L and removed size: M labels Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant