fix(security): bind system.run approvals to exact argv text
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { formatExecCommand } from "../infra/system-run-command.js";
|
||||
|
||||
type SystemRunPrepareInput = {
|
||||
command?: unknown;
|
||||
rawCommand?: unknown;
|
||||
@@ -12,13 +14,16 @@ export function buildSystemRunPreparePayload(params: SystemRunPrepareInput) {
|
||||
typeof params.rawCommand === "string" && params.rawCommand.trim().length > 0
|
||||
? params.rawCommand
|
||||
: null;
|
||||
const formattedArgv = formatExecCommand(argv) || null;
|
||||
const commandPreview = rawCommand && rawCommand !== formattedArgv ? rawCommand : null;
|
||||
return {
|
||||
payload: {
|
||||
cmdText: rawCommand ?? argv.join(" "),
|
||||
plan: {
|
||||
argv,
|
||||
cwd: typeof params.cwd === "string" ? params.cwd : null,
|
||||
rawCommand,
|
||||
rawCommand: formattedArgv,
|
||||
commandPreview,
|
||||
agentId: typeof params.agentId === "string" ? params.agentId : null,
|
||||
sessionKey: typeof params.sessionKey === "string" ? params.sessionKey : null,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user