This repository was archived by the owner on Oct 25, 2026. It is now read-only.
Repository navigation
Conversation
EXEC gained key-specs for its IFEQ/IFNE/NX/XX condition keys, which makes the ACL selector check treat it as a keyed command and require access to the active database. That database is the one the client was in before MULTI, since queued SELECTs have not run yet. A user restricted to db=1 whose connection starts in DB 0 can therefore no longer run MULTI / SELECT 1 / ... / EXEC: the EXEC is rejected even though it reads nothing from DB 0. Only require access to the active database when EXEC carries arguments. Condition keys are read from that database and stay restricted, and the queued commands are still checked against their own database as they run. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a regression from #4019, first released in 9.2.0-rc1. A user whose ACL only allows
db=1can no longer runMULTI/SELECT 1/SET x 1/EXECfrom a connection that starts in DB 0, which works in 9.1.EXECnow fails withEXECABORT ... NOPERM No permissions to access database. #4019 gaveEXECkey-specs for its new condition keys, so the ACL check treats everyEXECas a keyed command and requires access to the pre-transaction DB, even a bareEXECthat reads nothing from it. Each queued command is still checked against its own DB when it runs, so this only applies the DB check toEXECwhen it has arguments.AI generated details
Problem
ACLSelectorCheckCmddenies any command for whichshouldRestrictCmd()is true when the selector cannot accessdbid(src/acl.c:2296).shouldRestrictCmd()includesdoesCommandHaveKeys(cmd). Before 0adf657 (#4019),EXEChad no key-specs and only theSLOWandTRANSACTIONcategories, so it was never DB-restricted. #4019 added a key-spec for theIFEQ/IFNE/NX/XXkeys, and changedACLCheckAllPermto passc->db->idforEXEC(src/acl.c:2541). That is the DB the client was in beforeMULTI, because queuedSELECTs have not run yet. That DB is correct for condition keys, sincecheckExecConditionsreads them fromc->db(src/multi.c:286). It is wrong for a bareEXEC, which reads nothing there. The queued commands are re-checked against their own DB as they run (src/multi.c:380).The existing #4019 test passes a condition key, so it never checks an
EXECwithout one.Affected: 9.2.0-rc1 and the
9.2branch. In 9.1 and earlier,exec.jsonhas no key-specs and the same transaction succeeds.Behavior for user
db=1 +@all ~*, connection starting in DB 0:MULTI/SELECT 1/SET x 1/EXECEXECABORT ... NOPERM ... databaseOK OKMULTI/EXECEXECABORT ... NOPERM ... databaseEXECwithoutMULTIEXECABORT ... NOPERM ... databaseERR EXEC without MULTIMULTI/SELECT 1/SET x 1/EXEC XX xEXECABORT ... NOPERM ... databaseMULTI/SELECT 1/SET x 1/EXEC foo(malformed)EXECABORT ... NOPERM ... databaseSELECT 1/MULTI/SET x 1/EXECOKWith selectors
(db=1 +@all ~*) (db=0 +@all ~public*),EXEC IFEQ secret vfrom DB 0 is stillNOPERM ... key.Fix
Skip the active-DB check only when the command is
EXECandargc == 1. With any arguments,EXECstays restricted to the active DB, including malformed ones, which keeps the base behavior.Alternative considered
Only DB-restrict
NO_MANDATORY_KEYScommands when the invocation actually has keys. That would also lift the DB restriction onEVAL,EVALSHA, andFCALLwith zero keys, which are DB-restricted today. That is an ACL change to commands this regression does not touch, and it needs its own review.Testing
New test in
tests/unit/acl-v2.tcl. It also checks thatEXEC XX <key>from DB 0 is still denied. With only thesrc/acl.chunk reverted:Dropping the
argc == 1guard, so that everyEXECskips the check, fails both this test and the existing #4019 test:Based on upstream/unstable
8f67ab136, so the base branch here isupstream-unstable-8f67ab136.This was generated by AI but verified, with love, by a human.