Commit fa3422c
committed
fix(project): address CodeRabbit review — dry-run bypass and TOCTOU in readSecretFileGuarded
- Move secret-file resolution in runAutoAuth to after the dry-run early
return so --dry-run never touches the filesystem (matches runCreate /
runUpdate behaviour)
- Wrap the final readFileSync in readSecretFileGuarded with a try-catch
so EACCES or any other read failure after a successful statSync is
converted to a structured VALIDATION_ERROR (exit 5) instead of a raw
Node error
- Add test: runAutoAuth --dry-run with a missing --password-file returns
the sample without touching the network or filesystem
- Add test: TOCTOU path — file unreadable after stat → VALIDATION_ERROR
(skipped when running as root)1 parent 080a929 commit fa3422c
2 files changed
Lines changed: 82 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
1605 | 1605 | | |
1606 | 1606 | | |
1607 | 1607 | | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
1608 | 1659 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
577 | 595 | | |
| 596 | + | |
578 | 597 | | |
579 | 598 | | |
580 | 599 | | |
| |||
591 | 610 | | |
592 | 611 | | |
593 | 612 | | |
594 | | - | |
595 | 613 | | |
596 | 614 | | |
597 | 615 | | |
| |||
611 | 629 | | |
612 | 630 | | |
613 | 631 | | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | 632 | | |
631 | 633 | | |
632 | 634 | | |
| |||
1127 | 1129 | | |
1128 | 1130 | | |
1129 | 1131 | | |
1130 | | - | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
1131 | 1143 | | |
1132 | 1144 | | |
1133 | 1145 | | |
| |||
0 commit comments