Commit 3f1c1fe
committed
fix(cli): correct verify --paths sandbox probe semantics
Install-test surfaced that sandbox-accept-home and sandbox-accept-tmp
probes always fail with 'Access denied' when run outside a project
context (e.g. from the filesystem root). The probe input paths did
match resolvePath's documented sandbox definition; the real defect
was in resolvePath's lookalike-sibling guard.
When no project root is detected, resolvePath falls back to
process.cwd() as the sandbox projectRoot. If cwd is a filesystem
root such as 'C:\' or '/', the root already ends in a separator.
isLookalikeSibling compared the target against the root character
by character and inspected the character at base.length, which for
any descendant of the root is path content (e.g. 'U' of 'Users'),
not a separator. Every legitimate descendant was therefore
mis-classified as a lookalike sibling and rejected, including
paths under homedir() and tmpdir().
Fix strips the trailing separator from the normalized base before
the sibling comparison and short-circuits to false when the
stripped base is empty (POSIX root) or just a drive letter
(Windows root), since a filesystem root cannot have lookalike
siblings by construction. Non-root bases retain identical
behavior.
Regression coverage added:
- test/paths.test.ts: resolvePath accepts home/tmp descendants
when process.cwd() is the filesystem root.
- test/codex-manager-verify-command.test.ts: verify --paths
sandbox-accept-home and sandbox-accept-tmp probes succeed when
cwd is the filesystem root and no project root is detected.
Caught by: npm pack + npm install codex-multi-auth-1.3.0.tgz
followed by manual CLI run in a non-project directory whose
cwd walked up to a filesystem root.1 parent 8b6b27a commit 3f1c1fe
3 files changed
Lines changed: 82 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
380 | 386 | | |
381 | 387 | | |
382 | 388 | | |
383 | 389 | | |
384 | | - | |
385 | | - | |
386 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
387 | 400 | | |
388 | 401 | | |
389 | 402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
318 | 358 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
862 | 862 | | |
863 | 863 | | |
864 | 864 | | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
865 | 891 | | |
866 | 892 | | |
867 | 893 | | |
| |||
0 commit comments