Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject duplicate usernames #34

Merged
merged 7 commits into from
Aug 20, 2021
Merged

Reject duplicate usernames #34

merged 7 commits into from
Aug 20, 2021

Conversation

georgefst
Copy link
Owner

We can't merge this right now since we don't always/ever fire onDroppedConnection due to these issues:

Thus we don't actually delete from the set of active users, and therefore if a user tries to reconnect, they'll be rejected as the username will appear to be a duplicate.

Also note that the set is essentially unused in serverExtWs (even though we initialise it with users <- newMVar Set.empty since it's never added to. Perhaps we can refactor.

@georgefst
Copy link
Owner Author

This will need rebasing after 957ff5e, to become part of validateUsername.

I guess this case is just slightly too complex for HLint.
Old version is broken because we try to modify the set of users twice. The second time, when opening the websocket, we fail because it's already in the set. So we change our approach to avoid any awkward concurrency issues.

We go beyond the original purpose of this PR in that we also defend against differences between the WS and HTTP username params. e.g. if a user modifies the served JS.
Matches `state` and STM stuff. MVars are the outlier.
@georgefst georgefst marked this pull request as ready for review August 20, 2021 14:01
@georgefst georgefst merged commit d846105 into master Aug 20, 2021
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