MCPcopy Create free account
hub / github.com/freecodexyz/free-code / checkAddType

Function checkAddType

src/tools/PowerShellTool/powershellSecurity.ts:321–331  ·  view source on GitHub ↗

* Checks for Add-Type usage which compiles and loads .NET code at runtime. * This can be used to execute arbitrary compiled code.

(
  parsed: ParsedPowerShellCommand,
)

Source from the content-addressed store, hash-verified

319 * This can be used to execute arbitrary compiled code.
320 */
321function 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,

Callers

nothing calls this directly

Calls 1

hasCommandNamedFunction · 0.85

Tested by

no test coverage detected