Skip to content

Commit ff85c33

Browse files
committed
fix(secrets): support host plugin loadouts
1 parent a768674 commit ff85c33

2 files changed

Lines changed: 67 additions & 8 deletions

File tree

‎src/secrets/runtime-fast-path.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ function isKeylessHostProxiedWebSearchSurface(
196196
if (
197197
plugins &&
198198
(plugins.enabled === false ||
199-
(Array.isArray(plugins.allow) && plugins.allow.some((pluginId) => pluginId !== providerId)) ||
200-
(Array.isArray(plugins.deny) && plugins.deny.length > 0) ||
201-
(isRecord(plugins.load) &&
202-
Array.isArray(plugins.load.paths) &&
203-
plugins.load.paths.length > 0))
199+
(Array.isArray(plugins.allow) && !plugins.allow.includes(providerId)) ||
200+
(Array.isArray(plugins.deny) && plugins.deny.includes(providerId)))
204201
) {
205202
return false;
206203
}
204+
// Unrelated plugin load paths are safe here: the loop below rejects any
205+
// additional web provider surface, and the outer fast-path guard still scans
206+
// the complete config for credential-bearing SecretRefs.
207207
let matchedKeylessProvider = false;
208208
for (const [pluginId, entry] of Object.entries(entries)) {
209209
if (!isRecord(entry)) {

‎src/secrets/runtime.fast-path.test.ts‎

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,43 @@ describe("secrets runtime fast path", () => {
200200
expect(snapshot.webTools.search.providerSource).toBe("none");
201201
});
202202

203+
it("uses the fast path with the host's unrelated plugin loadout", async () => {
204+
const { prepareSecretsRuntimeSnapshot } = await import("./runtime.js");
205+
206+
const snapshot = await prepareSecretsRuntimeSnapshot({
207+
config: asConfig({
208+
tools: { web: { search: { provider: "webiq" } } },
209+
plugins: {
210+
enabled: true,
211+
allow: ["workiq-code-mode", "tools-code-mode", "webiq", "diagnostics-otel"],
212+
load: {
213+
paths: [
214+
"/app/plugins/workiq-code-mode",
215+
"/app/plugins/tools-code-mode",
216+
"/app/plugins/webiq",
217+
"/usr/lib/node_modules/@openclaw/diagnostics-otel",
218+
],
219+
},
220+
entries: {
221+
"workiq-code-mode": { config: { enabledNamespaces: ["m365", "search"] } },
222+
"tools-code-mode": { enabled: true },
223+
webiq: {
224+
enabled: true,
225+
config: { webSearch: { omitAuth: true, region: "US" } },
226+
},
227+
"diagnostics-otel": { enabled: true },
228+
},
229+
},
230+
}),
231+
env: {},
232+
agentDirs: ["/tmp/openclaw-agent-main"],
233+
loadAuthStore: emptyAuthStore,
234+
});
235+
236+
expect(runtimePrepareImportMock).not.toHaveBeenCalled();
237+
expect(snapshot.webTools.search.providerSource).toBe("none");
238+
});
239+
203240
it.each([
204241
{
205242
name: "credential-bearing keyless provider config",
@@ -357,7 +394,7 @@ describe("secrets runtime fast path", () => {
357394
},
358395
},
359396
{
360-
name: "custom plugin load path",
397+
name: "allowlist that omits the selected provider",
361398
config: {
362399
tools: {
363400
web: {
@@ -367,9 +404,31 @@ describe("secrets runtime fast path", () => {
367404
},
368405
},
369406
plugins: {
370-
load: {
371-
paths: ["/tmp/custom-search-plugin"],
407+
allow: ["different-plugin"],
408+
entries: {
409+
"host-proxy-search": {
410+
config: {
411+
webSearch: {
412+
omitAuth: true,
413+
},
414+
},
415+
},
416+
},
417+
},
418+
},
419+
},
420+
{
421+
name: "denylist containing the selected provider",
422+
config: {
423+
tools: {
424+
web: {
425+
search: {
426+
provider: "host-proxy-search",
427+
},
372428
},
429+
},
430+
plugins: {
431+
deny: ["host-proxy-search"],
373432
entries: {
374433
"host-proxy-search": {
375434
config: {

0 commit comments

Comments
 (0)