Repository navigation
Require authentication for WebSocket, send record events only to users who can view the record - #217
Merged
Merged
Conversation
…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.
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.
|
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.



/ws/**required no authentication: it now requires a logged user (dev mode keeps the unauthenticated localhost access, like/api/**)./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./eventsprefix. Without a prefix it also registered the/user/eventssubscription 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/inforedirects to the login page.