plugins: suppress provenance warning for allowlisted local plugins (#58604)

Co-authored-by: me <shlomo@vmi1916417.contaboserver.net>
This commit is contained in:
dudu1111685
2026-04-01 04:10:30 +03:00
committed by GitHub
parent d2663262d4
commit ed8e6b0a74
2 changed files with 36 additions and 1 deletions

View File

@@ -3633,7 +3633,7 @@ module.exports = {
useNoBundledPlugins();
const scenarios = [
{
label: "warns when loaded non-bundled plugin has no install/load-path provenance",
label: "does not warn when loaded non-bundled plugin is in plugins.allow",
loadRegistry: () => {
return withStateDir((stateDir) => {
const globalDir = path.join(stateDir, "extensions", "rogue");
@@ -3656,6 +3656,35 @@ module.exports = {
},
});
return { registry, warnings, pluginId: "rogue", expectWarning: false };
});
},
},
{
label: "warns when loaded non-bundled plugin has no provenance and no allowlist is set",
loadRegistry: () => {
const stateDir = makeTempDir();
return withEnv({ OPENCLAW_STATE_DIR: stateDir }, () => {
const globalDir = path.join(stateDir, "extensions", "rogue");
mkdirSafe(globalDir);
writePlugin({
id: "rogue",
body: `module.exports = { id: "rogue", register() {} };`,
dir: globalDir,
filename: "index.cjs",
});
const warnings: string[] = [];
const registry = loadOpenClawPlugins({
cache: false,
logger: createWarningLogger(warnings),
config: {
plugins: {
enabled: true,
},
},
});
return { registry, warnings, pluginId: "rogue", expectWarning: true };
});
},