summaryrefslogtreecommitdiff
path: root/tests/support
diff options
context:
space:
mode:
authorMadelyn Olson <34459052+madolson@users.noreply.github.com>2022-04-26 02:09:21 -0700
committerGitHub <noreply@github.com>2022-04-26 12:09:21 +0300
commitefcd1bf394668e418df1a93cd28cf9e8b0c09ce5 (patch)
treeaf0d61b1e939aeccd52b6797b01614d91176a128 /tests/support
parent79ffc3524dc3d1222685cacc236f417d09459bae (diff)
downloadredis-efcd1bf394668e418df1a93cd28cf9e8b0c09ce5.tar.gz
By default prevent cross slot operations in functions and scripts with # (#10615)
Adds the `allow-cross-slot-keys` flag to Eval scripts and Functions to allow scripts to access keys from multiple slots. The default behavior is now that they are not allowed to do that (unlike before). This is a breaking change for 7.0 release candidates (to be part of 7.0.0), but not for previous redis releases since EVAL without shebang isn't doing this check. Note that the check is done on both the keys declared by the EVAL / FCALL command arguments, and also the ones used by the script when making a `redis.call`. A note about the implementation, there seems to have been some confusion about allowing access to non local keys. I thought I missed something in our wider conversation, but Redis scripts do block access to non-local keys. So the issue was just about cross slots being accessed.
Diffstat (limited to 'tests/support')
-rw-r--r--tests/support/util.tcl6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/support/util.tcl b/tests/support/util.tcl
index a7972a854..6741b719a 100644
--- a/tests/support/util.tcl
+++ b/tests/support/util.tcl
@@ -77,6 +77,12 @@ proc getInfoProperty {infostr property} {
}
}
+proc cluster_info {r field} {
+ if {[regexp "^$field:(.*?)\r\n" [$r cluster info] _ value]} {
+ set _ $value
+ }
+}
+
# Return value for INFO property
proc status {r property} {
set _ [getInfoProperty [{*}$r info] $property]