mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 11:17:40 +00:00
Fix/agent session key normalization (openclaw#15707) thanks @rodrigouroz
Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -285,6 +285,20 @@ describe("gateway server agent", () => {
|
||||
expect(spy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("agent rejects malformed agent-prefixed session keys", async () => {
|
||||
setRegistry(defaultRegistry);
|
||||
const res = await rpcReq(ws, "agent", {
|
||||
message: "hi",
|
||||
sessionKey: "agent:main",
|
||||
idempotencyKey: "idem-agent-malformed-key",
|
||||
});
|
||||
expect(res.ok).toBe(false);
|
||||
expect(res.error?.message).toContain("malformed session key");
|
||||
|
||||
const spy = vi.mocked(agentCommand);
|
||||
expect(spy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("agent forwards accountId to agentCommand", async () => {
|
||||
setRegistry(defaultRegistry);
|
||||
testState.allowFrom = ["+1555"];
|
||||
|
||||
Reference in New Issue
Block a user