Skip to content

fix(gateway): a Meta-Edge SSO login is not a mesh operator (BLOCKER-B, write half)#98

Open
darw007d wants to merge 1 commit into
mainfrom
fix/meta-edge-operator-factory
Open

fix(gateway): a Meta-Edge SSO login is not a mesh operator (BLOCKER-B, write half)#98
darw007d wants to merge 1 commit into
mainfrom
fix/meta-edge-operator-factory

Conversation

@darw007d

Copy link
Copy Markdown
Collaborator

What

The shipped _is_operator was return auth.peer is None. Both a verified SSO identity context (kind='user_identity') and a cell-join key (kind='cell_join') carry peer=None — only the genuine shared/commander token has peer=None and kind=None. So the moment the Meta-Edge verifier goes live, every OAuth login resolves to a full operator: a stranger completing "Sign in with GitHub" gets a valid RS256 identity JWT and passes every _is_operator gate (announce/reserved channel create, service/lane/fleet control, context push). An OAuth-driven operator factory. The cell-join context had the identical hole.

Fix: operator == peer is None AND kind is None. A Meta-Edge context is owner-scoped, never operator.

Why it's safe to land now (and why it must land with the migration)

Not live-exploitable today: the deployed :8788 (mesh-gateway) has no Meta-Edge code path yet (the verifier lives only in this swarph-cli bundle — the two gateways have diverged). No user_identity token is accepted in production. This fix must land in the same change that migrates/ports the verifier onto :8788 — wiring the verifier without it opens the factory.

Tests (TDD — watched RED first)

  • unit: _is_operator True only for the shared token; False for user_identity, cell_join, and per-peer cells.
  • wiring: a user_identity token is 403'd at the announce-channel route (a committed catch, not just a helper assertion); the shared token still 200s.
  • Full suite: 989 passed, 5 skipped.

⚠️ STILL OPEN — read half of BLOCKER-B (NOT in this PR; gates the migration)

GET /messages applies ?to=/?from= from query params with no caller scoping, so a user_identity can read arbitrary DMs. Scoping it correctly requires resolving how a sub maps to the node-names it owns (the from_node:"commander" caller-binding reconciliation — see the SSO plan's STILL-OPEN #3). The migration must not activate the verifier on live :8788 until the read half closes too.

🤖 Generated with Claude Code

…, write half)

The shipped _is_operator was `return auth.peer is None`. Both a verified SSO
identity context (kind='user_identity') and a cell-join key (kind='cell_join')
carry peer=None — only the genuine shared/commander token has peer=None AND
kind=None. So once the Meta-Edge verifier is live, every OAuth login resolved
to a full operator: a stranger completing "Sign in with GitHub" would get a
valid RS256 identity JWT and pass every _is_operator gate (announce/reserved
channel create, service/lane/fleet control, context push) — an OAuth-driven
operator factory. The cell-join context had the same hole.

Close it precisely: operator == peer is None AND kind is None. A Meta-Edge
context (user_identity or cell_join) is owner-scoped, never operator.

Not live-exploitable today: the deployed :8788 (mesh-gateway) has no Meta-Edge
code path yet (see the two-gateways divergence), so no user_identity token is
accepted. This must land in the SAME change that ports/migrates the verifier
onto :8788 — wiring the verifier without this fix opens the factory.

Tests (TDD, watched RED first):
- unit: _is_operator True only for the shared token; False for user_identity,
  cell_join, and per-peer cells.
- wiring: a user_identity token is 403'd at the announce-channel route
  (committed catch, not just a helper assertion); shared token still 200s.
Full suite: 989 passed, 5 skipped.

STILL OPEN (read half of BLOCKER-B, gates the migration — NOT in this PR):
GET /messages applies ?to=/?from= from query params with no caller scoping, so
a user_identity can read arbitrary DMs. Scoping it correctly requires resolving
how a `sub` maps to the node-names it owns (the from_node:"commander" caller-
binding reconciliation, plan STILL-OPEN #3). The migration must not activate
the verifier on live :8788 until the read half closes too.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPQFrDwKBxzSSbopNLa2L8
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