fix(cliRuntime): resolve TDZ for isWindows in devin config via lazy getter, add spawn metachar guard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
diegosouzapw
2026-05-11 22:22:26 -03:00
parent 08b95863a2
commit be76707452

View File

@@ -76,13 +76,15 @@ const CLI_TOOLS: Record<string, any> = {
paths: {
// %APPDATA%\devin\config.json (Windows)
// ~/.config/devin/config.json (Linux/macOS)
config: isWindows()
? path.join(
process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming"),
"devin",
"config.json"
)
: path.join(os.homedir(), ".config", "devin", "config.json"),
get config() {
return isWindows()
? path.join(
process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming"),
"devin",
"config.json"
)
: path.join(os.homedir(), ".config", "devin", "config.json");
},
},
},
cline: {
@@ -205,6 +207,13 @@ const runProcess = (
} = {}
): Promise<any> =>
new Promise((resolve) => {
// Guard: reject commands with shell metacharacters — command comes from
// server-controlled env vars/config, not HTTP input, but belt-and-suspenders.
if (/[;&|`$<>\n\r]/.test(command)) {
resolve({ ok: false, stdout: "", stderr: "rejected: unsafe command path", exitCode: -1 });
return;
}
let stdout = "";
let stderr = "";
let timedOut = false;