forked from haiwen/seafile-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathacl-cases.json
More file actions
284 lines (284 loc) · 12.6 KB
/
Copy pathacl-cases.json
File metadata and controls
284 lines (284 loc) · 12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
{
"version": 2,
"comment": "Executable form of docs/acl-semantics.md. Loaded by the Python, C and Go test suites; all three MUST agree on every check. 'expect': null means no access (None / NULL / \"\"). v2 (2026-08-17): same-subject-type merge takes the highest grant (deny still vetoes); file rules override directory rules.",
"repo_id": "11111111-2222-3333-4444-555555555555",
"cases": [
{
"name": "no rules falls through to native",
"subjects": { "user": "b@example.com", "groups": ["1"], "depts": ["10"] },
"rules": [],
"checks": [
{ "path": "/", "native": "rw", "expect": "rw" },
{ "path": "/anything/deep", "native": "r", "expect": "r" }
]
},
{
"name": "native none is never widened",
"subjects": { "user": "b@example.com", "groups": ["1"], "depts": [] },
"rules": [
{ "path": "/open", "subject_type": "user", "subject": "b@example.com", "permission": "rw", "inherit": 1 }
],
"checks": [
{ "path": "/open", "native": null, "expect": null },
{ "path": "/open/sub", "native": null, "expect": null }
]
},
{
"name": "root rule applies to whole repo",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/", "subject_type": "user", "subject": "b@example.com", "permission": "r", "inherit": 1 }
],
"checks": [
{ "path": "/", "native": "rw", "expect": "r" },
{ "path": "/a", "native": "rw", "expect": "r" },
{ "path": "/a/b/c", "native": "rw", "expect": "r" }
]
},
{
"name": "deeper level overrides shallower",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/", "subject_type": "user", "subject": "b@example.com", "permission": "r", "inherit": 1 },
{ "path": "/a/b", "subject_type": "user", "subject": "b@example.com", "permission": "rw", "inherit": 1 }
],
"checks": [
{ "path": "/a", "native": "rw", "expect": "r" },
{ "path": "/a/b", "native": "rw", "expect": "rw" },
{ "path": "/a/b/c", "native": "rw", "expect": "rw" }
]
},
{
"name": "intermediate level without rules inherits the nearest ancestor decision",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/a", "subject_type": "user", "subject": "b@example.com", "permission": "r", "inherit": 1 }
],
"checks": [
{ "path": "/a/b/c/d", "native": "rw", "expect": "r" }
]
},
{
"name": "inherit=0 applies only at the exact path",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/a", "subject_type": "user", "subject": "b@example.com", "permission": "r", "inherit": 0 }
],
"checks": [
{ "path": "/a", "native": "rw", "expect": "r" },
{ "path": "/a/b", "native": "rw", "expect": "rw" }
]
},
{
"name": "inherit=0 at a deep level does not shadow an inherited ancestor rule for children",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/", "subject_type": "user", "subject": "b@example.com", "permission": "r", "inherit": 1 },
{ "path": "/a", "subject_type": "user", "subject": "b@example.com", "permission": "rw", "inherit": 0 }
],
"checks": [
{ "path": "/a", "native": "rw", "expect": "rw" },
{ "path": "/a/b", "native": "rw", "expect": "r" }
]
},
{
"name": "same subject type at same level takes the highest grant",
"subjects": { "user": "b@example.com", "groups": ["1", "2"], "depts": [] },
"rules": [
{ "path": "/a", "subject_type": "group", "subject": "1", "permission": "rw", "inherit": 1 },
{ "path": "/a", "subject_type": "group", "subject": "2", "permission": "r", "inherit": 1 }
],
"checks": [
{ "path": "/a", "native": "rw", "expect": "rw" }
]
},
{
"name": "deny vetoes a higher grant at the same level",
"subjects": { "user": "b@example.com", "groups": ["1", "2"], "depts": [] },
"rules": [
{ "path": "/a", "subject_type": "group", "subject": "1", "permission": "rw", "inherit": 1 },
{ "path": "/a", "subject_type": "group", "subject": "2", "permission": "none", "inherit": 1 },
{ "path": "/b", "subject_type": "group", "subject": "1", "permission": "r", "inherit": 1 },
{ "path": "/b", "subject_type": "group", "subject": "2", "permission": "invisible", "inherit": 1 }
],
"checks": [
{ "path": "/a", "native": "rw", "expect": null },
{ "path": "/b", "native": "rw", "expect": null }
]
},
{
"name": "explicit user rule beats a broader group rule at the same level",
"subjects": { "user": "b@example.com", "groups": ["1"], "depts": [] },
"rules": [
{ "path": "/a", "subject_type": "group", "subject": "1", "permission": "r", "inherit": 1 },
{ "path": "/a", "subject_type": "user", "subject": "b@example.com", "permission": "rw", "inherit": 1 }
],
"checks": [
{ "path": "/a", "native": "rw", "expect": "rw" }
]
},
{
"name": "dept beats group, user beats dept",
"subjects": { "user": "b@example.com", "groups": ["1"], "depts": ["10"] },
"rules": [
{ "path": "/a", "subject_type": "group", "subject": "1", "permission": "none", "inherit": 1 },
{ "path": "/a", "subject_type": "dept", "subject": "10", "permission": "r", "inherit": 1 },
{ "path": "/b", "subject_type": "group", "subject": "1", "permission": "none", "inherit": 1 },
{ "path": "/b", "subject_type": "dept", "subject": "10", "permission": "r", "inherit": 1 },
{ "path": "/b", "subject_type": "user", "subject": "b@example.com", "permission": "rw", "inherit": 1 }
],
"checks": [
{ "path": "/a", "native": "rw", "expect": "r" },
{ "path": "/b", "native": "rw", "expect": "rw" }
]
},
{
"name": "ancestor department rules apply to child department members",
"subjects": { "user": "b@example.com", "groups": [], "depts": ["10", "11"] },
"rules": [
{ "path": "/a", "subject_type": "dept", "subject": "10", "permission": "r", "inherit": 1 }
],
"checks": [
{ "path": "/a/b", "native": "rw", "expect": "r" }
]
},
{
"name": "rules for subjects the user does not belong to are ignored",
"subjects": { "user": "b@example.com", "groups": ["1"], "depts": [] },
"rules": [
{ "path": "/a", "subject_type": "user", "subject": "other@example.com", "permission": "none", "inherit": 1 },
{ "path": "/a", "subject_type": "group", "subject": "99", "permission": "invisible", "inherit": 1 }
],
"checks": [
{ "path": "/a", "native": "rw", "expect": "rw" }
]
},
{
"name": "sibling paths are unaffected and prefix collisions do not leak",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/ab", "subject_type": "user", "subject": "b@example.com", "permission": "r", "inherit": 1 }
],
"checks": [
{ "path": "/ab", "native": "rw", "expect": "r" },
{ "path": "/ab/c", "native": "rw", "expect": "r" },
{ "path": "/abc", "native": "rw", "expect": "rw" },
{ "path": "/a", "native": "rw", "expect": "rw" }
]
},
{
"name": "none denies access outright",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/secret", "subject_type": "user", "subject": "b@example.com", "permission": "none", "inherit": 1 }
],
"checks": [
{ "path": "/secret", "native": "rw", "expect": null },
{ "path": "/secret/deep/file.txt", "native": "rw", "expect": null }
]
},
{
"name": "invisible denies and propagates to descendants",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/confidential", "subject_type": "user", "subject": "b@example.com", "permission": "invisible", "inherit": 1 }
],
"checks": [
{ "path": "/confidential", "native": "rw", "expect": null },
{ "path": "/confidential/x", "native": "rw", "expect": null }
]
},
{
"name": "a rule can never widen the native permission",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/a", "subject_type": "user", "subject": "b@example.com", "permission": "rw", "inherit": 1 }
],
"checks": [
{ "path": "/a", "native": "r", "expect": "r" }
]
},
{
"name": "admin native is tightened to the rule",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/a", "subject_type": "user", "subject": "b@example.com", "permission": "r", "inherit": 1 },
{ "path": "/b", "subject_type": "user", "subject": "b@example.com", "permission": "invisible", "inherit": 1 }
],
"checks": [
{ "path": "/a", "native": "admin", "expect": "r" },
{ "path": "/b", "native": "admin", "expect": null },
{ "path": "/c", "native": "admin", "expect": "admin" }
]
},
{
"name": "permissions outside the lattice are only ever vetoed, never reordered",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/a", "subject_type": "user", "subject": "b@example.com", "permission": "r", "inherit": 1 },
{ "path": "/b", "subject_type": "user", "subject": "b@example.com", "permission": "rw", "inherit": 1 },
{ "path": "/c", "subject_type": "user", "subject": "b@example.com", "permission": "none", "inherit": 1 },
{ "path": "/d", "subject_type": "user", "subject": "b@example.com", "permission": "invisible", "inherit": 1 }
],
"checks": [
{ "path": "/a", "native": "preview", "expect": "preview" },
{ "path": "/b", "native": "cloud-edit", "expect": "cloud-edit" },
{ "path": "/c", "native": "preview", "expect": null },
{ "path": "/d", "native": "cloud-edit", "expect": null },
{ "path": "/a", "native": "custom-reviewer", "expect": "custom-reviewer" },
{ "path": "/c", "native": "custom-reviewer", "expect": null }
]
},
{
"name": "path normalization makes equivalent spellings resolve identically",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/a/b", "subject_type": "user", "subject": "b@example.com", "permission": "r", "inherit": 1 }
],
"checks": [
{ "path": "/a/b", "native": "rw", "expect": "r" },
{ "path": "/a/b/", "native": "rw", "expect": "r" },
{ "path": "//a//b", "native": "rw", "expect": "r" },
{ "path": "a/b", "native": "rw", "expect": "r" },
{ "path": "", "native": "rw", "expect": "rw" }
]
},
{
"name": "file paths inherit their parent directory rule",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/restricted", "subject_type": "user", "subject": "b@example.com", "permission": "r", "inherit": 1 }
],
"checks": [
{ "path": "/restricted/report.docx", "native": "rw", "expect": "r" }
]
},
{
"name": "file rule overrides the parent directory rule",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/a", "subject_type": "user", "subject": "b@example.com", "permission": "r", "inherit": 1 },
{ "path": "/a/report.docx", "subject_type": "user", "subject": "b@example.com", "permission": "rw", "inherit": 1 }
],
"checks": [
{ "path": "/a/report.docx", "native": "rw", "expect": "rw" },
{ "path": "/a/other.docx", "native": "rw", "expect": "r" },
{ "path": "/a/sub/report.docx", "native": "rw", "expect": "r" }
]
},
{
"name": "non-ascii paths are handled byte-exactly",
"subjects": { "user": "b@example.com", "groups": [], "depts": [] },
"rules": [
{ "path": "/受限", "subject_type": "user", "subject": "b@example.com", "permission": "r", "inherit": 1 },
{ "path": "/机密", "subject_type": "user", "subject": "b@example.com", "permission": "invisible", "inherit": 1 }
],
"checks": [
{ "path": "/受限", "native": "rw", "expect": "r" },
{ "path": "/受限/设计图.dwg", "native": "rw", "expect": "r" },
{ "path": "/机密", "native": "rw", "expect": null },
{ "path": "/公开", "native": "rw", "expect": "rw" }
]
}
]
}