( context: ValidationContext, )
| 583 | } |
| 584 | |
| 585 | function validateSafeCommandSubstitution( |
| 586 | context: ValidationContext, |
| 587 | ): PermissionResult { |
| 588 | const { originalCommand } = context |
| 589 | |
| 590 | if (!HEREDOC_IN_SUBSTITUTION.test(originalCommand)) { |
| 591 | return { behavior: 'passthrough', message: 'No heredoc in substitution' } |
| 592 | } |
| 593 | |
| 594 | if (isSafeHeredoc(originalCommand)) { |
| 595 | return { |
| 596 | behavior: 'allow', |
| 597 | updatedInput: { command: originalCommand }, |
| 598 | decisionReason: { |
| 599 | type: 'other', |
| 600 | reason: |
| 601 | 'Safe command substitution: cat with quoted/escaped heredoc delimiter', |
| 602 | }, |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | return { |
| 607 | behavior: 'passthrough', |
| 608 | message: 'Command substitution needs validation', |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | function validateGitCommit(context: ValidationContext): PermissionResult { |
| 613 | const { originalCommand, baseCommand } = context |
nothing calls this directly
no test coverage detected