Skip to content

Commit 825d19f

Browse files
authored
Make all ACL categories explicit in JSON files (#2887)
Resolves #417 --------- Signed-off-by: Daniil Kashapov <[email protected]>
1 parent 4a0e20b commit 825d19f

File tree

427 files changed

+2025
-845
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

427 files changed

+2025
-845
lines changed

src/commands.def

Lines changed: 423 additions & 423 deletions
Large diffs are not rendered by default.

src/commands/README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,13 @@ following keys. To be safe, assume all of them are optional.
134134
if type is "pure-token". If type is anything else, then `"token"` indicates
135135
the argument is preceded by an extra (fixed string) argument.
136136

137-
Implicit ACL categories
137+
ACL categories
138138
-----------------------
139139

140-
The ACL categories specified as `"acl_categories"` are not the ones actually used.
141-
The effective ACL categories are affected also by command flags.
142-
143-
The logic for this can be found in the function `setImplicitACLCategories()` in
144-
`server.c`. Here are the rules (unless they have changed since this
145-
documentation was written):
140+
The ACL categories specified as `"acl_categories"` are the ones that are actually used.
141+
**Note:** commands categories should follow specific rules that are checked in `utils/generate-command-code.py`
146142

143+
**ACL Category Rules:**
147144
* Command flag WRITE implies ACL category WRITE.
148145
* Command flag READONLY and not ACL category SCRIPTING implies ACL category READ.
149146
"Exclude scripting commands from the RO category."
@@ -153,9 +150,6 @@ documentation was written):
153150
* Command flag BLOCKING implies ACL category BLOCKING.
154151
* Not ACL category FAST implies ACL category SLOW. "If it's not fast, it's slow."
155152

156-
There's an issue about explicitly listing all categories, removing this
157-
discrepancy: https://github.com/valkey-io/valkey/issues/417
158-
159153
Key specs
160154
---------
161155

src/commands/acl-cat.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
"type": "string",
3838
"optional": true
3939
}
40+
],
41+
"acl_categories": [
42+
"SLOW"
4043
]
4144
}
4245
}

src/commands/acl-deluser.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"SENTINEL"
1616
],
1717
"command_tips": [
18-
"REQUEST_POLICY:ALL_NODES",
19-
"RESPONSE_POLICY:ALL_SUCCEEDED"
20-
],
18+
"REQUEST_POLICY:ALL_NODES",
19+
"RESPONSE_POLICY:ALL_SUCCEEDED"
20+
],
2121
"reply_schema": {
2222
"type": "integer",
2323
"description": "The number of users that were deleted."
@@ -28,6 +28,11 @@
2828
"type": "string",
2929
"multiple": true
3030
}
31+
],
32+
"acl_categories": [
33+
"ADMIN",
34+
"DANGEROUS",
35+
"SLOW"
3136
]
3237
}
3338
}

src/commands/acl-dryrun.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
"optional": true,
4242
"multiple": true
4343
}
44+
],
45+
"acl_categories": [
46+
"ADMIN",
47+
"DANGEROUS",
48+
"SLOW"
4449
]
4550
}
4651
}

src/commands/acl-genpass.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"type": "integer",
2424
"optional": true
2525
}
26+
],
27+
"acl_categories": [
28+
"SLOW"
2629
]
2730
}
2831
}

src/commands/acl-getuser.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@
8686
"type": "null"
8787
}
8888
]
89-
}
89+
},
90+
"acl_categories": [
91+
"ADMIN",
92+
"DANGEROUS",
93+
"SLOW"
94+
]
9095
}
9196
}

src/commands/acl-help.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
"items": {
1919
"type": "string"
2020
}
21-
}
21+
},
22+
"acl_categories": [
23+
"SLOW"
24+
]
2225
}
2326
}

src/commands/acl-list.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
"items": {
2121
"type": "string"
2222
}
23-
}
23+
},
24+
"acl_categories": [
25+
"ADMIN",
26+
"DANGEROUS",
27+
"SLOW"
28+
]
2429
}
2530
}

src/commands/acl-load.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
],
1717
"reply_schema": {
1818
"const": "OK"
19-
}
19+
},
20+
"acl_categories": [
21+
"ADMIN",
22+
"DANGEROUS",
23+
"SLOW"
24+
]
2025
}
2126
}

0 commit comments

Comments
 (0)