mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 07:50:43 +00:00
fix(device-pair): reject invalid remote setup URLs
Fail setup-code generation when gateway.remote.url is configured but malformed, instead of falling back to a bind-derived URL and issuing a bootstrap token.
This commit is contained in:
@@ -413,6 +413,23 @@ describe("registerQrCli", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects invalid gateway.remote.url before printing remote setup codes", async () => {
|
||||
loadConfig.mockReturnValue({
|
||||
gateway: {
|
||||
bind: "custom",
|
||||
customBindHost: "127.0.0.1",
|
||||
remote: { url: "http://localhost:notaport", token: "remote-tok" },
|
||||
auth: { mode: "token", token: "local-tok" },
|
||||
},
|
||||
});
|
||||
|
||||
await expectQrExit(["--setup-code-only", "--remote"]);
|
||||
|
||||
const output = runtimeError.mock.calls.map((call) => readRuntimeCallText(call)).join("\n");
|
||||
expect(output).toContain("Configured gateway.remote.url is invalid.");
|
||||
expect(runtime.log).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("logs remote secret diagnostics in non-json output mode", async () => {
|
||||
loadConfig.mockReturnValue(createRemoteQrConfig());
|
||||
resolveCommandSecretRefsViaGateway.mockResolvedValueOnce({
|
||||
|
||||
Reference in New Issue
Block a user