fix(redis): block FLUSHDB in MCP instead of running it unconfirmed

This commit is contained in:
BASIL K AJI authored and GitHub committed 2026-10-04 03:43:49 +08:00
1 parent a9990d5fdb
commit 92a29cb715
7 files changed
+11 -12

No files matched your search

+2 -2
View File
@@ -2134,7 +2134,7 @@ pub fn classify_command(command: &str) -> RedisCommandSafety {
| "ZREM" | "ZPOPMAX" | "ZPOPMIN" | "ZMPOP" | "BZMPOP" | "BZPOPMAX" | "BZPOPMIN" | "ZREMRANGEBYLEX"
| "ZREMRANGEBYRANK" | "ZREMRANGEBYSCORE" | "XDEL" | "XTRIM" | "MOVE" | "SORT" | "SDIFFSTORE"
| "SINTERSTORE" | "SUNIONSTORE" | "ZDIFFSTORE" | "ZINTERSTORE" | "ZRANGESTORE" | "ZUNIONSTORE" | "PFMERGE"
| "GEOSEARCHSTORE" | "FLUSHDB" => RedisCommandSafety::Confirm,
| "GEOSEARCHSTORE" => RedisCommandSafety::Confirm,
"APPEND" | "BITFIELD" | "BITOP" | "COPY" | "DECR" | "DECRBY" | "GEOADD" | "GEORADIUS" | "GEORADIUSBYMEMBER"
| "GETEX" | "GETSET" | "INCR" | "INCRBY" | "INCRBYFLOAT" | "SET" | "SETEX" | "PSETEX" | "SETNX"
| "SETRANGE" | "MSET" | "MSETNX" | "PERSIST" | "HSET" | "HMSET" | "HINCRBY" | "HINCRBYFLOAT" | "HSETNX"
@@ -7686,7 +7686,7 @@ mod tests {
assert_eq!(classify_command("GETEX"), RedisCommandSafety::Write);
assert_eq!(classify_command("XREADGROUP"), RedisCommandSafety::Write);
assert_eq!(classify_command("del"), RedisCommandSafety::Confirm);
assert_eq!(classify_command("flushdb"), RedisCommandSafety::Confirm);
assert_eq!(classify_command("flushdb"), RedisCommandSafety::Blocked);
assert_eq!(classify_command("JSON.DEL"), RedisCommandSafety::Confirm);
assert_eq!(classify_command("JSON.FORGET"), RedisCommandSafety::Confirm);
assert_eq!(classify_command("JSON.CLEAR"), RedisCommandSafety::Confirm);