Repository navigation
fix(auth): /ws/events applies the account-state check the other doors apply (trinity-enterprise#858) - #3837
Merged
Conversation
… apply (trinity-enterprise#858) /ws/events authenticates its MCP key itself and never runs get_current_user, so each check that function makes has to be repeated in the handler. The #995 deactivation check was the one missing; it now reads the owner row the handler resolves, before accept(), and closes the same way as an inactive key. Mutation: removing the guard turns both placement tests red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vybe
approved these changes
Oct 20, 2026
vybe
left a comment
Contributor
There was a problem hiding this comment.
merge-train: validated at 407934e (lane C). Suspended-owner refusal matches get_current_user and /ws, no legitimate principal newly refused. Follow-ups (non-blocking): the placement tests are source-text — a TestClient handshake test like test_ent872_fleet_reach.py:535 would pin behaviour; an already-open socket is not cut on suspension (same as /ws).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/ws/events(Trinity Connect) authenticates its MCP key itself and never runsget_current_user, so every check that function makes has to be repeated in the handler. This adds the one that was missing: the #995 account-state check, whichget_current_userand/wsalready apply.dependencies.owner_is_suspended(owner_row)is called on the owner row the handler already resolves, beforeaccept().Changes
src/backend/dependencies.py:owner_is_suspended.src/backend/main.py: the guard inwebsocket_events_endpoint.tests/unit/test_ent858_event_stream_owner_state.py, plus itstests/registry.jsonentry.Test Plan
cd tests && pytest unit/test_ent858_event_stream_owner_state.py: 8 pass. The owner check runs for real against a table of cases. The handler's placement is checked by reading its code, becausemain.pycan't be imported in the unit tests; ent#837's owner floor is tested the same way.test_837_workspace_only_floor,test_2323_machine_identities,test_ent872_fleet_reach,test_ent467_ws_agent_scope.Fixes abilityai/trinity-enterprise#858
🤖 Generated with Claude Code