fix(plugins): keep auto-enabled channels behind allowlists

This commit is contained in:
Doruk Ardahan
2026-04-03 14:54:41 +03:00
committed by Peter Steinberger
parent f7d24c1ed5
commit cd08facd7a
4 changed files with 76 additions and 2 deletions

View File

@@ -1098,6 +1098,36 @@ describe("loadOpenClawPlugins", () => {
});
});
it("keeps auto-enabled bundled channels behind restrictive allowlists", () => {
setupBundledTelegramPlugin();
const rawConfig = {
channels: {
telegram: {
botToken: "x",
},
},
plugins: {
allow: ["browser"],
},
} satisfies PluginLoadConfig;
const autoEnabled = applyPluginAutoEnable({
config: rawConfig,
env: {},
});
const registry = loadOpenClawPlugins({
cache: false,
workspaceDir: cachedBundledTelegramDir,
config: autoEnabled.config,
activationSourceConfig: rawConfig,
autoEnabledReasons: autoEnabled.autoEnabledReasons,
});
const telegram = registry.plugins.find((entry) => entry.id === "telegram");
expect(telegram?.status).toBe("disabled");
expect(telegram?.error).toBe("not in allowlist");
});
it("preserves all auto-enable reasons in activation metadata", () => {
setupBundledTelegramPlugin();
const rawConfig = {