revert #386 due to unsafe shell command parsing (#478)

Reverts https://github.com/openai/codex/pull/386 because:

* The parsing logic for shell commands was unsafe (`split(/\s+/)`
instead of something like `shell-quote`)
* We have a different plan for supporting auto-approved commands.
This commit is contained in:
Michael Bolin
2025-04-21 09:52:11 -07:00
committed by GitHub
parent 797eba4930
commit d36d295a1a
4 changed files with 1 additions and 68 deletions

View File

@@ -78,8 +78,6 @@ export type StoredConfig = {
saveHistory?: boolean;
sensitivePatterns?: Array<string>;
};
/** User-defined safe commands */
safeCommands?: Array<string>;
};
// Minimal config written on first run. An *empty* model string ensures that
@@ -113,8 +111,6 @@ export type AppConfig = {
saveHistory: boolean;
sensitivePatterns: Array<string>;
};
/** User-defined safe commands */
safeCommands?: Array<string>;
};
// ---------------------------------------------------------------------------
@@ -297,7 +293,6 @@ export const loadConfig = (
instructions: combinedInstructions,
notify: storedConfig.notify === true,
approvalMode: storedConfig.approvalMode,
safeCommands: storedConfig.safeCommands ?? [],
};
// -----------------------------------------------------------------------
@@ -375,13 +370,6 @@ export const loadConfig = (
};
}
// Load user-defined safe commands
if (Array.isArray(storedConfig.safeCommands)) {
config.safeCommands = storedConfig.safeCommands.map(String);
} else {
config.safeCommands = [];
}
return config;
};
@@ -425,10 +413,6 @@ export const saveConfig = (
sensitivePatterns: config.history.sensitivePatterns,
};
}
// Save: User-defined safe commands
if (config.safeCommands && config.safeCommands.length > 0) {
configToSave.safeCommands = config.safeCommands;
}
if (ext === ".yaml" || ext === ".yml") {
writeFileSync(targetPath, dumpYaml(configToSave), "utf-8");