mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-09-20 07:17:09 +09:00
Security: Fix user impersonation via custom bot token
If bot_key has no right-hand side (ex: 1-), bot_token will be nil, and the query will match a User record if bot_id matches a valid ID. Fix it relying on `active_bots` instead.
This commit is contained in:
@@ -19,7 +19,7 @@ module User::Bot
|
||||
|
||||
def authenticate_bot(bot_key)
|
||||
bot_id, bot_token = bot_key.split("-")
|
||||
active.find_by(id: bot_id, bot_token: bot_token)
|
||||
active_bots.find_by(id: bot_id, bot_token: bot_token)
|
||||
end
|
||||
|
||||
def generate_bot_token
|
||||
|
||||
Reference in New Issue
Block a user