mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
fix(acl): return -NOPERM instead of response error (#3049)
This commit is contained in:
parent
0dea257f41
commit
2391f49e1c
2 changed files with 4 additions and 4 deletions
|
@ -1000,7 +1000,7 @@ static optional<ErrorReply> VerifyConnectionAclStatus(const CommandId* cid,
|
||||||
cntx = cntx->conn_state.squashing_info->owner;
|
cntx = cntx->conn_state.squashing_info->owner;
|
||||||
|
|
||||||
if (!acl::IsUserAllowedToInvokeCommand(*cntx, *cid, tail_args)) {
|
if (!acl::IsUserAllowedToInvokeCommand(*cntx, *cid, tail_args)) {
|
||||||
return ErrorReply(absl::StrCat("NOPERM: ", cntx->authed_username, " ", error_msg));
|
return ErrorReply(absl::StrCat("-NOPERM ", cntx->authed_username, " ", error_msg));
|
||||||
}
|
}
|
||||||
return nullopt;
|
return nullopt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@ async def test_acl_cat_commands_multi_exec_squash(df_local_factory):
|
||||||
await client.execute_command("MULTI")
|
await client.execute_command("MULTI")
|
||||||
assert res == b"OK"
|
assert res == b"OK"
|
||||||
|
|
||||||
with pytest.raises(redis.exceptions.ResponseError):
|
with pytest.raises(redis.exceptions.NoPermissionError):
|
||||||
await client.execute_command(f"SET x{x} {x}")
|
await client.execute_command(f"SET x{x} {x}")
|
||||||
await client.close()
|
await client.close()
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ async def test_acl_cat_commands_multi_exec_squash(df_local_factory):
|
||||||
# return multiple errors for each command failed. Since the nature of the error
|
# return multiple errors for each command failed. Since the nature of the error
|
||||||
# is the same, that a rule has changed we should squash those error messages into
|
# is the same, that a rule has changed we should squash those error messages into
|
||||||
# one.
|
# one.
|
||||||
assert res[0].args[0] == "NOPERM: kk ACL rules changed between the MULTI and EXEC"
|
assert res[0].args[0] == "kk ACL rules changed between the MULTI and EXEC"
|
||||||
|
|
||||||
await admin_client.close()
|
await admin_client.close()
|
||||||
await client.close()
|
await client.close()
|
||||||
|
@ -213,7 +213,7 @@ async def test_acl_cat_commands_multi_exec_squash(df_local_factory):
|
||||||
# NOPERM while executing multi
|
# NOPERM while executing multi
|
||||||
await client.execute_command("MULTI")
|
await client.execute_command("MULTI")
|
||||||
|
|
||||||
with pytest.raises(redis.exceptions.ResponseError):
|
with pytest.raises(redis.exceptions.NoPermissionError):
|
||||||
await client.execute_command(f"SET x{x} {x}")
|
await client.execute_command(f"SET x{x} {x}")
|
||||||
|
|
||||||
await admin_client.close()
|
await admin_client.close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue