Skip to content

feat(auth): accept scoped acw_ keys on WebSocket (Factory#312) - #1496

Open
olafkfreund wants to merge 3 commits into
devfrom
feat/312-cockpit-scoped-keys
Open

olafkfreund wants to merge 3 commits into
devfrom
feat/312-cockpit-scoped-keys

Conversation

@olafkfreund

Copy link
Copy Markdown
Owner

Summary

Plan step 4. authenticate_websocket validates acw_ keys as REST does (authenticate plus api:full) and returns the same principal. Ownerless and under-scoped keys are closed with 4001. TFactory's feed has no org routing for any principal (#3679).

The callers are /ws/events and the rmux agent-console WS. The rmux console runs the same per-project viewer check as REST, and typing still needs POST /attach. verify_websocket_token (logs, progress, PTY terminal) is unchanged, so acw_ keys get no PTY access. The legacy wildcard path is unchanged. Without this, CFactory can't stop sending the wildcard on its live feed.

Artifacts (olafkfreund/Factory#3680): intent · spec · plan. User approved them unseen on 2026-11-07 (bulk run).

Part of a four-PR set. Each PR is safe to merge alone, and every new path stays off until it is configured. The cut-over needs all four deployed.

Who did what

  • Step 4: agy (handoff). After the final review (codex) the lead moved the lazy import and key checks inside the helper's try, so every failure closes with 4001.

Tests

pytest tests/test_ws_acw_auth.py tests/rmux/test_bridge.py: 19 passed. ruff is clean.

Refs olafkfreund/Factory#312 · follow-up olafkfreund/Factory#3679

🤖 Generated with Claude Code

https://claude.ai/code/session_01WtDyDqabJ8SR4gD3ubwYx1

olafkfreund and others added 2 commits November 7, 2026 15:13
Plan step 4 of olafkfreund/Factory plan/2026-11-07-312-cockpit-scoped-keys.md
(implemented by agy). authenticate_websocket validates acw_ keys the way the
REST middleware does (authenticate + api:full) and returns the same
principal, so /ws/events and the rmux console see the key as REST does.
Ownerless and under-scoped keys are closed with 4001.

Refs olafkfreund/Factory#312

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WtDyDqabJ8SR4gD3ubwYx1
…ctory#312)

Final-review fix (codex finding), plan steps 1/4 of olafkfreund/Factory plan/2026-11-07-312-cockpit-scoped-keys.md.

Refs olafkfreund/Factory#312

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WtDyDqabJ8SR4gD3ubwYx1
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

TFactory coverage

54.95% on this PR vs 54.82% on its base (+0.13 pts).

PASS - Coverage 54.95% (up 0.13 pts from 54.82%)

Measured by the TFactory coverage gate on both the PR head and its base.

…ry#312)

CI ratchet fix for plan step 4 of olafkfreund/Factory
plan/2026-11-07-312-cockpit-scoped-keys.md. _ws_acw_principal added a lazy
import (PLC0415), a blind except (BLE001) and a bare dict return type. The
lazy import mirrors the REST path and the catch-all is the approved WS
policy (any validator failure denies), so both carry reasoned noqa; the
return type gets its arguments. scripts/ratchet_lint.py now passes.

Refs olafkfreund/Factory#312

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WtDyDqabJ8SR4gD3ubwYx1

This branch has not been deployed

No deployments
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