fix(config): keep built-in channels out of plugin allowlists (#52964)

* fix(config): keep built-in channels out of plugin allowlists

* docs(changelog): note doctor whatsapp allowlist fix

* docs(changelog): move doctor whatsapp fix to top
This commit is contained in:
Vincent Koc
2026-03-23 08:26:51 -07:00
committed by GitHub
parent 70b235f312
commit e68cbea5b4
3 changed files with 25 additions and 4 deletions

View File

@@ -127,12 +127,12 @@ afterEach(() => {
});
describe("applyPluginAutoEnable", () => {
it("auto-enables built-in channels and appends to existing allowlist", () => {
it("auto-enables built-in channels without appending to plugins.allow", () => {
const result = applyWithSlackConfig({ plugins: { allow: ["telegram"] } });
expect(result.config.channels?.slack?.enabled).toBe(true);
expect(result.config.plugins?.entries?.slack).toBeUndefined();
expect(result.config.plugins?.allow).toEqual(["telegram", "slack"]);
expect(result.config.plugins?.allow).toEqual(["telegram"]);
expect(result.changes.join("\n")).toContain("Slack configured, enabled automatically.");
});
@@ -179,6 +179,27 @@ describe("applyPluginAutoEnable", () => {
expect(validated.ok).toBe(true);
});
it("does not append built-in WhatsApp to plugins.allow during auto-enable", () => {
const result = applyPluginAutoEnable({
config: {
channels: {
whatsapp: {
allowFrom: ["+15555550123"],
},
},
plugins: {
allow: ["telegram"],
},
},
env: {},
});
expect(result.config.channels?.whatsapp?.enabled).toBe(true);
expect(result.config.plugins?.allow).toEqual(["telegram"]);
const validated = validateConfigObject(result.config);
expect(validated.ok).toBe(true);
});
it("respects explicit disable", () => {
const result = applyPluginAutoEnable({
config: {

View File

@@ -478,7 +478,7 @@ export function applyPluginAutoEnable(params: {
continue;
}
next = registerPluginEntry(next, entry.pluginId);
if (allowMissing || !builtInChannelId) {
if (!builtInChannelId) {
next = ensurePluginAllowlisted(next, entry.pluginId);
}
changes.push(formatAutoEnableChange(entry));