mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 00:14:34 +00:00
fix(security): make allowFrom id-only by default with dangerous name opt-in (#24907)
* fix(channels): default allowFrom to id-only; add dangerous name opt-in * docs(security): align channel allowFrom docs with id-only default
This commit is contained in:
committed by
GitHub
parent
41b0568b35
commit
cfa44ea6b4
@@ -170,6 +170,7 @@ describe("agent components", () => {
|
||||
const select = createAgentSelectMenu({
|
||||
cfg: createCfg(),
|
||||
accountId: "default",
|
||||
discordConfig: { dangerouslyAllowNameMatching: true } as DiscordAccountConfig,
|
||||
dmPolicy: "allowlist",
|
||||
allowFrom: ["Alice#1234"],
|
||||
});
|
||||
@@ -426,13 +427,20 @@ describe("resolveDiscordOwnerAllowFrom", () => {
|
||||
expect(result).toEqual(["123"]);
|
||||
});
|
||||
|
||||
it("returns the normalized name slug for name matches", () => {
|
||||
const result = resolveDiscordOwnerAllowFrom({
|
||||
it("returns the normalized name slug for name matches only when enabled", () => {
|
||||
const defaultResult = resolveDiscordOwnerAllowFrom({
|
||||
channelConfig: { allowed: true, users: ["Some User"] } as DiscordChannelConfigResolved,
|
||||
sender: { id: "999", name: "Some User" },
|
||||
});
|
||||
expect(defaultResult).toBeUndefined();
|
||||
|
||||
expect(result).toEqual(["some-user"]);
|
||||
const enabledResult = resolveDiscordOwnerAllowFrom({
|
||||
channelConfig: { allowed: true, users: ["Some User"] } as DiscordChannelConfigResolved,
|
||||
sender: { id: "999", name: "Some User" },
|
||||
allowNameMatching: true,
|
||||
});
|
||||
|
||||
expect(enabledResult).toEqual(["some-user"]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user