VV tweaks + security fix (#17571)

This commit is contained in:
AffectedArc07
2022-04-05 14:42:07 +01:00
committed by GitHub
parent a81aa191f9
commit 8a19017e69
3 changed files with 39 additions and 1 deletions
+4
View File
@@ -7,6 +7,10 @@
if(!check_rights(R_VAREDIT)) return
// Make sure we can actually edit this var
if(!vv_varname_lockcheck(var_name))
return FALSE
if(A && A.type)
if(typesof(A.type))
switch(input("Strict object type detection?") as null|anything in list("Strictly this type","This type and subtypes", "Cancel"))
+16 -1
View File
@@ -1,7 +1,17 @@
GLOBAL_LIST_INIT(VVlocked, list("vars", "var_edited", "client", "firemut", "ishulk", "telekinesis", "xray", "ka", "virus", "viruses", "cuffed", "last_eaten", "unlock_content")) // R_DEBUG
GLOBAL_LIST_INIT(VVlocked, list("client", "firemut", "ishulk", "telekinesis", "xray", "ka", "virus", "viruses", "cuffed", "last_eaten", "unlock_content")) // R_DEBUG
GLOBAL_LIST_INIT(VVicon_edit_lock, list("icon", "icon_state", "overlays", "underlays", "resize")) // R_EVENT | R_DEBUG
GLOBAL_LIST_INIT(VVckey_edit, list("key", "ckey")) // R_EVENT | R_DEBUG
GLOBAL_LIST_INIT(VVpixelmovement, list("step_x", "step_y", "step_size", "bound_height", "bound_width", "bound_x", "bound_y")) // R_DEBUG + warning
// Stuff that can break the server in weird ways and shouldnt be messed with unless you actually know what you are doing
GLOBAL_LIST_INIT(VVmaint_only, list("vars", "var_edited", "contents"))
// Protect ALL these
GLOBAL_PROTECT(VVlocked)
GLOBAL_PROTECT(VVicon_edit_lock)
GLOBAL_PROTECT(VVckey_edit)
GLOBAL_PROTECT(VVpixelmovement)
GLOBAL_PROTECT(VVmaint_only)
/client/proc/vv_get_class(var_value)
if(isnull(var_value))
. = VV_NULL
@@ -532,6 +542,11 @@ GLOBAL_LIST_INIT(VVpixelmovement, list("step_x", "step_y", "step_size", "bound_h
var/prompt = alert(usr, "Editing this var may irreparably break tile gliding for the rest of the round. THIS CAN'T BE UNDONE", "DANGER", "ABORT ", "Continue", " ABORT")
if(prompt != "Continue")
return FALSE
if(param_var_name in GLOB.VVmaint_only)
if(!is_maintainer(usr))
alert(usr, "Editing this variable is restricted to Maintainers only.", "Error", "Ok")
return FALSE
return TRUE
/client/proc/modify_variables(atom/O, param_var_name = null, autodetect_class = 0)