惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
Recent Announcements
Recent Announcements
V
Visual Studio Blog
博客园 - 叶小钗
H
Help Net Security
aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享
U
Unit 42
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
F
Fortinet All Blogs
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
WordPress大学
WordPress大学
D
DataBreaches.Net
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
A
About on SuperTechFans
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
C
Check Point Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
M
MIT News - Artificial intelligence

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(signal): match group allowlists against group ids · o...
steipete · 2026-04-30 · via Recent Commits to openclaw:main

@@ -1,5 +1,105 @@

11

import { describe, expect, it, vi } from "vitest";

2-

import { handleSignalDirectMessageAccess } from "./access-policy.js";

2+

import { handleSignalDirectMessageAccess, resolveSignalAccessState } from "./access-policy.js";

3+4+

vi.mock("openclaw/plugin-sdk/security-runtime", async (importOriginal) => ({

5+

...(await importOriginal<typeof import("openclaw/plugin-sdk/security-runtime")>()),

6+

readStoreAllowFromForDmPolicy: vi.fn(async () => []),

7+

}));

8+9+

const SIGNAL_GROUP_ID = "signal-group-id";

10+

const OTHER_SIGNAL_GROUP_ID = "other-signal-group-id";

11+

const SIGNAL_SENDER = {

12+

kind: "phone" as const,

13+

e164: "+15551230000",

14+

raw: "+15551230000",

15+

};

16+17+

async function resolveGroupAccess(params: {

18+

allowFrom?: string[];

19+

groupAllowFrom?: string[];

20+

groupId?: string;

21+

}) {

22+

const access = await resolveSignalAccessState({

23+

accountId: "default",

24+

dmPolicy: "allowlist",

25+

groupPolicy: "allowlist",

26+

allowFrom: params.allowFrom ?? [],

27+

groupAllowFrom: params.groupAllowFrom ?? [],

28+

sender: SIGNAL_SENDER,

29+

groupId: params.groupId,

30+

});

31+

return {

32+

...access,

33+

groupDecision: access.resolveAccessDecision(true),

34+

};

35+

}

36+37+

describe("resolveSignalAccessState", () => {

38+

it("allows group messages when groupAllowFrom contains the inbound Signal group id", async () => {

39+

const { groupDecision } = await resolveGroupAccess({

40+

groupAllowFrom: [SIGNAL_GROUP_ID],

41+

groupId: SIGNAL_GROUP_ID,

42+

});

43+44+

expect(groupDecision.decision).toBe("allow");

45+

});

46+47+

it("allows Signal group target forms in groupAllowFrom", async () => {

48+

const groupTargetDecision = await resolveGroupAccess({

49+

groupAllowFrom: [`group:${SIGNAL_GROUP_ID}`],

50+

groupId: SIGNAL_GROUP_ID,

51+

});

52+

const signalGroupTargetDecision = await resolveGroupAccess({

53+

groupAllowFrom: [`signal:group:${SIGNAL_GROUP_ID}`],

54+

groupId: SIGNAL_GROUP_ID,

55+

});

56+57+

expect(groupTargetDecision.groupDecision.decision).toBe("allow");

58+

expect(signalGroupTargetDecision.groupDecision.decision).toBe("allow");

59+

});

60+61+

it("blocks group messages when groupAllowFrom contains a different Signal group id", async () => {

62+

const { groupDecision } = await resolveGroupAccess({

63+

groupAllowFrom: [OTHER_SIGNAL_GROUP_ID],

64+

groupId: SIGNAL_GROUP_ID,

65+

});

66+67+

expect(groupDecision.decision).toBe("block");

68+

});

69+70+

it("keeps sender allowlist compatibility for Signal group messages", async () => {

71+

const { groupDecision } = await resolveGroupAccess({

72+

groupAllowFrom: [SIGNAL_SENDER.e164],

73+

groupId: SIGNAL_GROUP_ID,

74+

});

75+76+

expect(groupDecision.decision).toBe("allow");

77+

});

78+79+

it("does not match group ids against direct-message allowFrom entries", async () => {

80+

const { dmAccess } = await resolveSignalAccessState({

81+

accountId: "default",

82+

dmPolicy: "allowlist",

83+

groupPolicy: "allowlist",

84+

allowFrom: [SIGNAL_GROUP_ID],

85+

groupAllowFrom: [],

86+

sender: SIGNAL_SENDER,

87+

groupId: SIGNAL_GROUP_ID,

88+

});

89+90+

expect(dmAccess.decision).toBe("block");

91+

});

92+93+

it("does not let group ids in allowFrom satisfy an explicit groupAllowFrom mismatch", async () => {

94+

const { groupDecision } = await resolveGroupAccess({

95+

allowFrom: [SIGNAL_GROUP_ID],

96+

groupAllowFrom: [OTHER_SIGNAL_GROUP_ID],

97+

groupId: SIGNAL_GROUP_ID,

98+

});

99+100+

expect(groupDecision.decision).toBe("block");

101+

});

102+

});

31034104

describe("handleSignalDirectMessageAccess", () => {

5105

it("returns true for already-allowed direct messages", async () => {