From 51c0893673de8e5cea64e64351dbfa4680ba0dec Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 21 Feb 2026 19:57:36 +0100 Subject: [PATCH] refactor(security): remove unused empty allowlist mode --- src/plugin-sdk/allow-from.test.ts | 12 ------------ src/plugin-sdk/allow-from.ts | 5 +---- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/plugin-sdk/allow-from.test.ts b/src/plugin-sdk/allow-from.test.ts index 62fa4a137..cc69376c5 100644 --- a/src/plugin-sdk/allow-from.test.ts +++ b/src/plugin-sdk/allow-from.test.ts @@ -37,18 +37,6 @@ describe("isAllowedParsedChatSender", () => { expect(allowed).toBe(false); }); - it("can explicitly allow when allowFrom is empty", () => { - const allowed = isAllowedParsedChatSender({ - allowFrom: [], - sender: "+15551234567", - emptyAllowFrom: "allow", - normalizeSender: (sender) => sender, - parseAllowTarget, - }); - - expect(allowed).toBe(true); - }); - it("allows wildcard entries", () => { const allowed = isAllowedParsedChatSender({ allowFrom: ["*"], diff --git a/src/plugin-sdk/allow-from.ts b/src/plugin-sdk/allow-from.ts index df3ab305b..39ef27787 100644 --- a/src/plugin-sdk/allow-from.ts +++ b/src/plugin-sdk/allow-from.ts @@ -21,15 +21,12 @@ export function isAllowedParsedChatSender chatId?: number | null; chatGuid?: string | null; chatIdentifier?: string | null; - emptyAllowFrom?: "deny" | "allow"; normalizeSender: (sender: string) => string; parseAllowTarget: (entry: string) => TParsed; }): boolean { const allowFrom = params.allowFrom.map((entry) => String(entry).trim()); if (allowFrom.length === 0) { - // Fail closed by default. Callers can opt into legacy "empty = allow all" - // behavior explicitly when a surface intentionally treats an empty list as open. - return params.emptyAllowFrom === "allow"; + return false; } if (allowFrom.includes("*")) { return true;