Skip to content

Require authentication for WebSocket, send record events only to users who can view the record - #217

Merged
SteRiccio merged 5 commits into
masterfrom
fix/websocket-auth
Nov 10, 2026
Merged

SteRiccio merged 5 commits into
masterfrom
fix/websocket-auth

Conversation

@SteRiccio

@SteRiccio SteRiccio commented Nov 10, 2026 •

Copy link
Copy Markdown
Member
  • /ws/** required no authentication: it now requires a logged user (dev mode keeps the unauthenticated localhost access, like /api/**).
  • Record update events (with the entered values) were broadcast to every connected client, including anonymous ones and users without access to the survey. They are now sent, through the STOMP user destination /user/events, to every connected user who can view the record: admins, members of the survey user group (or its child groups), and for limited users (ENTRY_LIMITED, DATA_CLEANER_LIMITED) only their own records. So other users viewing or editing the same record still get its updates.
  • Errors (with stack traces) and events of preview records go only to the user issuing the command.
  • In dev mode (no login) events are still broadcast.
  • The simple broker is limited to the /events prefix. Without a prefix it also registered the /user/events subscription under the same subscription id, racing with the user destination handler, so user messages were sometimes lost.

Checked in a running instance: while admin edits a record, a user in the survey group receives the updates and a user outside it receives nothing; record editing receives its events also right after a server restart; anonymous /ws/info redirects to the login page.

…heir user

The /ws endpoint was open to anonymous clients and record update events
(including entered values and error stack traces) were broadcast to
every connected client. Record events are now sent to the user who
issued the command through a user destination; in development mode
(no login) they are still broadcast.
@SteRiccio SteRiccio self-assigned this Nov 10, 2026
Other users viewing or editing the same record (or the records list)
need its updates too; only users without access to the record (e.g. not
in the survey user group, or limited users for others' records) are
excluded. Errors and preview record events still go only to the user
issuing the command.
@SteRiccio SteRiccio changed the title Require authentication for WebSocket, send record events only to their user Require authentication for WebSocket, send record events only to users who can view the record Nov 10, 2026
@sonarqubecloud

Copy link
Copy Markdown

@SteRiccio
SteRiccio merged commit ac68349 into master Nov 10, 2026
3 checks passed
@SteRiccio
SteRiccio deleted the fix/websocket-auth branch November 10, 2026 13:37
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