fix (commands): keep webchat auth on internal provider
This commit is contained in:
@@ -212,6 +212,28 @@ describe("resolveCommandAuthorization", () => {
|
||||
expect(auth.ownerList).toEqual(["123"]);
|
||||
});
|
||||
|
||||
it("does not infer a provider from channel allowlists for webchat command contexts", () => {
|
||||
const cfg = {
|
||||
channels: { whatsapp: { allowFrom: ["+15551234567"] } },
|
||||
} as OpenClawConfig;
|
||||
|
||||
const ctx = {
|
||||
Provider: "webchat",
|
||||
Surface: "webchat",
|
||||
OriginatingChannel: "webchat",
|
||||
SenderId: "openclaw-control-ui",
|
||||
} as MsgContext;
|
||||
|
||||
const auth = resolveCommandAuthorization({
|
||||
ctx,
|
||||
cfg,
|
||||
commandAuthorized: true,
|
||||
});
|
||||
|
||||
expect(auth.providerId).toBeUndefined();
|
||||
expect(auth.isAuthorizedSender).toBe(true);
|
||||
});
|
||||
|
||||
describe("commands.allowFrom", () => {
|
||||
const commandsAllowFromConfig = {
|
||||
commands: {
|
||||
|
||||
Reference in New Issue
Block a user