This repository was archived by the owner on Jun 2, 2021. It is now read-only.
Commit a11dc99
committed
Prevent files with insufficient permissions from being cached
- Previously, we were altering file permissions when we unzipped the
resources for an app to give ourselves read/write access. The altered
files were then stored in the resource cache
- When attempting to push the app containing a file with insufficient
permissions for a second time, a resource match would be found. We
preserve the mode provided in the fingerprint given to us from the
client, rather than using the altered mode the file was cached with.
(endpoint: POST /v3/resource_matches)
- When the client reached the upload bits portion of push, it would pass
along the fingerprints matched in the step above. The request would then
error out, as it would run into a check we have to ensure that the mode
on all fingerprints is >= 0600. (endpoint: POST /v3/packages/:guid/upload)
To solve this issue we have done the following:
- Moved the portion of code that altered permissions on unzipping the
application. This is still necessary in allowing CAPI to clean up the
unzipped files, and is now done as part of `remove_dirs_from_zip`. If
changing the permissions fails, an error is logged but it does not cause
the call to fail.
- Enforced a file permission check before uploading any files to the
resource cache. This prevents files with permissions < 0600 from being
uploaded in the first place, ultimately preventing a resource match from
ever being returned for insufficiently permissioned files.
Users who have previously uploaded an insufficiently permissioned file
may need to clear their resource cache as these changes do not account
for any files already in the cache.
Github issue: cloudfoundry#1705
[finishes #173541786]
Authored-by: Sarah Weinstein <sweinstein@pivotal.io>1 parent 95f7465 commit a11dc99
File tree
7 files changed
+89
-95
lines changed- lib/cloud_controller
- blobstore
- packager
- spec/unit/lib
- cloud_controller
- blobstore
- fog
- webdav
- packager
7 files changed
+89
-95
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
| |||
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
46 | | - | |
47 | | - | |
| 44 | + | |
| 45 | + | |
48 | 46 | | |
49 | 47 | | |
50 | 48 | | |
| |||
69 | 67 | | |
70 | 68 | | |
71 | 69 | | |
72 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
90 | | - | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | | - | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 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 | 35 | | |
69 | 36 | | |
70 | 37 | | |
| |||
126 | 93 | | |
127 | 94 | | |
128 | 95 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | 96 | | |
145 | 97 | | |
146 | 98 | | |
| |||
215 | 167 | | |
216 | 168 | | |
217 | 169 | | |
218 | | - | |
| 170 | + | |
219 | 171 | | |
220 | 172 | | |
221 | 173 | | |
| |||
231 | 183 | | |
232 | 184 | | |
233 | 185 | | |
234 | | - | |
| 186 | + | |
235 | 187 | | |
236 | 188 | | |
237 | 189 | | |
| |||
241 | 193 | | |
242 | 194 | | |
243 | 195 | | |
244 | | - | |
| 196 | + | |
245 | 197 | | |
246 | 198 | | |
247 | 199 | | |
248 | 200 | | |
249 | | - | |
| 201 | + | |
250 | 202 | | |
251 | 203 | | |
252 | 204 | | |
| |||
257 | 209 | | |
258 | 210 | | |
259 | 211 | | |
260 | | - | |
| 212 | + | |
261 | 213 | | |
262 | 214 | | |
263 | 215 | | |
| |||
268 | 220 | | |
269 | 221 | | |
270 | 222 | | |
271 | | - | |
| 223 | + | |
272 | 224 | | |
273 | 225 | | |
274 | 226 | | |
| |||
279 | 231 | | |
280 | 232 | | |
281 | 233 | | |
282 | | - | |
| 234 | + | |
283 | 235 | | |
284 | 236 | | |
285 | 237 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 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 | + | |
188 | 215 | | |
189 | 216 | | |
190 | 217 | | |
| |||
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
392 | 434 | | |
393 | 435 | | |
394 | 436 | | |
| |||
Lines changed: 0 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | 297 | | |
326 | 298 | | |
327 | 299 | | |
| |||
0 commit comments