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

Function checkInvokeItem

src/tools/PowerShellTool/powershellSecurity.ts:822–836  ·  view source on GitHub ↗

* Invoke-Item (alias ii) opens a file with its default handler (ShellExecute * on Windows, open/xdg-open on Unix). On an .exe/.ps1/.bat/.cmd this is RCE. * Bug 008: ii is in no blocklist; passthrough prompt doesn't explain the * exec hazard. Always ask — there is no safe variant (even opening .tx

(
  parsed: ParsedPowerShellCommand,
)

Source from the content-addressed store, hash-verified

820 * invoke a user-configured handler that accepts arguments).
821 */
822function checkInvokeItem(
823 parsed: ParsedPowerShellCommand,
824): PowerShellSecurityResult {
825 for (const cmd of getAllCommands(parsed)) {
826 const lower = cmd.name.toLowerCase()
827 if (lower === 'invoke-item' || lower === 'ii') {
828 return {
829 behavior: 'ask',
830 message:
831 'Invoke-Item opens files with the default handler (ShellExecute). On executable files this runs arbitrary code.',
832 }
833 }
834 }
835 return { behavior: 'passthrough' }
836}
837
838/**
839 * Scheduled-task persistence primitives. Register-ScheduledJob was blocked

Callers

nothing calls this directly

Calls 1

getAllCommandsFunction · 0.50

Tested by

no test coverage detected