fix(commands): honor channel-native command auth · openclaw/openclaw@7b91f06
obviyus
·
2026-04-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -53,6 +53,30 @@ describe("senderIsOwner only reflects explicit owner authorization", () => {
|
53 | 53 | expect(auth.isAuthorizedSender).toBe(true); |
54 | 54 | }); |
55 | 55 | |
| 56 | +it("keeps channel-validated native group commands authorized without owner status", () => { |
| 57 | +const cfg = { |
| 58 | +channels: { telegram: {} }, |
| 59 | +} as OpenClawConfig; |
| 60 | + |
| 61 | +const ctx = { |
| 62 | +Provider: "telegram", |
| 63 | +Surface: "telegram", |
| 64 | +ChatType: "group", |
| 65 | +From: "telegram:group:-100123", |
| 66 | +SenderId: "200482621", |
| 67 | +CommandSource: "native", |
| 68 | +} as MsgContext; |
| 69 | + |
| 70 | +const auth = resolveCommandAuthorization({ |
| 71 | + ctx, |
| 72 | + cfg, |
| 73 | +commandAuthorized: true, |
| 74 | +}); |
| 75 | + |
| 76 | +expect(auth.senderIsOwner).toBe(false); |
| 77 | +expect(auth.isAuthorizedSender).toBe(true); |
| 78 | +}); |
| 79 | + |
56 | 80 | it("senderIsOwner is false when ownerAllowFrom is configured and sender does not match", () => { |
57 | 81 | const cfg = { |
58 | 82 | channels: { discord: {} }, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。