Commit b3db1b2
committed
feat(file): add allowed_path_traversal_elements to file_path (upstream PR #2397)
Ports upstream PR #2397: file_path() gains an optional
allowed_path_traversal_elements sequence, whose segments (e.g. '.', '..')
may be randomly picked as directory components, to generate test cases for
directory traversal detection.
Fixes applied on top of the upstream patch:
- rewrote paths faker/ -> faker2/ for the renamed package
- resolved conflict in faker2/providers/file/__init__.py: the fork renamed
the local variable 'seperator' -> 'separator'
- tests/providers/test_file.py: the last assertion's regex only matched
depth=2 while the call requests depth=3; it now expects four
'\\[\w.]+' segments (3 directories + the file name)
- tests/providers/test_file.py: removed trailing whitespace (flake8 W293)
and reformatted the call for black --line-length 1201 parent d2d9d78 commit b3db1b2
2 files changed
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
278 | 279 | | |
279 | 280 | | |
280 | 281 | | |
| |||
295 | 296 | | |
296 | 297 | | |
297 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
298 | 304 | | |
299 | 305 | | |
300 | 306 | | |
| |||
304 | 310 | | |
305 | 311 | | |
306 | 312 | | |
| 313 | + | |
307 | 314 | | |
308 | 315 | | |
309 | 316 | | |
| |||
321 | 328 | | |
322 | 329 | | |
323 | 330 | | |
324 | | - | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
325 | 336 | | |
326 | 337 | | |
327 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
54 | 66 | | |
55 | 67 | | |
56 | 68 | | |
| |||
0 commit comments