fix: redact commander approval reasons
This commit is contained in:
@@ -96,6 +96,32 @@ assertCondition(claudeqq.sendImplemented === false, "ClaudeQQ send must not be i
|
||||
const invalidApproval = dataOf(runCli(["commander", "approval", "request", "--action", "read-token-file", "--dry-run"], 1));
|
||||
assertCondition(invalidApproval.error === "validation-failed", "unsupported approval action must fail validation", invalidApproval);
|
||||
|
||||
const secretReasonResult = spawnSync("bun", [
|
||||
"scripts/cli.ts",
|
||||
"commander",
|
||||
"approval",
|
||||
"request",
|
||||
"--action",
|
||||
"code-queue-backend-restart",
|
||||
"--reason",
|
||||
"token=ghp_1234567890abcdef",
|
||||
"--dry-run",
|
||||
], {
|
||||
cwd: process.cwd(),
|
||||
encoding: "utf8",
|
||||
maxBuffer: 4 * 1024 * 1024,
|
||||
});
|
||||
assertCondition(secretReasonResult.status === 0, "secret-like approval reason command should still return successfully", {
|
||||
stdout: secretReasonResult.stdout,
|
||||
stderr: secretReasonResult.stderr,
|
||||
});
|
||||
assertCondition(!secretReasonResult.stdout.includes("ghp_1234567890abcdef"), "secret-like approval reason must be redacted from stdout", {
|
||||
stdout: secretReasonResult.stdout,
|
||||
});
|
||||
assertCondition(secretReasonResult.stdout.includes("<redacted>"), "redacted approval reason should disclose redaction marker", {
|
||||
stdout: secretReasonResult.stdout,
|
||||
});
|
||||
|
||||
const doc = readFileSync("docs/reference/host-codex-commander.md", "utf8");
|
||||
for (const snippet of [
|
||||
"不直接重启 Code Queue backend",
|
||||
@@ -116,6 +142,7 @@ process.stdout.write(`${JSON.stringify({
|
||||
"dry-run plan covers process discovery, SSH/PTY/stdio bridge, prompt guidance, trace summary, #20/#46 and ClaudeQQ approval",
|
||||
"non-dry-run plan is rejected",
|
||||
"approval request is dry-run only and rejects unsupported high-risk actions",
|
||||
"secret-like approval reasons are redacted from stdout",
|
||||
"reference doc states backend restart, task interrupt/cancel, and token-output prohibitions",
|
||||
],
|
||||
}, null, 2)}\n`);
|
||||
|
||||
Reference in New Issue
Block a user