From 9d16bd6f6e529a9db2076a3ab86779be224ca1ba Mon Sep 17 00:00:00 2001 From: Kostas Kyrimis Date: Fri, 26 Jul 2024 09:27:29 +0300 Subject: [PATCH] fix(acl): remove none from acl categories (#3392) None does not exist in Valkey and its entry was missing from the indexes we use to map categories to commands leading to an out of bounds access and causing a segfault. * remove none from acl categories --------- Signed-off-by: kostas --- src/server/acl/acl_family.h | 3 +-- src/server/acl/acl_family_test.cc | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/acl/acl_family.h b/src/server/acl/acl_family.h index 0be8187258f4..8ffce0567700 100644 --- a/src/server/acl/acl_family.h +++ b/src/server/acl/acl_family.h @@ -122,8 +122,7 @@ class AclFamily final { {"FT_SEARCH", FT_SEARCH}, {"THROTTLE", THROTTLE}, {"JSON", JSON}, - {"ALL", ALL}, - {"NONE", NONE}}; + {"ALL", ALL}}; // bit 0 at index 0 // bit 1 at index 1 diff --git a/src/server/acl/acl_family_test.cc b/src/server/acl/acl_family_test.cc index cbacb7630c2e..7c41ed4042fc 100644 --- a/src/server/acl/acl_family_test.cc +++ b/src/server/acl/acl_family_test.cc @@ -109,6 +109,10 @@ TEST_F(AclFamilyTest, AclSetUser) { vec = resp.GetVec(); EXPECT_THAT(vec, UnorderedElementsAre("user default on nopass ~* +@all", "user vlad on -@all +acl")); + + // +@NONE should not exist anymore. It's not in the spec. + resp = Run({"ACL", "SETUSER", "rand", "+@NONE"}); + EXPECT_THAT(resp, ErrArg("ERR Unrecognized parameter +@NONE")); } TEST_F(AclFamilyTest, AclDelUser) {