mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-28 17:43:05 +00:00
fix(plugins): allow configured bundled channels past allowlists
This commit is contained in:
committed by
Peter Steinberger
parent
2ad69083d2
commit
f7d24c1ed5
@@ -177,10 +177,7 @@ describe("resolveEffectiveEnableState", () => {
|
||||
|
||||
it.each([
|
||||
[{ enabled: true }, { enabled: true }],
|
||||
[
|
||||
{ enabled: true, allow: ["browser"] as string[] },
|
||||
{ enabled: false, reason: "not in allowlist" },
|
||||
],
|
||||
[{ enabled: true, allow: ["browser"] as string[] }, { enabled: true }],
|
||||
[
|
||||
{
|
||||
enabled: true,
|
||||
@@ -324,7 +321,7 @@ describe("resolveEffectivePluginActivationState", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps allowlists authoritative over bundled channel activation", () => {
|
||||
it("lets explicit bundled channel activation bypass the allowlist", () => {
|
||||
const rawConfig = {
|
||||
channels: {
|
||||
telegram: {
|
||||
@@ -346,11 +343,11 @@ describe("resolveEffectivePluginActivationState", () => {
|
||||
sourceRootConfig: rawConfig,
|
||||
}),
|
||||
).toEqual({
|
||||
enabled: false,
|
||||
activated: false,
|
||||
enabled: true,
|
||||
activated: true,
|
||||
explicitlyEnabled: true,
|
||||
source: "disabled",
|
||||
reason: "not in allowlist",
|
||||
source: "explicit",
|
||||
reason: "channel enabled in config",
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -285,6 +285,10 @@ export function resolvePluginActivationState(params: {
|
||||
config: params.sourceConfig ?? params.config,
|
||||
rootConfig: params.sourceRootConfig ?? params.rootConfig,
|
||||
});
|
||||
const explicitlyConfiguredBundledChannel =
|
||||
params.origin === "bundled" &&
|
||||
explicitSelection.reason === "channel enabled in config" &&
|
||||
explicitSelection.explicitlyEnabled;
|
||||
|
||||
if (!params.config.enabled) {
|
||||
return {
|
||||
@@ -333,7 +337,7 @@ export function resolvePluginActivationState(params: {
|
||||
reason: "selected memory slot",
|
||||
};
|
||||
}
|
||||
if (params.config.allow.length > 0 && !explicitlyAllowed) {
|
||||
if (params.config.allow.length > 0 && !explicitlyAllowed && !explicitlyConfiguredBundledChannel) {
|
||||
return {
|
||||
enabled: false,
|
||||
activated: false,
|
||||
|
||||
@@ -1017,7 +1017,7 @@ describe("loadOpenClawPlugins", () => {
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "blocks bundled channel plugins when channels.<id>.enabled=true but plugins.allow excludes them",
|
||||
name: "loads bundled channel plugins when channels.<id>.enabled=true even if plugins.allow excludes them",
|
||||
config: {
|
||||
channels: {
|
||||
telegram: {
|
||||
@@ -1029,9 +1029,7 @@ describe("loadOpenClawPlugins", () => {
|
||||
},
|
||||
} satisfies PluginLoadConfig,
|
||||
assert: (registry: ReturnType<typeof loadOpenClawPlugins>) => {
|
||||
const telegram = registry.plugins.find((entry) => entry.id === "telegram");
|
||||
expect(telegram?.status).toBe("disabled");
|
||||
expect(telegram?.error).toBe("not in allowlist");
|
||||
expectTelegramLoaded(registry);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user