fix(gateway): bind node exec approvals to nodeId
This commit is contained in:
@@ -248,6 +248,7 @@ describe("exec approval handlers", () => {
|
||||
const defaultExecApprovalRequestParams = {
|
||||
command: "echo ok",
|
||||
cwd: "/tmp",
|
||||
nodeId: "node-1",
|
||||
host: "node",
|
||||
timeoutMs: 2000,
|
||||
} as const;
|
||||
@@ -323,6 +324,7 @@ describe("exec approval handlers", () => {
|
||||
const params = {
|
||||
command: "echo hi",
|
||||
cwd: "/tmp",
|
||||
nodeId: "node-1",
|
||||
host: "node",
|
||||
};
|
||||
expect(validateExecApprovalRequestParams(params)).toBe(true);
|
||||
@@ -332,6 +334,7 @@ describe("exec approval handlers", () => {
|
||||
const params = {
|
||||
command: "echo hi",
|
||||
cwd: "/tmp",
|
||||
nodeId: "node-1",
|
||||
host: "node",
|
||||
resolvedPath: "/usr/bin/echo",
|
||||
};
|
||||
@@ -342,6 +345,7 @@ describe("exec approval handlers", () => {
|
||||
const params = {
|
||||
command: "echo hi",
|
||||
cwd: "/tmp",
|
||||
nodeId: "node-1",
|
||||
host: "node",
|
||||
resolvedPath: undefined,
|
||||
};
|
||||
@@ -352,6 +356,7 @@ describe("exec approval handlers", () => {
|
||||
const params = {
|
||||
command: "echo hi",
|
||||
cwd: "/tmp",
|
||||
nodeId: "node-1",
|
||||
host: "node",
|
||||
resolvedPath: null,
|
||||
};
|
||||
@@ -359,6 +364,25 @@ describe("exec approval handlers", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects host=node approval requests without nodeId", async () => {
|
||||
const { handlers, respond, context } = createExecApprovalFixture();
|
||||
await requestExecApproval({
|
||||
handlers,
|
||||
respond,
|
||||
context,
|
||||
params: {
|
||||
nodeId: undefined,
|
||||
},
|
||||
});
|
||||
expect(respond).toHaveBeenCalledWith(
|
||||
false,
|
||||
undefined,
|
||||
expect.objectContaining({
|
||||
message: "nodeId is required for host=node",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("broadcasts request + resolve", async () => {
|
||||
const { handlers, broadcasts, respond, context } = createExecApprovalFixture();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user