mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:00:54 +00:00
fix: align open DM allowlist policy (#74112)
* fix: harden telegram open dm allowlist merging * fix: align open dm allowlist policy
This commit is contained in:
committed by
GitHub
parent
fda8cc2a9d
commit
bd1d1f0f2b
@@ -31,7 +31,7 @@ describe("resolveIMessageInboundDecision echo detection", () => {
|
||||
cfg,
|
||||
accountId: "default",
|
||||
opts: undefined,
|
||||
allowFrom: [],
|
||||
allowFrom: ["*"],
|
||||
groupAllowFrom: [],
|
||||
groupPolicy: "open",
|
||||
dmPolicy: "open",
|
||||
@@ -303,7 +303,12 @@ describe("describeIMessageEchoDropLog", () => {
|
||||
|
||||
describe("resolveIMessageInboundDecision command auth", () => {
|
||||
const cfg = {} as OpenClawConfig;
|
||||
const resolveDmCommandDecision = (params: { messageId: number; storeAllowFrom: string[] }) =>
|
||||
const resolveDmCommandDecision = (params: {
|
||||
messageId: number;
|
||||
storeAllowFrom: string[];
|
||||
dmPolicy?: "open" | "pairing" | "allowlist" | "disabled";
|
||||
allowFrom?: string[];
|
||||
}) =>
|
||||
resolveIMessageInboundDecision({
|
||||
cfg,
|
||||
accountId: "default",
|
||||
@@ -317,10 +322,10 @@ describe("resolveIMessageInboundDecision command auth", () => {
|
||||
opts: undefined,
|
||||
messageText: "/status",
|
||||
bodyText: "/status",
|
||||
allowFrom: [],
|
||||
allowFrom: params.allowFrom ?? [],
|
||||
groupAllowFrom: [],
|
||||
groupPolicy: "open",
|
||||
dmPolicy: "open",
|
||||
dmPolicy: params.dmPolicy ?? "open",
|
||||
storeAllowFrom: params.storeAllowFrom,
|
||||
historyLimit: 0,
|
||||
groupHistories: new Map(),
|
||||
@@ -334,16 +339,13 @@ describe("resolveIMessageInboundDecision command auth", () => {
|
||||
storeAllowFrom: [],
|
||||
});
|
||||
|
||||
expect(decision.kind).toBe("dispatch");
|
||||
if (decision.kind !== "dispatch") {
|
||||
return;
|
||||
}
|
||||
expect(decision.commandAuthorized).toBe(false);
|
||||
expect(decision).toEqual({ kind: "drop", reason: "dmPolicy blocked" });
|
||||
});
|
||||
|
||||
it("authorizes DM commands for senders in pairing-store allowlist", () => {
|
||||
it("authorizes DM commands for senders in pairing-mode store allowlist", () => {
|
||||
const decision = resolveDmCommandDecision({
|
||||
messageId: 101,
|
||||
dmPolicy: "pairing",
|
||||
storeAllowFrom: ["+15555550123"],
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user