Skip to content

fix(web-search): enforce the sandboxed provider trust filter for web_search - #144520

Closed
Finn763 wants to merge 3 commits into
openclaw:mainfrom
Finn763:fix/oc-144164-descr
Closed

Finn763 wants to merge 3 commits into
openclaw:mainfrom
Finn763:fix/oc-144164-descr

Conversation

@Finn763

@Finn763 Finn763 commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

web_search provider resolution dropped the sandboxed flag, so the sandboxed provider trust filter was a no-op for search: a sandboxed agent calling web_search could be served by a workspace-origin or external plugin provider, while the same agent calling web_fetch was correctly restricted.

Root cause, at the shared resolution throat:

  • src/web-search/runtime.ts built its own resolver argument object and omitted sandboxed, (preferRuntimeProviders defaults to true in runWebSearch, so the live lazy runtime path ran unfiltered and the flag never reached the shared origin filter on either resolver path).

  • src/plugins/web-search-providers.runtime.ts re-declared both resolver parameter types by hand and neither declared sandboxed, so the flag could not reach resolvePluginWebProviders (which already honored it end to end) or the origin filter in web-provider-resolution-shared.ts. The sibling resolveRuntimeWebFetchProviders had the same hand-written-parameter hole.

Fix:

  • resolvePluginWebSearchProviders / resolveRuntimeWebSearchProviders / resolvePluginWebFetchProviders / resolveRuntimeWebFetchProviders now take the shared ResolvePluginWebProvidersParams / ResolveRuntimeWebProvidersParams types declared once in web-provider-runtime-shared.ts. sandboxed (and every other field) is owned by one handoff type instead of four hand-written copies, so it can no longer be silently dropped from one contract's path.

  • web_search resolution now fails closed for sandboxed agents: sandboxed is forwarded on both the runtime and plugin resolver paths (lazy runtime resolution preserved), so the shared trust filter applies whichever path resolves, and untrusted providers are never eligible. This mirrors web_fetch. A sandboxed agent with no eligible provider now gets an actionable error naming the trust restriction and the recovery (select a bundled or explicitly trusted search provider).

  • The flag is now forwarded into both bundled-artifact handoffs (resolveBundledPublicArtifactProviders, resolveBundledRuntimeArtifactProviders) so it survives every handoff, including the lazy bundled re-resolution.

Behavior for non-sandboxed agents is unchanged. The trust filter in web-provider-resolution-shared.ts is unchanged; it now receives the flag on the search path.

Fixes #144164. The closing keyword is intentionally not used anywhere else in this body.

Evidence

Regression test with the issue's fixture: a real on-disk workspace plugin at <workspaceDir>/.openclaw/extensions/untrusted-web/ whose openclaw.plugin.json declares both contracts:

{

  "id": "untrusted-web",

  "contracts": { "webSearchProviders": ["untrusted"], "webFetchProviders": ["untrusted"] }

}

The plugin registers a provider on both contracts, and the same fixture is driven through both real exported resolvers:

  • resolvePluginWebSearchProviders({ config, workspaceDir, sandboxed: true }) and resolvePluginWebFetchProviders({ config, workspaceDir, sandboxed: true }) now both return no provider ([]); before the fix search returned untrusted-web:untrusted.

  • With sandboxed: false / omitted, both resolvers still return untrusted-web:untrusted, which is also the control proving the fixture really loads and registers (the assertion cannot pass vacuously).

  • With the untrusted provider configured and sandboxed: true, resolution returns [] rather than falling back to some other provider: fail-closed, no silent re-selection.

src/web-search/runtime.test.ts pins the wiring: for sandboxed: true the flag is threaded through the lazy runtime resolver (resolveRuntimeWebSearchProviders called with { sandboxed: true }, plugin resolver not called), so the shared trust filter applies without eager plugin activation and lazy resolution is preserved; for sandboxed: false the runtime resolver is used as before.

Red/green and sabotage: the two new wiring assertions were red before the fix (expected "vi.fn()" to be called 1 times, but got 0 times). Two sabotages were run and both were caught: (a) dropping sandboxed from the sandboxed search branch fails the runtime mirror test; (b) making the search wrapper swallow sandboxed fails the fixture test with the exact leak search: ["untrusted-web:untrusted"] while the non-sandboxed control still passes.

Sibling surfaces swept: git grep over every caller of the four resolvers. src/web-fetch/runtime.ts already threaded the flag; resolveRuntimeWebFetchProviders was missing it and is fixed by the shared parameter type. src/cli/command-secret-targets.ts, src/flows/search-setup.ts, src/secrets/runtime-web-tools-fallback.runtime.ts pass only fields that remain in the shared type. src/cron/isolated-agent/run-delivery-trace.ts calls hasUsableWebSearchProvider without a sandbox flag; that path only produces a diagnostics message, the call site has no sandbox status available, so it is left alone and reported here rather than guessed at.

Verification

Ran in the patch worktree (Windows 11):

  • vitest run --config test/vitest/vitest.plugins.config.ts src/plugins/web-provider-sandboxed-resolution.test.ts -> 3 passed.

  • vitest run --config test/vitest/vitest.unit-src.config.ts src/web-search/runtime.test.ts src/web-fetch/runtime.test.ts -> 54 passed.

  • vitest run --config test/vitest/vitest.plugins.config.ts src/plugins/web-search-providers.runtime.test.ts -> 13 passed.

  • vitest run --config test/vitest/vitest.plugins.config.ts src/plugins/web-provider-runtime-shared.test.ts src/plugins/web-provider-resolution-candidates.test.ts -> passed.

  • src/plugins/web-fetch-providers.runtime.test.ts fails one assertion on this Windows host before and after this change (it expects /tmp/openclaw-home/... while Windows resolves D:\tmp\...) — pre-existing, verified by stashing the source changes and re-running the same file on unmodified source.

Real behavior proof

src/web-search/runtime-sandboxed-execution.test.ts drives the registered runWebSearch entrypoint end to end over the default lazy path (preferRuntimeProviders: true, the path this fix threads the flag through) against a real on-disk workspace plugin (untrusted-web, the issue fixture shape) whose tool execute appends to a sentinel file, using the existing-configuration shape (tools.web.search.provider: "untrusted"):

  • Sandboxed: runWebSearch({ ..., sandboxed: true }) rejects with web_search is disabled or no provider is available. and the sentinel file is never created -- the configured workspace provider is rejected before provider I/O, fail-closed with no silent re-selection.
  • Non-sandboxed control: the same call without sandboxed returns { provider: "untrusted" } and the sentinel records the query -- the fixture really loads, registers, and executes, so the sandboxed assertion cannot pass vacuously.
  • RED: with the four source files reverted to the pre-fix revision, the sandboxed case fails (the search executes instead of rejecting) while the control still passes.

Ran in the patch worktree (Windows 11):

  • vitest run --config test/vitest/vitest.unit-src.config.ts src/web-search/runtime-sandboxed-execution.test.ts src/web-search/runtime.test.ts -> 37 passed.
  • vitest run --config test/vitest/vitest.plugins.config.ts src/plugins/web-provider-sandboxed-resolution.test.ts -> 3 passed.

Upgrade note: an existing sandboxed configuration that selects a third-party search provider now fails closed with web_search is disabled or no provider is available. instead of executing that provider. Recovery is to select a bundled or verified-official provider (the same rule sandboxed web_fetch already enforces per docs/tools/web.md); nothing migrates because the previous behavior was the policy gap itself. trustedOfficialInstall filtering is covered by the existing shared candidate-filter test.


Resubmission note: the earlier PR for this branch was auto-closed by openclaw-barnacle under the repository's 20-active-PR limit (r: too-many-prs) — a queue-depth rule, not a review outcome. The active queue has been pruned, and this is the identical commit resubmitted verbatim; the previous PR's comments are still there for reference.


Revision d1ed7d0 — rejection diagnostic reads manifest metadata (no unfiltered reload)

Supersedes the diagnostic reload described above. The previous revision explained a sandboxed rejection by re-resolving the configured provider with sandboxed: false. That re-resolution falls through to loadOpenClawPlugins, which evaluates the rejected plugin module and calls its register() — rejected plugin code ran before the trust error was thrown. The execution sentinel only observed execute(), so this path was invisible to the earlier proof.

This revision derives the exact same determination from plugin manifest metadata, through the same sandbox predicate the resolution path already uses (resolveManifestDeclaredWebProviderCandidatePluginIds): a configured provider is blamed on the trust rule only when its owning plugin is declaration-eligible without the filter but not eligible under it. No unfiltered resolution, no plugin load — the rejected plugin is never imported or registered.

  • src/web-search/runtime.ts — wasProviderRejectedBySandboxTrust resolves the owning plugin id from the manifest and compares the declared vs sandbox-eligible candidate sets; the unfiltered loadSortedWebSearchProviders({ sandboxed: false }) probe is removed.
  • src/web-search/runtime-sandboxed-execution.test.ts — the on-disk fixture plugin now logs module evaluation and register(), not just execute().

Real behavior proof (import + registration side effects)

Rejected workspace provider, sandboxed — nothing runs (no import, no register, no execute):

expect(readSentinel(fixture.sentinelPath)).toEqual([])
✓ rejects the configured workspace provider before provider I/O when sandboxed

Control — the same plugin, not sandboxed, imports, registers, and executes (non-vacuous):

[ "module-evaluated", "registered", "search-executed:\"sandbox proof\"" ]
✓ executes the same configured provider when not sandboxed

RED proof — reverting the production fix (previous revision) makes the sandboxed rejection log rejected-plugin side effects, which the strengthened test now catches:

- []
+ [ "module-evaluated", "registered" ]
✗ rejects the configured workspace provider before provider I/O when sandboxed

Full run: src/web-search/runtime-sandboxed-execution.test.ts 5/5 green; the surrounding web-search / web-provider unit suites (9 files, 44 tests) green; tsgo -p tsconfig.core.json clean.

Still open (not addressed in this revision)

  • Owner acceptance of the sandbox cutoff — configurations that previously selected a third-party search provider will stop searching under a sandboxed agent. This is the intended, documented effect of enforcing the existing bundled/verified-official rule for web_search (which web_fetch already enforces); accepting the cutoff is a maintainer decision.
  • Current-main conflict — the branch is based on an older main; the integrated behavior still needs review after conflict resolution.

@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 6, 2026, 12:05 AM ET / 04:05 UTC (Revision 11).

ClawSweeper review

What this changes

The branch applies the existing sandbox provider trust rule to web search, shares resolver parameter types with web fetch, and adds recovery diagnostics, documentation, and regression coverage.

Merge readiness

⛔ Blocked before merge - 4 items remain

This PR remains necessary: current main still drops sandbox status before search-provider resolution. The previous plugin-loading finding is addressed, and the strengthened proof covers rejected-plugin side effects; no new blocking code defect was found.

Priority: P2
Reviewed head: d1ed7d0d81d18811e69a08a3f167804371e4d786
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The branch has useful production-boundary proof and no remaining discrete correctness finding; owner acceptance and integration remain landing blockers.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The captured Windows run exercises production runWebSearch and real plugin loading with on-disk fixtures: sandbox rejection produces no import, registration, or execution sentinel, while unsandboxed and bundled controls execute successfully. The red comparison catches the previous diagnostic side effects. This covers the changed authority boundary and existing-config cutoff; no stored-data contract changes occur.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured Windows run exercises production runWebSearch and real plugin loading with on-disk fixtures: sandbox rejection produces no import, registration, or execution sentinel, while unsandboxed and bundled controls execute successfully. The red comparison catches the previous diagnostic side effects. This covers the changed authority boundary and existing-config cutoff; no stored-data contract changes occur.
Evidence reviewed 8 items Pinned introduced change: Reviewed the merge-base-to-head delta, retaining the supplied original-head identity. The change threads sandbox status through both search resolver paths and shared artifact handoffs.
Still necessary on current main: Current main’s search request context and resolver arguments still omit sandbox status. Its newer authentication and request-authority handling does not repair this provider-origin filtering gap.
Previous finding addressed: The rejection diagnostic now compares manifest-declared candidate sets using the existing trust predicate. It no longer calls an unfiltered runtime resolver or loads the rejected plugin.
Findings None None.
Security None None.

How this fits together

OpenClaw’s web-search runtime receives agent queries, configuration, and sandbox status, then selects a plugin provider to execute the search. Shared provider resolution determines which installed plugins are eligible before their code runs.

flowchart TD
  A[Agent search query] --> B[Search runtime]
  C[Configuration and sandbox status] --> B
  B --> D[Manifest provider selection]
  D --> E[Shared provider trust filter]
  E --> F[Eligible provider execution]
  E --> G[Rejection and recovery message]
  F --> H[Search result]
Loading

Decision needed

Question Recommendation
Should sandboxed web search immediately reject previously configured workspace and unverified external providers, with the documented provider-switch recovery? Accept the documented cutoff: Approve enforcement of the existing bundled or verified-official rule and its explicit recovery message after current-main integration is validated.

Why: This repairs an existing trust policy but intentionally stops working search configurations; the contributor’s acknowledgement does not establish owner acceptance.

Before merge

  • Resolve merge risk (P1) - Existing sandboxed installations selecting workspace or unverified external search providers will stop searching; an owner must explicitly accept the documented cutoff and recovery path.
  • Resolve merge risk (P1) - The current head conflicts with main; conflict resolution must preserve main’s newer authentication and request-authority behavior, followed by review and relevant validation of the integrated result.
  • Complete next step (P2) - Obtain explicit owner acceptance of the documented provider cutoff, resolve current-main conflicts, and review and validate the integrated trust-filter behavior.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +103, Tests +508, Docs +10. Total +621 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 159 56 +103
Tests 3 508 0 +508
Docs 1 10 0 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 677 56 +621

Review metrics

Metric Value Why it matters
Production versus regression coverage production net +103 lines; tests +508 lines Production growth is explained by shared handoff types and metadata-only recovery diagnostics, with most added code protecting provider trust behavior.

Merge-risk options

Maintainer options:

  1. Approve the cutoff and validate integration (recommended)
    Have the provider-runtime owner accept the documented search cutoff, then resolve conflicts and verify rejection and eligible execution against the integrated code.
  2. Hold for upgrade recovery requirements
    Pause landing if switching to an eligible provider is not an acceptable recovery path for existing sandboxed users.

Technical review

Best possible solution:

Enforce the existing shared trust rule before plugin code runs, retain metadata-only recovery diagnostics, and adopt the documented upgrade cutoff only with explicit owner acceptance.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes a high-confidence path: current main omits sandbox status before provider resolution, allowing the linked issue’s installed workspace-provider fixture to escape the existing origin filter. This read-only review did not execute that path.

Is this the best way to solve the issue?

Yes, forwarding the flag through the existing shared owner and deriving rejection diagnostics from metadata is a focused repair. Upgrade acceptance and conflict-resolution validation remain separate landing requirements.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e5b62e7c7914.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured Windows run exercises production runWebSearch and real plugin loading with on-disk fixtures: sandbox rejection produces no import, registration, or execution sentinel, while unsandboxed and bundled controls execute successfully. The red comparison catches the previous diagnostic side effects. This covers the changed authority boundary and existing-config cutoff; no stored-data contract changes occur.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured Windows run exercises production runWebSearch and real plugin loading with on-disk fixtures: sandbox rejection produces no import, registration, or execution sentinel, while unsandboxed and bundled controls execute successfully. The red comparison catches the previous diagnostic side effects. This covers the changed authority boundary and existing-config cutoff; no stored-data contract changes occur.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs a bounded provider-origin policy gap requiring an installed and enabled plugin, without demonstrating a general sandbox escape.
  • merge-risk: 🚨 compatibility: Enforcement intentionally stops sandboxed search configurations that previously selected workspace or unverified external providers.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured Windows run exercises production runWebSearch and real plugin loading with on-disk fixtures: sandbox rejection produces no import, registration, or execution sentinel, while unsandboxed and bundled controls execute successfully. The red comparison catches the previous diagnostic side effects. This covers the changed authority boundary and existing-config cutoff; no stored-data contract changes occur.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured Windows run exercises production runWebSearch and real plugin loading with on-disk fixtures: sandbox rejection produces no import, registration, or execution sentinel, while unsandboxed and bundled controls execute successfully. The red comparison catches the previous diagnostic side effects. This covers the changed authority boundary and existing-config cutoff; no stored-data contract changes occur.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head delta, retaining the supplied original-head identity. The change threads sandbox status through both search resolver paths and shared artifact handoffs. (src/web-search/runtime.ts:280, d1ed7d0d81d1)
  • Still necessary on current main: Current main’s search request context and resolver arguments still omit sandbox status. Its newer authentication and request-authority handling does not repair this provider-origin filtering gap. (src/web-search/runtime.ts:301, e5b62e7c7914)
  • Previous finding addressed: The rejection diagnostic now compares manifest-declared candidate sets using the existing trust predicate. It no longer calls an unfiltered runtime resolver or loads the rejected plugin. (src/web-search/runtime.ts:445, d1ed7d0d81d1)
  • Final-effect proof: The captured PR body’s revision section reports a Windows production-path run through runWebSearch and a real on-disk plugin. The sandboxed case records no module evaluation, registration, or execution; the unsandboxed control records all three. Reverting the diagnostic repair records forbidden import and registration effects. Source inspection confirms these sentinels exercise real owners without mocked provider resolution; the bundled-provider control also succeeds. (src/web-search/runtime-sandboxed-execution.test.ts:180, d1ed7d0d81d1)
  • Upgrade cutoff remains unaccepted: The changed documentation explicitly states that sandboxed configurations selecting third-party workspace or external search providers lose search after upgrade. The contributor acknowledges that owner acceptance remains outstanding; no supplied human decision accepts this tradeoff. Public docs: docs/tools/web.md. (docs/tools/web.md:425, d1ed7d0d81d1)
  • Current-head integration blocker: A live REST read confirms the reviewed head and reports mergeable=false with mergeable_state=dirty. No pinned test merge is available, so the integrated result has not been assessed and no removal of current-main behavior is attributed to this branch. (d1ed7d0d81d1)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • holny: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Obtain explicit provider-runtime owner acceptance of the documented upgrade cutoff.
  • Resolve current-main conflicts and refresh rejection and eligible-provider evidence for the integrated result.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-11T02:23:56.800Z sha d95e822c5dde68764a8d77d9e2c4bbd6f4fffc28 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-11T03:07:05.929Z sha 2503c2343987284e71bfb0fd549182d5ed7c1aa7 :: blocked before merge. :: none
  • reviewed 2026-09-16T06:05:32.196Z sha d869143 :: blocked before merge. :: none
  • reviewed 2026-09-16T06:37:50.988Z sha d869143 :: blocked before merge. :: none
  • reviewed 2026-09-24T03:15:27.252Z sha db11053bc372d71a06538be45dae6c4027c3e088 :: blocked before merge. :: [P2] Explain why a configured sandboxed search provider was rejected
  • reviewed 2026-09-24T03:49:54.495Z sha 12e6a2974c2a02524f8b783452681df6a3d0b124 :: blocked before merge. :: [P2] Verify a trust rejection before prescribing a new provider | [P3] Document the sandboxed search provider restriction
  • reviewed 2026-10-05T02:16:42.357Z sha 12e6a2974c2a02524f8b783452681df6a3d0b124 :: blocked before merge. :: [P2] Verify a trust rejection before prescribing a new provider | [P3] Document the sandboxed search provider restriction
  • reviewed 2026-10-05T02:51:24.282Z sha a72e2725e766ed7ffe391304a849363060fd79be :: needs real behavior proof before merge. :: [P1] Avoid loading rejected plugins to explain a sandbox rejection

@Finn763
Finn763 force-pushed the fix/oc-144164-descr branch 2 times, most recently from d95e822 to 2503c23 Compare September 11, 2026 03:02
@Finn763

Finn763 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Real behavior proof added (head 2503c23): new src/web-search/runtime-sandboxed-execution.test.ts drives the registered runWebSearch end to end over the default lazy path against a real on-disk untrusted-web workspace plugin with an execute sentinel. Sandboxed rejects with no provider available and the sentinel is never created (rejection before provider I/O); the non-sandboxed control returns {provider:"untrusted"} with the sentinel written. RED verified on the pre-fix revision. PR body updated with the evidence, the corrected lazy-resolution description, and the upgrade/recovery note.

@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
…search

web_search dropped the sandboxed flag before provider resolution, so the sandboxed provider-origin filter never engaged, while web_fetch honored it. Thread the flag through the shared resolver handoff, share one handoff parameter type across both contracts' resolvers, and fail closed for sandboxed search.

Fixes openclaw#144164
@Finn763
Finn763 force-pushed the fix/oc-144164-descr branch from 2503c23 to d869143 Compare September 16, 2026 05:36
@Finn763

Finn763 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

CI re-triggered on db11053bc37 (empty commit, no code change). The failures on d86914313 were src/config/sessions/goals-operations.test.ts, in files this diff does not touch, against a base from before main was green again.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 24, 2026
@Finn763
Finn763 force-pushed the fix/oc-144164-descr branch from db11053 to 12e6a29 Compare September 24, 2026 03:40
@Finn763

Finn763 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the P2 finding on head 12e6a2974c2.

Trust-specific recovery message — src/web-search/runtime.ts, the candidates.length === 0 branch of runWebSearch (the diagnostic flagged at runtime.ts:406). When the sandbox trust filter empties the candidate set and a provider was configured — providerId argument, tools.web.search.provider, or configured runtime metadata — the error now names it and the recovery path:

web_search is disabled or no provider is available. The configured search provider "untrusted" is not available to sandboxed web_search: sandboxed agents only run bundled or verified-official providers. Select a bundled or verified-official search provider to restore web_search.

A sandboxed run with nothing configured keeps the previous message verbatim, so this does not turn every empty selection into a trust claim, and the existing "web_search is disabled or no provider is available." assertions are unchanged.

Evidence — local Windows run, scripts/test-projects.mts, --maxWorkers=1 --no-file-parallelism:

Check Result
src/web-search/runtime-sandboxed-execution.test.ts 3 passed. Rejection now asserted to name "untrusted" and say "bundled or verified-official"; new control case (sandboxed, nothing configured) asserts the plain message and an empty provider-I/O sentinel
src/web-search/runtime.test.ts 35 passed (regression, expectations untouched)
RED check reverting the runtime.ts change while keeping the new assertions → AssertionError: expected 'web_search is disabled or no provider…' to contain '"untrusted"' (1 failed | 2 passed); restored → green
node scripts/run-tsgo.mjs -p tsconfig.core.json clean; oxfmt/oxlint clean on both files

The other three items are the owner decision, not code: this cutover stops sandboxed installs that configured a workspace or unverified provider from running managed web search. Maintainer acceptance of that fail-closed behaviour is still required before merge.

@Finn763

Finn763 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

CI on head 12e6a2974c2 — both red jobs are the shared node-shard flake window currently hitting unrelated PRs, not this diff.

job failing test same failure on an unrelated PR
checks-node-changed-compact-large-15 src/agents/embedded-agent-runner/compact.foreground-resources.test.ts:410 — AssertionError: expected 78.1214689999997 to be less than 50 (wall-clock budget inside the resource-retention cases) checks-node-changed-compact-large-15 on #156989 (xydigitLybnnnn) — expected 67.02821899999981 to be less than 50 at the same line
checks-node-changed-compact-large-31 src/agents/harness/context-engine-turn-maintenance.test.ts:288 — AssertionError: expected "vi.fn()" to be called once, but got 0 times (inside vi.waitFor), 4 cases, all in durable accepted-turn maintenance handoff checks-node-changed-compact-large-31 on #156989 — identical annotation, same line

Notes:

  • Neither failing file is in this diff (7 files: src/web-search/{runtime,runtime.test,runtime-sandboxed-execution.test}.ts, src/plugins/web-{fetch,search}-providers.runtime.ts, web-provider-runtime-shared.ts, web-provider-sandboxed-resolution.test.ts).
  • Shard totals on the failing jobs: 1 failed | 1040 passed | 1 skipped (1042) and 4 failed | 2229 passed (2233) — a single measurement window each, both poll/time-budget assertions rather than behaviour assertions.
  • A local isolated re-run is not diagnostic for these two files on this box: every case in compact.foreground-resources.test.ts hits the runner's own 120s test timeout here (Test timed out in 120000ms), so the evidence above is the cross-PR red + assertion fingerprint, not a local red/green pair.

No code change made. A rerun of the two failed jobs once the load window clears would be appreciated — fork contributors have no rerun permission.

@Finn763
Finn763 force-pushed the fix/oc-144164-descr branch from 12e6a29 to a72e272 Compare October 5, 2026 02:45
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 5, 2026
@Finn763

Finn763 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both findings on head a72e2725e76.

P2 — verify a trust rejection before prescribing a new provider (src/web-search/runtime.ts): the empty-candidate branch now only attributes the failure to the sandbox trust rule when the same configured provider resolves without the sandbox filter (wasProviderRejectedBySandboxTrust). An eligible provider whose plugin is disabled or missing gets availability wording ("confirm its plugin is enabled and installed") instead of being told to switch to a bundled or verified-official provider it already selects.

P3 — document the sandboxed search restriction (docs/tools/web.md): added the sandboxed web_search eligibility rule and upgrade recovery steps next to the existing web_fetch restriction.

Coverage added in src/web-search/runtime-sandboxed-execution.test.ts: a configured bundled provider runs when sandboxed, and a configured-but-disabled bundled provider yields the availability message (not the trust one).

Verification on this box (vitest run src/web-search/runtime-sandboxed-execution.test.ts --maxWorkers=1): 5 passed. RED (removing the trust check) fails only the new availability case.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 5, 2026
…ejects it

When the sandbox trust filter empties the candidate set, runWebSearch now reports which
configured provider was unavailable to sandboxed web_search and points at the bundled /
verified-official recovery path, instead of the generic 'disabled or no provider' text.
Runs with nothing configured keep the previous message.
@Finn763
Finn763 force-pushed the fix/oc-144164-descr branch from a72e272 to d1ed7d0 Compare October 6, 2026 03:57
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 6, 2026
roboclaw-bot added a commit that referenced this pull request Nov 3, 2026
Sandboxed web search dropped its session sandbox flag before resolving a provider, allowing configured untrusted workspace or external providers to execute. Carry that flag through both resolver routes into the existing shared manifest trust filter used by web fetch. Bundled, verified official, and nonsandboxed behavior stay intact.

Give sandboxed callers an actionable availability hint without loading rejected provider code for diagnostics. Remove obsolete type exclusions, redundant request forwarding, and a duplicate inherited authStore field; production LOC is net +1.

The 100-line regression allocation protects the real plugin-loader boundary. On main, two sandboxed rejection cases execute the workspace plugin unexpectedly; the fix passes both and all six controls, with no import, registration, tool creation, or execution trace for rejected code. All 115 focused tests and touched-file format/lint pass on Blacksmith Testbox. The final working tree received P0-P2 autoreview; its only index-only fixture finding was resolved by staging the reviewed replacement.

Final CI passes tests, types, lint, builds and security. Its only failure is the existing shared test-line ceiling, six lines over budget, independently reproduced on clean main 31ad71a. Own 100-line regression growth is exactly funded. Landing uses the native inherited-failure evidence route without relabeling failed CI.

Supersedes #144520, thanks @Finn763. Related: #144164.

Co-authored-by: finn763 <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Thanks @Finn763 for the report and fix. This is now landed in #191748, preserving your co-author credit. The replacement routes search through the shared sandbox trust filter and proves rejection before plugin import or I/O. Closing this as superseded by the merged replacement.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 4, 2026
…#191748)

Sandboxed web search dropped its session sandbox flag before resolving a provider, allowing configured untrusted workspace or external providers to execute. Carry that flag through both resolver routes into the existing shared manifest trust filter used by web fetch. Bundled, verified official, and nonsandboxed behavior stay intact.

Give sandboxed callers an actionable availability hint without loading rejected provider code for diagnostics. Remove obsolete type exclusions, redundant request forwarding, and a duplicate inherited authStore field; production LOC is net +1.

The 100-line regression allocation protects the real plugin-loader boundary. On main, two sandboxed rejection cases execute the workspace plugin unexpectedly; the fix passes both and all six controls, with no import, registration, tool creation, or execution trace for rejected code. All 115 focused tests and touched-file format/lint pass on Blacksmith Testbox. The final working tree received P0-P2 autoreview; its only index-only fixture finding was resolved by staging the reviewed replacement.

Final CI passes tests, types, lint, builds and security. Its only failure is the existing shared test-line ceiling, six lines over budget, independently reproduced on clean main f77ae72. Own 100-line regression growth is exactly funded. Landing uses the native inherited-failure evidence route without relabeling failed CI.

Supersedes openclaw#144520, thanks @Finn763. Related: openclaw#144164.

Co-authored-by: finn763 <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 6, 2026
Sandboxed web search dropped its session sandbox flag before resolving a provider, allowing configured untrusted workspace or external providers to execute. Carry that flag through both resolver routes into the existing shared manifest trust filter used by web fetch. Bundled, verified official, and nonsandboxed behavior stay intact.

Give sandboxed callers an actionable availability hint without loading rejected provider code for diagnostics. Remove obsolete type exclusions, redundant request forwarding, and a duplicate inherited authStore field; production LOC is net +1.

The 100-line regression allocation protects the real plugin-loader boundary. On main, two sandboxed rejection cases execute the workspace plugin unexpectedly; the fix passes both and all six controls, with no import, registration, tool creation, or execution trace for rejected code. All 115 focused tests and touched-file format/lint pass on Blacksmith Testbox. The final working tree received P0-P2 autoreview; its only index-only fixture finding was resolved by staging the reviewed replacement.

Final CI passes tests, types, lint, builds and security. Its only failure is the existing shared test-line ceiling, six lines over budget, independently reproduced on clean main 31ad71a. Own 100-line regression growth is exactly funded. Landing uses the native inherited-failure evidence route without relabeling failed CI.

Supersedes #144520, thanks @Finn763. Related: #144164.

Co-authored-by: finn763 <[email protected]>

Backport-source: 3e3935a
Backport-scope: Propagate sandboxed through request context and provider resolution plus C1 preparation and synchronous availability entrypoints. Preserve C1 authStore parameter and existing official-provider trust predicate; no blanket plugin trust change.

Adapted production backport for release/2026.11.2. Upstream validation descriptions refer to source history; candidate regression coverage and remote qualification are tracked separately.

Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 17, 2026
Sandboxed web search dropped its session sandbox flag before resolving a provider, allowing configured untrusted workspace or external providers to execute. Carry that flag through both resolver routes into the existing shared manifest trust filter used by web fetch. Bundled, verified official, and nonsandboxed behavior stay intact.

Give sandboxed callers an actionable availability hint without loading rejected provider code for diagnostics. Remove obsolete type exclusions, redundant request forwarding, and a duplicate inherited authStore field; production LOC is net +1.

The 100-line regression allocation protects the real plugin-loader boundary. On main, two sandboxed rejection cases execute the workspace plugin unexpectedly; the fix passes both and all six controls, with no import, registration, tool creation, or execution trace for rejected code. All 115 focused tests and touched-file format/lint pass on Blacksmith Testbox. The final working tree received P0-P2 autoreview; its only index-only fixture finding was resolved by staging the reviewed replacement.

Final CI passes tests, types, lint, builds and security. Its only failure is the existing shared test-line ceiling, six lines over budget, independently reproduced on clean main 31ad71a. Own 100-line regression growth is exactly funded. Landing uses the native inherited-failure evidence route without relabeling failed CI.

Supersedes #144520, thanks @Finn763. Related: #144164.

Co-authored-by: finn763 <[email protected]>
(cherry picked from commit 3e3935a)

Release adaptation (OpenClaw 2026.11.6):
- Cherry-picked onto parent candidate 82f1197 after the scoped #189423 backport. No production or regression-test adaptation required; preserved release's existing tool-result-error import.
- Existing manifest trust filtering and explicit empty scopes remain the sole selection authority; sandboxed is now carried through context and both existing selection routes. No new trust owner, configuration, or permissions.
- Companion audit pinned at bd692e9: e333f7e (#197657) removes the allocation after main's ratchet reset, not applicable here; retain source's 100-line allocation. a30ec5d (#177228) changes native-research/account-pinning execution, not a prerequisite for sandbox selection and excluded. No later PR mentions. Existing shared trust filter/empty-scope refusal is present-equivalent. Other heuristic runtime-name references do not consume the changed contract.

Release validation (local isolated worktree):
- Before this pick, source's real-plugin-loader regression: 2 failed / 6 passed. Both sandboxed workspace cases executed rejected code through runtime preference true and false.
- After this pick: 95 passed across 7 runtime/owner suites, including all 8 regression cases and shared empty-scope cases. Additional tool, provider-error, fetch-provider and setup consumers pass (counts recorded in lane report).
- Changed-TypeScript type-aware lint: 4 files clean using supported core config. Changed-file formatting and git diff --check clean. Manual self-review/pr-simplify: direct propagation into existing owner, no duplicate policy; 3 production files, net +1 line.
- No real model/Gateway end-to-end run or broad gates in this lane; parent owns final release qualification. Upstream claims above describe source validation, not release qualification. One attempted suite was absent on this release and was corrected before running; not a product failure.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 3be9be1ddaa4a19d3672994f03bf580fcf20b6c3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants