Add module API for redacting command arguments (#10425)

Add module API for redacting client commands
This commit is contained in:
Madelyn Olson
2022-03-15 18:21:13 -07:00
committed by GitHub
parent c30de7073c
commit 416c9ac2ef
5 changed files with 56 additions and 1 deletions
+16
View File
@@ -68,6 +68,22 @@ start_server {tags {"modules"}} {
assert_equal [r acl whoami] "default"
}
test {modules can redact arguments} {
r config set slowlog-log-slower-than 0
r slowlog reset
r auth.redact 1 2 3 4
r auth.redact 1 2 3
r config set slowlog-log-slower-than 10000
set slowlog_resp [r slowlog get]
# There will be 3 records, slowlog reset and the
# two auth redact calls.
assert_equal 3 [llength $slowlog_resp]
assert_equal {slowlog reset} [lindex [lindex [r slowlog get] 2] 3]
assert_equal {auth.redact 1 (redacted) 3 (redacted)} [lindex [lindex [r slowlog get] 1] 3]
assert_equal {auth.redact (redacted) 2 (redacted)} [lindex [lindex [r slowlog get] 0] 3]
}
test "Unload the module - testacl" {
assert_equal {OK} [r module unload testacl]
}