fix: enforce strict exec approval optionals (#1414) (thanks @czekaj)

This commit is contained in:
Peter Steinberger 2026-01-22 03:11:06 +00:00
parent fc6a35797a
commit 43b55a8c3a
2 changed files with 40 additions and 0 deletions

View File

@ -14,6 +14,7 @@ Docs: https://docs.clawd.bot
- Config: avoid stack traces for invalid configs and log the config path.
- Doctor: warn when gateway.mode is unset with configure/config guidance.
- macOS: include Textual syntax highlighting resources in packaged app to prevent chat crashes. (#1362)
- Exec approvals: send optional approval params as undefined instead of null. (#1414) Thanks @czekaj.
- UI: refresh debug panel on route-driven tab changes. (#1373) Thanks @yazinsai.
## 2026.1.21

View File

@ -47,6 +47,45 @@ describe("exec approval handlers", () => {
};
expect(validateExecApprovalRequestParams(params)).toBe(false);
});
it("accepts request with sessionKey omitted", () => {
const params = {
command: "echo hi",
cwd: "/tmp",
host: "node",
};
expect(validateExecApprovalRequestParams(params)).toBe(true);
});
it("accepts request with sessionKey as string", () => {
const params = {
command: "echo hi",
cwd: "/tmp",
host: "node",
sessionKey: "session-1",
};
expect(validateExecApprovalRequestParams(params)).toBe(true);
});
it("accepts request with sessionKey as undefined", () => {
const params = {
command: "echo hi",
cwd: "/tmp",
host: "node",
sessionKey: undefined,
};
expect(validateExecApprovalRequestParams(params)).toBe(true);
});
it("rejects request with sessionKey as null", () => {
const params = {
command: "echo hi",
cwd: "/tmp",
host: "node",
sessionKey: null,
};
expect(validateExecApprovalRequestParams(params)).toBe(false);
});
});
it("broadcasts request + resolve", async () => {