mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 23:24:52 +09:00
Terminate control connections of deleted users
ControlConnection keeps the User object it authenticated with and checks
permissions against it. Deleting the user removed the record but left
its sessions open, so a deleted user kept all its permissions until the
WebSocket closed.
Repro: create "victim" with role 0 and connect as it. Another admin
sends UserDeleteRequest("victim"). Victim can still send
UserCreateRequest("mallory") and UserUpdateRolesRequest("mallory", [0]).
Terminate the deleted user's connections like revoke-token does. When
a user deletes itself, defer terminating the requesting connection so
the response is sent first.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5b63fd27fe
commit
fb71ee7282
2 files changed
+65
-1
No files matched your search
@@ -1070,6 +1070,17 @@ export default class ControlConnection extends BaseConnection {
|
||||
}
|
||||
|
||||
this._controller.users.deleteUser(user);
|
||||
for (let controlConnection of this._controller.wsServer.controlConnections.values()) {
|
||||
if (controlConnection.user.id !== user.id) {
|
||||
continue;
|
||||
}
|
||||
if (controlConnection === this) {
|
||||
// Let the response go out before dropping our own session
|
||||
setImmediate(() => controlConnection.connector.terminate());
|
||||
} else {
|
||||
controlConnection.connector.terminate();
|
||||
}
|
||||
}
|
||||
|
||||
if (user.isAdmin) {
|
||||
this._controller.sendTo("allInstances", new lib.InstanceAdminlistUpdateEvent(name, false));
|
||||
|
||||
Reference in new issue
Block a user