MCPcopy Create free account
hub / github.com/beita6969/ScienceClaw / assertSafeWindowsShellArgs

Function assertSafeWindowsShellArgs

scripts/ui.js:64–77  ·  view source on GitHub ↗
(args, platform = process.platform)

Source from the content-addressed store, hash-verified

62}
63
64export function assertSafeWindowsShellArgs(args, platform = process.platform) {
65 if (platform !== "win32") {
66 return;
67 }
68 const unsafeArg = args.find((arg) => WINDOWS_UNSAFE_SHELL_ARG_PATTERN.test(arg));
69 if (!unsafeArg) {
70 return;
71 }
72 // SECURITY: `shell: true` routes through cmd.exe; reject risky metacharacters
73 // in forwarded args to prevent shell control-flow/env-expansion injection.
74 throw new Error(
75 `Unsafe Windows shell argument: ${unsafeArg}. Remove shell metacharacters (" & | < > ^ % !).`,
76 );
77}
78
79function createSpawnOptions(cmd, args, envOverride) {
80 const useShell = shouldUseShellForCommand(cmd);

Callers 2

ui.test.tsFile · 0.90
createSpawnOptionsFunction · 0.85

Calls 1

findMethod · 0.45

Tested by

no test coverage detected