mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 15:08:25 +00:00
refactor(security): unify gateway scope authorization flows
This commit is contained in:
@@ -13,6 +13,7 @@ const setRegistry = (registry: ReturnType<typeof createTestRegistry>) => {
|
||||
const callGatewayMock = vi.fn();
|
||||
vi.mock("../../gateway/call.js", () => ({
|
||||
callGateway: (...args: unknown[]) => callGatewayMock(...args),
|
||||
callGatewayLeastPrivilege: (...args: unknown[]) => callGatewayMock(...args),
|
||||
randomIdempotencyKey: () => "idem-1",
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getChannelPlugin, normalizeChannelId } from "../../channels/plugins/index.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { loadConfig } from "../../config/config.js";
|
||||
import { callGateway, randomIdempotencyKey } from "../../gateway/call.js";
|
||||
import { callGatewayLeastPrivilege, randomIdempotencyKey } from "../../gateway/call.js";
|
||||
import type { PollInput } from "../../polls.js";
|
||||
import { normalizePollInput } from "../../polls.js";
|
||||
import {
|
||||
@@ -151,7 +151,7 @@ async function callMessageGateway<T>(params: {
|
||||
params: Record<string, unknown>;
|
||||
}): Promise<T> {
|
||||
const gateway = resolveGatewayOptions(params.gateway);
|
||||
return await callGateway<T>({
|
||||
return await callGatewayLeastPrivilege<T>({
|
||||
url: gateway.url,
|
||||
token: gateway.token,
|
||||
method: params.method,
|
||||
|
||||
Reference in New Issue
Block a user