diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 4c2b28f4a7c..ba5b42123e4 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -615,3 +615,7 @@ default = 5 min_val = 0 integer = TRUE + +/datum/config_entry/flag/forbid_all_profiling + +/datum/config_entry/flag/forbid_admin_profiling diff --git a/code/game/world.dm b/code/game/world.dm index 2216a23d675..815d5cf48be 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -379,5 +379,9 @@ GLOBAL_VAR(restart_counter) /world/proc/on_tickrate_change() SStimer?.reset_buckets() +/world/Profile(command, type, format) + if((command & PROFILE_STOP) || !global.config?.loaded || !CONFIG_GET(flag/forbid_all_profiling)) + . = ..() + #undef OVERRIDE_LOG_DIRECTORY_PARAMETER #undef NO_INIT_PARAMETER diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm index a8172670a0a..d4ed28bda79 100644 --- a/code/modules/admin/holder2.dm +++ b/code/modules/admin/holder2.dm @@ -62,8 +62,9 @@ GLOBAL_PROTECT(href_token) rank = R admin_signature = "Nanotrasen Officer #[rand(0,9)][rand(0,9)][rand(0,9)]" href_token = GenerateToken() - if(R.rights & R_DEBUG) //grant profile access - world.SetConfig("APP/admin", ckey, "role=admin") + if(!CONFIG_GET(flag/forbid_admin_profiling)) + if(R.rights & R_DEBUG) //grant profile access, assuming admin profile access is enabled + world.SetConfig("APP/admin", ckey, "role=admin") //only admins with +ADMIN start admined if(protected) GLOB.protected_admins[target] = src diff --git a/config/config.txt b/config/config.txt index 0a3bd24a56f..bc010e3a77e 100644 --- a/config/config.txt +++ b/config/config.txt @@ -602,3 +602,9 @@ CACHE_ASSETS 0 ## The number of PR announcements allowed for the same pull request per round ## This makes sure that somebody can only spam a few reopens and closes before being ignored PR_ANNOUNCEMENTS_PER_ROUND 5 + +## Uncomment to block all attempts to profile, for performance reasons +#FORBID_ALL_PROFILING + +## Uncomment to block granting profiling privileges to users with R_DEBUG, for performance purposes +#FORBID_ADMIN_PROFILING