Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
11b071a2
Unverified
Commit
11b071a2
authored
Mar 10, 2022
by
ranshid
Committed by
GitHub
Mar 10, 2022
Browse files
ACL DRYRUN does not validate the verified command args. (#10405)
As a result we segfault when parsing and matching the command keys.
parent
a26cab9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/acl.c
View file @
11b071a2
...
@@ -2790,6 +2790,13 @@ setuser_cleanup:
...
@@ -2790,6 +2790,13 @@ setuser_cleanup:
return
;
return
;
}
}
if
((
cmd
->
arity
>
0
&&
cmd
->
arity
!=
c
->
argc
-
3
)
||
(
c
->
argc
-
3
<
-
cmd
->
arity
))
{
addReplyErrorFormat
(
c
,
"wrong number of arguments for '%s' command"
,
cmd
->
fullname
);
return
;
}
int
idx
;
int
idx
;
int
result
=
ACLCheckAllUserCommandPerm
(
u
,
cmd
,
c
->
argv
+
3
,
c
->
argc
-
3
,
&
idx
);
int
result
=
ACLCheckAllUserCommandPerm
(
u
,
cmd
,
c
->
argv
+
3
,
c
->
argc
-
3
,
&
idx
);
if
(
result
!=
ACL_OK
)
{
if
(
result
!=
ACL_OK
)
{
...
...
tests/unit/acl-v2.tcl
View file @
11b071a2
...
@@ -315,9 +315,9 @@ start_server {tags {"acl external:skip"}} {
...
@@ -315,9 +315,9 @@ start_server {tags {"acl external:skip"}} {
r ACL setuser command-test +@all %R~read* %W~write* %RW~rw*
r ACL setuser command-test +@all %R~read* %W~write* %RW~rw*
# Test migrate, which is marked with incomplete keys
# Test migrate, which is marked with incomplete keys
assert_equal
"OK"
[
r ACL DRYRUN command-test MIGRATE whatever whatever rw
]
assert_equal
"OK"
[
r ACL DRYRUN command-test MIGRATE whatever whatever rw
0 500
]
assert_equal
"This user has no permissions to access the 'read' key"
[
r ACL DRYRUN command-test MIGRATE whatever whatever read
]
assert_equal
"This user has no permissions to access the 'read' key"
[
r ACL DRYRUN command-test MIGRATE whatever whatever read
0 500
]
assert_equal
"This user has no permissions to access the 'write' key"
[
r ACL DRYRUN command-test MIGRATE whatever whatever write
]
assert_equal
"This user has no permissions to access the 'write' key"
[
r ACL DRYRUN command-test MIGRATE whatever whatever write
0 500
]
assert_equal
"OK"
[
r ACL DRYRUN command-test MIGRATE whatever whatever
""
0 5000 KEYS rw
]
assert_equal
"OK"
[
r ACL DRYRUN command-test MIGRATE whatever whatever
""
0 5000 KEYS rw
]
assert_equal
"This user has no permissions to access the 'read' key"
[
r ACL DRYRUN command-test MIGRATE whatever whatever
""
0 5000 KEYS read
]
assert_equal
"This user has no permissions to access the 'read' key"
[
r ACL DRYRUN command-test MIGRATE whatever whatever
""
0 5000 KEYS read
]
assert_equal
"This user has no permissions to access the 'write' key"
[
r ACL DRYRUN command-test MIGRATE whatever whatever
""
0 5000 KEYS write
]
assert_equal
"This user has no permissions to access the 'write' key"
[
r ACL DRYRUN command-test MIGRATE whatever whatever
""
0 5000 KEYS write
]
...
@@ -433,6 +433,19 @@ start_server {tags {"acl external:skip"}} {
...
@@ -433,6 +433,19 @@ start_server {tags {"acl external:skip"}} {
assert_equal
"This user has no permissions to access the 'otherchannel' channel"
[
r ACL DRYRUN test-channels spublish otherchannel foo
]
assert_equal
"This user has no permissions to access the 'otherchannel' channel"
[
r ACL DRYRUN test-channels spublish otherchannel foo
]
assert_equal
"This user has no permissions to access the 'otherchannel' channel"
[
r ACL DRYRUN test-channels ssubscribe otherchannel foo
]
assert_equal
"This user has no permissions to access the 'otherchannel' channel"
[
r ACL DRYRUN test-channels ssubscribe otherchannel foo
]
}
}
test
{
Test DRYRUN with wrong number of arguments
}
{
r ACL setuser test-dry-run +@all ~v*
assert_equal
"OK"
[
r ACL DRYRUN test-dry-run SET v v
]
catch
{
r ACL DRYRUN test-dry-run SET v
}
e
assert_equal
"ERR wrong number of arguments for 'set' command"
$e
catch
{
r ACL DRYRUN test-dry-run SET
}
e
assert_equal
"ERR wrong number of arguments for 'set' command"
$e
}
$r2 close
$r2 close
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment