Repository navigation
Description
Summary
web_search provider resolution never forwards the sandboxed flag it is given, so the sandboxed-provider trust filter is a no-op for search. A sandboxed agent calling web_search can be served by an arbitrary workspace or external plugin provider, while the same agent calling web_fetch is correctly restricted to bundled or verified-official providers.
Environment
- Commit: 67e99bc (origin/main at time of filing)
- Surface: web_search provider resolution
Steps to reproduce
- Put a workspace-origin plugin at
<workspaceDir>/.openclaw/extensions/untrusted-web/whoseopenclaw.plugin.jsondeclares both contracts, so the same plugin is a candidate for search and for fetch:
{
"id": "untrusted-web",
"contracts": {
"webSearchProviders": ["untrusted"],
"webFetchProviders": ["untrusted"]
}
}- Drive the two real exported resolvers with the exact argument objects the two runtimes build for a sandboxed agent, on identical config and identical workspace:
resolvePluginWebSearchProviders({ config, workspaceDir }); // what web-search builds
resolvePluginWebFetchProviders({ config, workspaceDir, sandboxed: true }); // what web-fetch builds- Compare the returned provider lists.
Expected
For a sandboxed agent the trust filter excludes workspace and external providers from web_search, exactly as it does for web_fetch. The stated policy lives in the filter's own comment: sandboxed web tools may run bundled providers or a verified official install, never an arbitrary workspace or external plugin with the same contract.
Actual
The filter never engages for web_search. The workspace-origin provider is returned to the sandboxed agent.
Root cause
src/web-search/runtime.ts:271-279 builds its own argument object for provider resolution and omits sandboxed:
const resolveProviders = params.preferRuntimeProviders
? resolveRuntimeWebSearchProviders
: resolvePluginWebSearchProviders;
return sortPluginEntriesForAutoDetect(
resolveProviders({
config: params.config,
...(pluginId ? { onlyPluginIds: [pluginId] } : {}),
}),
);The flag is available at that point. ResolveWebSearchDefinitionParams declares sandboxed?: boolean (src/web-search/runtime-types.ts:17), src/agents/openclaw-tools.ts:222-229 passes sandboxed: options?.sandboxed into createWebSearchTool, and src/agents/tools/web-search.ts:127 forwards it into runWebSearch. It is dropped at the resolution call above and nowhere else.
The two resolver wrappers do not accept the field either: resolvePluginWebSearchProviders (src/plugins/web-search-providers.runtime.ts:52-62) and resolveRuntimeWebSearchProviders (:69-76) have no sandboxed in their parameter types, unlike src/plugins/web-fetch-providers.runtime.ts:42.
So the filter at src/plugins/web-provider-resolution-shared.ts:96-101 is only ever reached with params.sandboxed undefined on the search path:
// Sandboxed web tools may run bundled providers or a verified official install,
// never an arbitrary workspace or external plugin with the same contract.
(!params.sandboxed ||
plugin.origin === "bundled" ||
plugin.trustedOfficialInstall === true) &&The shared machinery underneath already honors the flag end to end (src/plugins/web-provider-runtime-shared.ts:26, :93, :107), so nothing else is missing. Only the search wrapper never passes it.
Scope note, deliberately narrow: this is a trust-boundary policy that does not take effect for one tool. It is not a demonstrated sandbox escape or code-execution bypass. The provider still has to be installed and enabled in config to be resolved at all. What is lost is the origin restriction the policy states.
Sibling surfaces
web_fetch threads the flag correctly at src/web-fetch/runtime.ts:212-219, and that call shape is pinned by an assertion at src/web-fetch/runtime.test.ts:491. src/web-search/runtime.test.ts contains zero occurrences of sandboxed. This looks like a one-sided fix: the sibling got the guard and the search path did not.
Suggested fix, since this is an issue and not a patch: thread sandboxed from src/web-search/runtime.ts:271-279 into both resolver signatures the same way src/web-fetch/runtime.ts:212-219 does, and add the mirror of the src/web-fetch/runtime.test.ts:491 assertion.
Real behavior proof
Behavior addressed: for a sandboxed agent, a workspace-origin plugin provider is filtered out of web_fetch resolution but survives web_search resolution.
Real environment tested: real exported provider resolvers driven in-process over a real on-disk workspace plugin, at commit c973fe7 (src/web-search/runtime.ts is byte-identical to 67e99bc)
Exact steps or command run after this patch: node --import ./scripts/tsx.mjs probe.ts, calling resolvePluginWebSearchProviders({config, workspaceDir}) and resolvePluginWebFetchProviders({config, workspaceDir, sandboxed: true}) on the same config and the same workspace containing the untrusted-web plugin above
Evidence after fix:
# OBSERVED (buggy, origin/main c973fe7e72)
web_search shape resolvePluginWebSearchProviders({config}) : ["brave/brave","codex/codex","duckduckgo/duckduckgo","exa/exa","firecrawl/firecrawl","firecrawl/firecrawl-free","google/gemini","xai/grok","moonshot/kimi","minimax/minimax","ollama/ollama","parallel/parallel","parallel/parallel-free","perplexity/perplexity","qa-lab/qa-lab-search","searxng/searxng","tavily/tavily","untrusted-web/untrusted"]
# EXPECTED (correct behavior on identical inputs)
web_fetch shape resolvePluginWebFetchProviders({config,sandboxed}) : ["firecrawl/firecrawl"]
# counterfactual, same search resolver once sandboxed is threaded through
web_search shape + sandboxed threaded : ["brave/brave","codex/codex","duckduckgo/duckduckgo","exa/exa","firecrawl/firecrawl","firecrawl/firecrawl-free","google/gemini","xai/grok","moonshot/kimi","minimax/minimax","ollama/ollama","parallel/parallel","parallel/parallel-free","perplexity/perplexity","qa-lab/qa-lab-search","searxng/searxng","tavily/tavily"]
# control, the same plugin is visible to web_fetch when sandboxed is absent
web_fetch shape, no sandboxed (control) : ["firecrawl/firecrawl","untrusted-web/untrusted"]
Observed result after fix: untrusted-web/untrusted is dropped by the fetch shape and by the counterfactual search shape, and retained only by the search shape as main builds it, so the single differing input is whether sandboxed reaches the resolver.
What was not tested: no live sandboxed agent session was run and no network search was issued, so the downstream consequence of the untrusted provider actually answering a query is inferred from resolution output rather than observed; the preferRuntimeProviders branch through resolveRuntimeWebSearchProviders was read but not driven; the workspace plugin used here is a minimal local one rather than a published external install, so the trustedOfficialInstall arm of the filter was not exercised.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Sep 10, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed September 10, 2026, 11:58 AM ET / 15:58 UTC.
Summary
The reported omission remains in current main and v2026.9.3 source. This is a concrete provider-policy defect worth retaining; the available evidence does not establish a sandbox escape, and no canonical fixing PR was identified.
Reproducibility: yes. at the source level: the actual tool forwards sandbox status, then candidate selection drops it before the existing trust filter. No runtime reproduction was executed during this read-only review.
Next step
Route the bounded repair through OpenClaw security handling before implementation; the trust-policy surface excludes unattended issue-to-PR dispatch.
Security
Needs attention: The sandboxed provider-origin restriction is bypassed by an omitted flag, without evidence of a broader sandbox escape.
Review details
Best possible solution:
Carry sandbox status through both search-resolution handoffs and resolver signatures, retaining the shared trust-policy owner and proving excluded providers never execute while permitted providers still work.
Do we have a high-confidence way to reproduce the issue?
Yes, at the source level: the actual tool forwards sandbox status, then candidate selection drops it before the existing trust filter. No runtime reproduction was executed during this read-only review.
Is this the best way to solve the issue?
Yes, forwarding the existing flag is the narrow repair, provided it covers the earlier candidate-to-loader handoff as well as both resolver signatures and verifies provider execution behavior.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against 7af9cef3040e.
Label changes
Label changes:
P2: A source-proven provider-origin restriction is ineffective, but the demonstrated scenario requires an installed, enabled plugin and establishes no sandbox escape.impact:security: The report concerns enforcement of the explicit sandboxed provider trust policy.issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.clawsweeper:needs-security-review: Current issue advisory state selects this label.Label justifications:
P2: A source-proven provider-origin restriction is ineffective, but the demonstrated scenario requires an installed, enabled plugin and establishes no sandbox escape.impact:security: The report concerns enforcement of the explicit sandboxed provider trust policy.Evidence reviewed
Security concerns:
src/web-search/runtime.ts:290The search runtime drops sandbox status before shared provider resolution, allowing otherwise eligible workspace or external providers to remain candidates despite the stated origin policy.
Confidence: 0.99
What I checked:
src/web-search/runtime.ts:290, 7af9cef3040e)src/plugins/web-search-providers.runtime.ts:52, 7af9cef3040e)src/agents/tools/web-search.ts:134, 7af9cef3040e)src/web-fetch/runtime.test.ts:492, 7af9cef3040e)src/web-search/runtime.ts:275, 1391f7cd2d40)Likely related people:
How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.fix(web-search): honor sandbox provider trust during search (#191748)
fix(web-search): honor sandbox provider trust during search (openclaw…
fix(web-search): honor sandbox provider trust during search (#191748)
fix(web-search): honor sandbox provider trust during search (#191748)