* Checks for PowerShell re-invocation (nested pwsh/powershell process). * * Any PowerShell executable in command position is flagged — not just * -Command/-File. Bare `pwsh` receiving stdin (`Get-Content x | pwsh`) or * a positional script path executes arbitrary code with none of the explicit
( parsed: ParsedPowerShellCommand, )
| 190 | * process will run. |
| 191 | */ |
| 192 | function checkPwshCommandOrFile( |
| 193 | parsed: ParsedPowerShellCommand, |
| 194 | ): PowerShellSecurityResult { |
| 195 | for (const cmd of getAllCommands(parsed)) { |
| 196 | if (isPowerShellExecutable(cmd.name)) { |
| 197 | return { |
| 198 | behavior: 'ask', |
| 199 | message: |
| 200 | 'Command spawns a nested PowerShell process which cannot be validated', |
| 201 | } |
| 202 | } |
| 203 | } |
| 204 | return { behavior: 'passthrough' } |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * Checks for download cradle patterns - common malware techniques |
nothing calls this directly
no test coverage detected