mirror of
https://github.com/KabKebab/GS13.git
synced 2026-08-21 20:16:18 +01:00
security fix
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#define RESTART_COUNTER_PATH "data/round_counter.txt"
|
||||
#define TOPIC_LENGTH_LIMIT 8192 //The reason why this is so large is to allow TGS topic calls to function without issue.
|
||||
#define TOPIC_COOLDOWN 1 //90% sure there isnt anything that does multiple topic calls in a single decisecond.
|
||||
|
||||
GLOBAL_VAR(restart_counter)
|
||||
|
||||
@@ -140,6 +142,25 @@ GLOBAL_VAR(restart_counter)
|
||||
log_runtime(GLOB.revdata.get_log_message())
|
||||
|
||||
/world/Topic(T, addr, master, key)
|
||||
var/static/list/bannedsourceaddrs = list()
|
||||
var/static/list/lasttimeaddr = list()
|
||||
|
||||
if(addr in bannedsourceaddrs)
|
||||
return
|
||||
|
||||
if(length(T) >= TOPIC_LENGTH_LIMIT)
|
||||
log_topic("Oversized topic, banning address. from:[addr]")
|
||||
bannedsourceaddrs |= addr
|
||||
return
|
||||
|
||||
if(addr in lasttimeaddr && world.time < (lasttimeaddr["[addr]"] + TOPIC_COOLDOWN))
|
||||
log_topic("Too many topic calls from address in [TOPIC_COOLDOWN] ds, banning address. from:[addr]")
|
||||
bannedsourceaddrs |= addr
|
||||
return
|
||||
|
||||
lasttimeaddr["[addr]"] = world.time
|
||||
|
||||
|
||||
TGS_TOPIC //redirect to server tools if necessary
|
||||
|
||||
var/static/list/topic_handlers = TopicHandlers()
|
||||
|
||||
Reference in New Issue
Block a user