( context: ValidationContext, )
| 821 | } |
| 822 | |
| 823 | function validateDangerousVariables( |
| 824 | context: ValidationContext, |
| 825 | ): PermissionResult { |
| 826 | const { fullyUnquotedContent } = context |
| 827 | |
| 828 | if ( |
| 829 | /[<>|]\s*\$[A-Za-z_]/.test(fullyUnquotedContent) || |
| 830 | /\$[A-Za-z_][A-Za-z0-9_]*\s*[|<>]/.test(fullyUnquotedContent) |
| 831 | ) { |
| 832 | logEvent('tengu_bash_security_check_triggered', { |
| 833 | checkId: BASH_SECURITY_CHECK_IDS.DANGEROUS_VARIABLES, |
| 834 | subId: 1, |
| 835 | }) |
| 836 | return { |
| 837 | behavior: 'ask', |
| 838 | message: |
| 839 | 'Command contains variables in dangerous contexts (redirections or pipes)', |
| 840 | } |
| 841 | } |
| 842 | |
| 843 | return { behavior: 'passthrough', message: 'No dangerous variables' } |
| 844 | } |
| 845 | |
| 846 | function validateDangerousPatterns( |
| 847 | context: ValidationContext, |
nothing calls this directly
no test coverage detected