Commit 23a914d
committed
fix(cue): reject Windows cross-drive rel + read canonical path
Two follow-up hardenings to the prompt_file containment check:
- On Windows, path.relative returns an absolute path (drive-letter or UNC)
when realPath has no common base with realRoot — that result does not
start with `..`, so the previous check accepted it. Add path.isAbsolute(rel)
to the rejection condition.
- Read the canonicalized realPath instead of absPath so a TOCTOU symlink
swap between the realpath check and the readFileSync call cannot redirect
the read to an out-of-root target.1 parent 7fe4317 commit 23a914d
1 file changed
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
54 | | - | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
| 60 | + | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
61 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
62 | 71 | | |
63 | 72 | | |
64 | 73 | | |
| |||
0 commit comments