Commit ff7529d
fix: use exclusive file creation for chroot-hosts to address CWE-377
Use fs.openSync with O_CREAT|O_EXCL instead of copyFileSync/writeFileSync
to securely create the chroot-hosts temp file. This prevents symlink and
TOCTOU attacks flagged by CodeQL's js/insecure-temporary-file rule.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent fdd5713 commit ff7529d
1 file changed
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
| 504 | + | |
| 505 | + | |
504 | 506 | | |
505 | | - | |
| 507 | + | |
506 | 508 | | |
507 | | - | |
| 509 | + | |
508 | 510 | | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
509 | 519 | | |
510 | 520 | | |
511 | 521 | | |
| |||
0 commit comments