Commit 420525e
fix(init): run commands without shell to eliminate injection surface
Replace spawn({ shell: true }) with direct executable invocation by
splitting the command string into [executable, ...args]. This eliminates
shell injection as an attack vector entirely — metacharacters become
harmless literal arguments. The existing validateCommand() blocklist is
retained as defense-in-depth.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 4033b4e commit 420525e
2 files changed
+12
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
536 | | - | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
537 | 538 | | |
538 | 539 | | |
539 | 540 | | |
| |||
545 | 546 | | |
546 | 547 | | |
547 | 548 | | |
548 | | - | |
549 | | - | |
| 549 | + | |
| 550 | + | |
550 | 551 | | |
551 | 552 | | |
552 | 553 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
619 | | - | |
| 619 | + | |
620 | 620 | | |
621 | 621 | | |
622 | 622 | | |
| |||
664 | 664 | | |
665 | 665 | | |
666 | 666 | | |
667 | | - | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
668 | 670 | | |
669 | 671 | | |
670 | 672 | | |
| |||
675 | 677 | | |
676 | 678 | | |
677 | 679 | | |
678 | | - | |
| 680 | + | |
679 | 681 | | |
680 | 682 | | |
681 | 683 | | |
| |||
697 | 699 | | |
698 | 700 | | |
699 | 701 | | |
700 | | - | |
| 702 | + | |
701 | 703 | | |
702 | 704 | | |
703 | 705 | | |
| |||
718 | 720 | | |
719 | 721 | | |
720 | 722 | | |
721 | | - | |
| 723 | + | |
722 | 724 | | |
723 | 725 | | |
724 | 726 | | |
| |||
0 commit comments