fix(plugins): rename bundled allowlist discovery policy

This commit is contained in:
Peter Steinberger
2026-05-04 09:42:37 +01:00
parent 76e0bcd2de
commit 41257a5f6f
20 changed files with 114 additions and 63 deletions

View File

@@ -79,10 +79,10 @@ export function withActivatedPluginIds(params: {
return params.config;
}
const originalAllow = params.config?.plugins?.allow ?? [];
// Empty allowlists are still open; respect-allow only stops compat from widening configured allowlists.
const respectAllow =
params.config?.plugins?.bundledMode === "respect-allow" && originalAllow.length > 0;
const originalAllowSet = respectAllow ? new Set(originalAllow) : undefined;
// Empty allowlists are still open; allowlist mode only stops compat from widening configured allowlists.
const useAllowlistDiscovery =
params.config?.plugins?.bundledDiscovery === "allowlist" && originalAllow.length > 0;
const originalAllowSet = useAllowlistDiscovery ? new Set(originalAllow) : undefined;
const allow = new Set(originalAllow);
const entries = {
...params.config?.plugins?.entries,

View File

@@ -6,7 +6,7 @@ export function withBundledPluginAllowlistCompat(params: {
config: OpenClawConfig | undefined;
pluginIds: readonly string[];
}): OpenClawConfig | undefined {
if (params.config?.plugins?.bundledMode === "respect-allow") {
if (params.config?.plugins?.bundledDiscovery === "allowlist") {
return params.config;
}
const allow = params.config?.plugins?.allow;
@@ -42,8 +42,8 @@ export function withBundledPluginEnablementCompat(params: {
}): OpenClawConfig | undefined {
const existingEntries = params.config?.plugins?.entries ?? {};
const forcePluginsEnabled = params.config?.plugins?.enabled === false;
const respectAllow = params.config?.plugins?.bundledMode === "respect-allow";
const allowSet = respectAllow ? new Set(params.config?.plugins?.allow ?? []) : undefined;
const useAllowlistDiscovery = params.config?.plugins?.bundledDiscovery === "allowlist";
const allowSet = useAllowlistDiscovery ? new Set(params.config?.plugins?.allow ?? []) : undefined;
let changed = false;
const nextEntries: Record<string, PluginEntryConfig> = { ...existingEntries };

View File

@@ -593,7 +593,7 @@ describe("resolvePluginProviders", () => {
).toEqual(["legacy-auth-owner"]);
});
it("filters bundled provider plugins by allowlist when bundledMode is respect-allow", () => {
it("filters bundled provider plugins by allowlist when bundledDiscovery is allowlist", () => {
setManifestPlugins([
createManifestProviderPlugin({
id: "kilocode",
@@ -619,7 +619,7 @@ describe("resolvePluginProviders", () => {
config: {
plugins: {
allow: ["openrouter"],
bundledMode: "respect-allow",
bundledDiscovery: "allowlist",
},
},
env: {} as NodeJS.ProcessEnv,

View File

@@ -255,7 +255,7 @@ export function resolveDiscoveredProviderPluginIds(params: {
const { registry, onlyPluginIdSet } = loadScopedProviderRegistry(params);
const providerSurfacePluginIds = resolveProviderSurfacePluginIdSet({ ...params, registry });
const shouldFilterUntrustedWorkspacePlugins = params.includeUntrustedWorkspacePlugins === false;
const shouldFilterBundledByAllowlist = params.config?.plugins?.bundledMode === "respect-allow";
const shouldFilterBundledByAllowlist = params.config?.plugins?.bundledDiscovery === "allowlist";
const normalizedConfig = normalizePluginsConfigWithRegistry(params.config?.plugins, registry);
return listRegistryPluginIds(registry, (plugin) => {
if (
@@ -313,7 +313,7 @@ export function resolveDiscoverableProviderOwnerPluginIds(params: {
includeUntrustedWorkspacePlugins?: boolean;
}): string[] {
const shouldFilterUntrustedWorkspacePlugins = params.includeUntrustedWorkspacePlugins === false;
const shouldFilterBundledByAllowlist = params.config?.plugins?.bundledMode === "respect-allow";
const shouldFilterBundledByAllowlist = params.config?.plugins?.bundledDiscovery === "allowlist";
return resolveProviderOwnerPluginIds({
...params,
isEligible: (plugin, normalizedConfig) =>

View File

@@ -88,7 +88,7 @@ describe("web provider public artifact manifest fallback", () => {
});
});
it("keeps explicit bundled web-search public artifact candidates inside respect-allow", () => {
it("keeps explicit bundled web-search public artifact candidates inside allowlist discovery", () => {
const resolveExplicitWebSearchProviders =
mocks.resolveBundledExplicitWebSearchProvidersFromPublicArtifacts as unknown as {
mockImplementation: (
@@ -105,7 +105,7 @@ describe("web provider public artifact manifest fallback", () => {
config: {
plugins: {
allow: ["fallback-search"],
bundledMode: "respect-allow",
bundledDiscovery: "allowlist",
},
},
onlyPluginIds: ["blocked-search", "fallback-search"],
@@ -117,7 +117,7 @@ describe("web provider public artifact manifest fallback", () => {
});
});
it("keeps manifest bundled web-fetch public artifact candidates inside respect-allow", () => {
it("keeps manifest bundled web-fetch public artifact candidates inside allowlist discovery", () => {
mocks.loadPluginMetadataSnapshot.mockReturnValueOnce({
diagnostics: [],
plugins: [
@@ -140,7 +140,7 @@ describe("web provider public artifact manifest fallback", () => {
config: {
plugins: {
allow: ["fallback-fetch"],
bundledMode: "respect-allow",
bundledDiscovery: "allowlist",
},
},
});

View File

@@ -26,13 +26,13 @@ type BundledCandidateResolution = {
manifestRecords?: readonly PluginManifestRecord[];
};
function filterRespectAllowBundledPluginIds(
function filterAllowlistedBundledPluginIds(
config: PluginLoadOptions["config"] | undefined,
pluginIds: readonly string[],
) {
const allow = config?.plugins?.allow;
if (
config?.plugins?.bundledMode !== "respect-allow" ||
config?.plugins?.bundledDiscovery !== "allowlist" ||
!Array.isArray(allow) ||
allow.length === 0
) {
@@ -57,7 +57,7 @@ function resolveBundledCandidatePluginIds(params: {
: resolveBundledWebFetchResolutionConfig(params).config;
if (params.onlyPluginIds && params.onlyPluginIds.length > 0) {
return {
pluginIds: filterRespectAllowBundledPluginIds(resolvedConfig, [
pluginIds: filterAllowlistedBundledPluginIds(resolvedConfig, [
...new Set(params.onlyPluginIds),
]).toSorted((left, right) => left.localeCompare(right)),
};
@@ -72,7 +72,7 @@ function resolveBundledCandidatePluginIds(params: {
origin: "bundled",
});
return {
pluginIds: filterRespectAllowBundledPluginIds(resolvedConfig, candidates.pluginIds ?? []),
pluginIds: filterAllowlistedBundledPluginIds(resolvedConfig, candidates.pluginIds ?? []),
...(candidates.manifestRecords ? { manifestRecords: candidates.manifestRecords } : {}),
};
}

View File

@@ -482,7 +482,7 @@ describe("resolvePluginWebSearchProviders", () => {
expectScopedWebSearchCandidates(["brave"]);
});
it("keeps respect-allow web-search provider discovery scoped to the configured allowlist", () => {
it("keeps allowlist web-search provider discovery scoped to the configured allowlist", () => {
loadInstalledPluginManifestRegistryMock.mockReturnValueOnce({
plugins: [
createWebSearchManifestRecord({ id: "brave", providerId: "brave" }),
@@ -495,7 +495,7 @@ describe("resolvePluginWebSearchProviders", () => {
config: {
plugins: {
allow: ["brave"],
bundledMode: "respect-allow",
bundledDiscovery: "allowlist",
},
},
bundledAllowlistCompat: true,
@@ -510,7 +510,7 @@ describe("resolvePluginWebSearchProviders", () => {
config: expect.objectContaining({
plugins: expect.objectContaining({
allow: ["brave"],
bundledMode: "respect-allow",
bundledDiscovery: "allowlist",
entries: { brave: { enabled: true } },
}),
}),