* Checks for Add-Type usage which compiles and loads .NET code at runtime. * This can be used to execute arbitrary compiled code.
( parsed: ParsedPowerShellCommand, )
| 319 | * This can be used to execute arbitrary compiled code. |
| 320 | */ |
| 321 | function checkAddType( |
| 322 | parsed: ParsedPowerShellCommand, |
| 323 | ): PowerShellSecurityResult { |
| 324 | if (hasCommandNamed(parsed, 'Add-Type')) { |
| 325 | return { |
| 326 | behavior: 'ask', |
| 327 | message: 'Command compiles and loads .NET code', |
| 328 | } |
| 329 | } |
| 330 | return { behavior: 'passthrough' } |
| 331 | } |
| 332 | |
| 333 | /** |
| 334 | * Checks for New-Object -ComObject. COM objects like WScript.Shell, |
nothing calls this directly
no test coverage detected