security: notifications: fix irc command injection
This commit is contained in:
parent
8c93d4da9a
commit
59a6faa1a3
1 changed files with 6 additions and 8 deletions
|
@ -26,14 +26,12 @@ local CheckNotifications = function()
|
|||
end
|
||||
local Notification = json.decode.decode(Data)
|
||||
local Line = ""
|
||||
if Notification['Notice'] ~= nil then
|
||||
Line = "NOTICE " .. Notification['Receiver'] .. " :" .. Notification['Message']
|
||||
else
|
||||
Line = "PRIVMSG " .. Notification['Receiver'] .. " :" .. Notification['Message']
|
||||
end
|
||||
print("Sending notification: " .. Line)
|
||||
irc:_Send(Line)
|
||||
|
||||
if Notification['Notice'] ~= nil then
|
||||
irc:Notice(Notification['Receiver'], Notification['Message'])
|
||||
else
|
||||
irc:Say(Notification['Receiver'], Notification['Message'])
|
||||
end
|
||||
Redis:lrem('notifications:processing', -1, Data)
|
||||
end
|
||||
Redis:quit()
|
||||
|
@ -48,7 +46,7 @@ plugin.AddHook('ReactorTick', 'notifications', function()
|
|||
if irc == nil then
|
||||
return
|
||||
end
|
||||
if LastGlobalChecked + 5 < os.time() then
|
||||
if LastGlobalChecked + 1 < os.time() then
|
||||
LastGlobalChecked = os.time()
|
||||
pcall(function()
|
||||
CheckNotifications(irc)
|
||||
|
|
Loading…
Reference in a new issue