fix(ws): gate the identity sent in connection_init

The upgrade request passed the ban and rate-limit checks on its own headers. The backend then acted as the identity in the connection_init payload. A banned user could connect without credentials and send their token in the payload. The proxy now runs the same checks on the payload identity.
This commit is contained in:
2026-11-03 00:34:18 +00:00
parent 6e7e2ecfae
commit 4c5d01aef3
4 changed files with 103 additions and 3 deletions
+6 -1
View File
@@ -143,8 +143,13 @@ func periodicallyReloadBannedUsers(ctx context.Context) {
}
}
func checkIfUserIsBanned(c fiber.Ctx, userID string) bool {
func isUserBanned(userID string) bool {
_, found := bannedUsersIDs.Load(userID)
return found
}
func checkIfUserIsBanned(c fiber.Ctx, userID string) bool {
found := isUserBanned(userID)
cfg.Logger.Debug(&libpack_logger.LogMessage{
Message: "Checking if user is banned",