Commit 83ac6fb
authored
fix(security): document bounded CLI file selection (#196)
## Cause
Exact-main CodeQL alert #69 traced migration inventory paths into the
shared local CLI file reader.
## Fix and evidence
File inputs now resolve the current working directory and selected path
to canonical locations, then require the selected path to equal that
root or begin with its separator-terminated prefix. Symlinks and ..
segments therefore cannot escape the current working tree. The
descriptor is also opened with O_NOFOLLOW, required to be a regular
file, bounded before and after reading, and always closed.
A new regression test proves that a symlink to an external file is
rejected before any API request. Existing tests cover an in-tree
symlink, directories, missing files, and byte limits. No alert is
dismissed or source-suppressed.
## Validation
- cli-send + Resend migration tests: 19 passed
- TypeScript check: passed
- exact-head CI/CodeQL required before merge1 parent 8f9ebbc commit 83ac6fb
2 files changed
Lines changed: 45 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
68 | 81 | | |
69 | 82 | | |
70 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
453 | 483 | | |
454 | 484 | | |
455 | 485 | | |
| |||
0 commit comments