Skip to content

!feat(plugins): add web fetch provider boundary - #59465

Merged
vincentkoc merged 13 commits into
mainfrom
feat/web-fetch-provider-boundary
Apr 2, 2026
Merged

vincentkoc merged 13 commits into
mainfrom
feat/web-fetch-provider-boundary

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Apr 2, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Problem: web_search was pluginized, but web_fetch still carried Firecrawl-specific fallback/config/secret behavior in core.
  • Why it matters: fetch backends were not truly swappable, Firecrawl still leaked into core ownership, and browser/rendered fetch follow-up work had no clean provider seam.
  • What changed: added a first-class webFetchProviders plugin contract, generic fetch-provider runtime resolution, moved Firecrawl fetch ownership behind the plugin boundary, and removed the remaining core tools.web.fetch.firecrawl.* runtime/config surface.
  • What did NOT change (scope boundary): this PR does not add a local browser/Playwright provider, and it does not redesign the public web_fetch tool shape.
  • AI-assisted: yes. Testing: fully tested locally on the touched surface.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Root Cause / Regression History (if applicable)

  • Root cause: src/agents/tools/web-fetch.ts and related runtime-secret/config plumbing still owned Firecrawl-specific behavior while web_search had already moved to provider plugins.
  • Missing detection / guardrail: there was no webFetchProviders manifest/runtime contract, no contract tests for fetch-provider ownership, and no migration path off the legacy core tools.web.fetch.firecrawl.* config shape.
  • Prior context (git blame, prior PR, issue, or refactor if known): this is follow-through on the plugin-boundary cleanup after fix(plugins): guard runtime facade activation #59412, plus recent upstream work that moved more provider auth/config handling and trusted web-tool header/endpoint behavior behind reusable helpers instead of vendor-specific core branches.
  • Why this regressed now: search and fetch evolved on different seams; search pluginized first, but fetch kept a one-off Firecrawl fallback path in core.
  • If unknown, what was ruled out: N/A.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
    • src/agents/tools/web-tools.fetch.test.ts
    • src/agents/tools/web-fetch.cf-markdown.test.ts
    • src/agents/tools/web-fetch.ssrf.test.ts
    • src/secrets/runtime-web-tools.test.ts
    • src/agents/openclaw-tools.web-runtime.test.ts
    • src/plugins/contracts/registry.contract.test.ts
    • src/plugins/contracts/registry.retry.test.ts
    • src/plugins/contracts/plugin-registration.contract.test.ts
    • src/plugins/contracts/web-fetch-provider.contract.test.ts
    • src/config/legacy-web-fetch.test.ts
    • src/commands/doctor-legacy-config.migrations.test.ts
    • src/cli/command-secret-gateway.test.ts
    • src/cli/command-secret-targets.test.ts
    • src/web-search/runtime.test.ts
    • extensions/firecrawl/src/firecrawl-tools.test.ts
  • Scenario the test should lock in: core web_fetch stays generic, Firecrawl compat is owned by the plugin, legacy fetch config migrates cleanly to plugin-owned config, and runtime/CLI secret handling stays provider-generic.
  • Why this is the smallest reliable guardrail: it exercises the seam at the tool runtime, secret/runtime metadata, contract loading, and config-migration layers where the coupling previously lived.
  • Existing test that already covers this (if any): existing web_fetch and Firecrawl tests covered the fallback behavior; this PR extends them to the provider-routed and migrated-config paths.
  • If no new test is added, why not: N/A.

User-visible / Behavior Changes

  • web_fetch now resolves provider fallbacks through plugin-owned fetch providers instead of a Firecrawl-only core branch.
  • New config: tools.web.fetch.provider.
  • Canonical Firecrawl fetch config is now plugins.entries.firecrawl.config.webFetch.*.
  • openclaw doctor --fix migrates legacy tools.web.fetch.firecrawl.* config to the plugin-owned Firecrawl config path.
  • Firecrawl continues to work as an explicit firecrawl_scrape tool.

Diagram (if applicable)

Before:
[web_fetch] -> [core fetch] -> [hardcoded Firecrawl fallback + hardcoded Firecrawl fetch config/secrets]

After:
[web_fetch] -> [core fetch orchestration]
             -> [generic fetch-provider selection/runtime metadata]
             -> [plugin-owned fallback provider]
             -> [normalized fetch payload]

Legacy config cleanup:
[tools.web.fetch.firecrawl.*] --doctor--> [plugins.entries.firecrawl.config.webFetch.*]

Security Impact (required)

  • New permissions/capabilities? (Yes)
  • Secrets/tokens handling changed? (Yes)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:
    • New capability is a plugin registration seam only; core still owns web_fetch input validation and network guardrails.
    • Secret/runtime handling is now generic and provider-owned for fetch providers, with compat tests covering migrated config, inactive SecretRefs, and Firecrawl fallback behavior.

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 22 / pnpm workspace
  • Model/provider: N/A
  • Integration/channel (if any): bundled Firecrawl plugin, core web tools
  • Relevant config (redacted): tools.web.fetch.*, plugins.entries.firecrawl.config.webFetch.*, legacy tools.web.fetch.firecrawl.*

Steps

  1. Configure web_fetch with no provider and fetch static HTML content.
  2. Configure Firecrawl credentials and trigger a fallback case where direct extraction is weak or blocked.
  3. Run openclaw doctor --fix against legacy tools.web.fetch.firecrawl.* config.
  4. Resolve runtime metadata and secret refs with active and inactive fetch-provider config.

Expected

  • Core web_fetch handles direct HTTP/readability/basic HTML itself.
  • Fallback providers are selected through plugin runtime metadata, not Firecrawl-specific branches.
  • Firecrawl fetch config lives under the Firecrawl plugin, and doctor rewrites the legacy core config path.

Actual

  • Now matches expected.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios:
    • pnpm build
    • pnpm test -- src/agents/tools/web-tools.fetch.test.ts src/secrets/runtime-web-tools.test.ts src/agents/openclaw-tools.web-runtime.test.ts src/plugins/contracts/registry.contract.test.ts src/plugins/contracts/registry.retry.test.ts src/plugins/contracts/plugin-registration.contract.test.ts src/plugins/contracts/web-fetch-provider.contract.test.ts extensions/firecrawl/src/firecrawl-tools.test.ts
    • pnpm test -- src/secrets/runtime-web-tools.test.ts src/config/legacy-web-fetch.test.ts src/commands/doctor-legacy-config.migrations.test.ts src/cli/command-secret-gateway.test.ts src/cli/command-secret-targets.test.ts
    • pnpm test -- src/agents/tools/web-fetch.cf-markdown.test.ts src/agents/tools/web-fetch.ssrf.test.ts src/web-search/runtime.test.ts
    • pnpm config:docs:gen
    • pnpm plugin-sdk:api:gen
    • node --import tsx scripts/generate-base-config-schema.ts --write
  • Edge cases checked:
    • migrated legacy fetch config lands in plugin-owned Firecrawl config without overriding explicit plugin config
    • inactive web-fetch SecretRefs stay inactive without Firecrawl-specific core branches
    • readability miss falls back to provider when available, then still reaches basic HTML cleanup on provider failure
    • Firecrawl error text remains wrapped/normalized on the provider-owned path
  • What you did not verify:
    • full pnpm test
    • full repo pnpm check (branch has unrelated tsgo noise outside this surface)
    • a real browser-backed/local Playwright provider

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (Yes)
  • Migration needed? (Yes)
  • If yes, exact upgrade steps:
    • Preferred path: run openclaw doctor --fix to migrate tools.web.fetch.firecrawl.* to plugins.entries.firecrawl.config.webFetch.*.
    • Runtime compat remains in the Firecrawl plugin, so existing installs do not hard-break if they have not migrated yet.

Risks and Mitigations

  • Risk:

    • Fetch-provider runtime selection could change fallback behavior in edge cases where Firecrawl was previously implicitly assumed.
    • Mitigation:
      • Core still defaults to direct fetch first, and targeted runtime + tool tests cover disabled/inactive/credentialed fallback paths.
  • Risk:

    • Legacy fetch config now moves through doctor rather than remaining a core-owned first-class surface.
    • Mitigation:
      • The Firecrawl plugin still honors the legacy config shape during the compat window, and doctor provides a clean rewrite path to the plugin-owned config.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes scripts Repository scripts agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR commands Command implementations labels Apr 2, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review April 2, 2026 08:15
@vincentkoc
vincentkoc requested a review from a team as a code owner April 2, 2026 08:15
@vincentkoc
vincentkoc marked this pull request as draft April 2, 2026 08:15
@vincentkoc
vincentkoc force-pushed the feat/web-fetch-provider-boundary branch from e8e174e to 2bc3127 Compare April 2, 2026 08:19
@greptile-apps

greptile-apps Bot commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces a webFetchProviders plugin contract that mirrors the existing webSearch provider pattern, moves Firecrawl fetch ownership behind the plugin boundary, and wires in a doctor --fix migration path for legacy tools.web.fetch.firecrawl.* config. The architecture is sound and the migration logic is well-tested.

One behavioral regression is worth addressing before merge: FetchFirecrawlContentParams still accepts proxy and storeInCache, these values are forwarded to the provider's execute(), but the Firecrawl provider's execute ignores them — so callers that explicitly set proxy: "stealth" or storeInCache: false will silently get the defaults instead.

Confidence Score: 4/5

  • Safe to merge after addressing the silent parameter regression in fetchFirecrawlContent.
  • One P1 finding: proxy and storeInCache in FetchFirecrawlContentParams are accepted but silently dropped through the new provider execute path, breaking the parameter contract for non-default values. The only current external caller uses defaults so there is no immediate production impact, but the exported type contract is misleading. One P2 finding: preferRuntimeProviders is declared but unread. All other changes (migration logic, plugin registry, secret runtime, config schema) are well-structured and well-tested.
  • src/agents/tools/web-fetch.ts (lines 70–81 and 292–298) and extensions/firecrawl/src/firecrawl-fetch-provider.ts (createTool.execute) for the proxy/storeInCache gap; src/web-fetch/runtime.ts for the preferRuntimeProviders dead parameter.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/tools/web-fetch.ts
Line: 70-81

Comment:
**`proxy` and `storeInCache` silently dropped through the new provider path**

`FetchFirecrawlContentParams` still declares `proxy` and `storeInCache`, and the values are passed to `resolved.definition.execute(...)` (line 292–298), but the Firecrawl provider's `createTool.execute` in `firecrawl-fetch-provider.ts` reads only `url`, `extractMode`, and `maxChars` — `proxy` and `storeInCache` are silently discarded. A caller passing `proxy: "stealth"` or `storeInCache: false` will observe no difference from the defaults (`"auto"` / `true`), with no error or warning.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/web-fetch/runtime.ts
Line: 21-27

Comment:
**`preferRuntimeProviders` is declared but never read**

`ResolveWebFetchDefinitionParams.preferRuntimeProviders` is accepted at call sites (`createWebFetchTool` passes `true`, `fetchFirecrawlContent` passes `false`) but `resolveWebFetchDefinition` always calls `resolveBundledPluginWebFetchProviders` unconditionally — the parameter has no effect on provider selection. The two runtime tests that assert "bundled wins when preferred" pass for the same reason (the mock for `resolveRuntimeWebFetchProviders` is set but never invoked).

If this is intentional (current scope: bundled-only), removing the parameter or adding a clear comment would avoid misleading future callers. If runtime providers should be consulted when `preferRuntimeProviders: true`, the guard is missing.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (3): Last reviewed commit: "Merge branch 'main' into feat/web-fetch-..." | Re-trigger Greptile

Comment thread src/config/legacy-web-fetch.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8e174eb16

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/config/zod-schema.agent-runtime.ts Resolved
@vincentkoc
vincentkoc marked this pull request as ready for review April 2, 2026 08:27
@aisle-research-bot

aisle-research-bot Bot commented Apr 2, 2026 •

Copy link
Copy Markdown

🔒 Aisle Security Analysis

We found 5 potential security issue(s) in this PR:

# Severity Title
1 🟠 High SSRF policy bypass: provider fallback executes on unvalidated URL when guarded fetch fails
2 🟡 Medium Unbounded maxChars and missing parameter schema in Firecrawl web-fetch provider can cause memory/CPU DoS
3 🟡 Medium Prompt-injection via unwrapped provider-controlled metadata fields in web_fetch fallback payload
4 🟡 Medium SSRF guard bypass via Firecrawl web fetch provider (arbitrary URL forwarded to Firecrawl)
5 🔵 Low Sensitive config (potential secrets) embedded into web fetch snapshot cache key
1. 🟠 SSRF policy bypass: provider fallback executes on unvalidated URL when guarded fetch fails
Property Value
Severity High
CWE CWE-918
Location src/agents/tools/web-fetch.ts:409-423

Description

In maybeFetchProviderWebFetchPayload, the framework invokes the selected web-fetch provider with a user-controlled URL without applying the same SSRF checks used by fetchWithWebToolsNetworkGuard.

  • Input: params.urlToFetch originates from tool input (args.url) or finalUrl and is forwarded directly to providerFallback.definition.execute().
  • Missing control: No call is made to the SSRF guard (fetchWithSsrFGuard / resolvePinnedHostnameWithPolicy / isBlockedHostnameOrIp) before executing the provider.
  • Impact: If the initial guarded fetch fails for non-SSRF reasons (e.g., DNS resolution failure, TLS errors, timeouts), the provider fallback still runs. Providers (e.g., Firecrawl) can perform arbitrary network actions, so this can allow fetching of targets that the core SSRF guard would have blocked or would have evaluated differently (including internal/private ranges) — effectively an SSRF/policy bypass via the provider execution path.

Vulnerable code:

const rawPayload = await params.providerFallback.definition.execute({
  url: params.urlToFetch,
  extractMode: params.extractMode,
  maxChars: params.maxChars,
});

Recommendation

Enforce SSRF policy before invoking any web-fetch provider, using the same checks as the core guarded fetch.

Suggested approach:

  1. Add a shared URL validation/SSRF-check helper (e.g., assertUrlAllowedByWebFetchPolicy(url)), which:
    • Parses URL and enforces http/https
    • Blocks localhost, special-use hostnames
    • Resolves DNS and blocks private/special-use IPs (same policy as guarded fetch)
  2. Call it inside maybeFetchProviderWebFetchPayload before providerFallback.definition.execute().

Example (sketch):

import { resolvePinnedHostnameWithPolicy } from "../../infra/net/ssrf.js";

async function assertWebFetchUrlAllowed(urlRaw: string) {
  const url = new URL(urlRaw);
  if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("Invalid URL");
  ​// Will throw SsrFBlockedError if disallowed
  await resolvePinnedHostnameWithPolicy(url.hostname, { policy: undefined });
}

async function maybeFetchProviderWebFetchPayload(params: ...) {
  if (!params.providerFallback) return null;
  await assertWebFetchUrlAllowed(params.urlToFetch);
  const rawPayload = await params.providerFallback.definition.execute({ ... });
  ...
}

Additionally, consider requiring provider implementations to accept a pre-validated URL only, and document that providers must not be invoked with URLs that haven't passed SSRF validation.

2. 🟡 Unbounded `maxChars` and missing parameter schema in Firecrawl web-fetch provider can cause memory/CPU DoS
Property Value
Severity Medium
CWE CWE-400
Location extensions/firecrawl/src/firecrawl-fetch-provider.ts:67-90

Description

The Firecrawl web-fetch provider tool declares an empty parameters schema and forwards user-controlled arguments (notably maxChars) into the scrape pipeline without any upper bound.

  • createTool sets parameters: {} meaning upstream tool runners may not validate/coerce inputs.
  • args.maxChars is accepted as any finite number and passed to runFirecrawlScrape.
  • runFirecrawlScrape only checks > 0 and does not cap the value, so a caller can set maxChars to a very large number.
  • A large maxChars can prevent truncation and cause the system to hold/wrap/cache very large responses in memory (wrapExternalContent(...), caching), leading to potential denial of service / quota abuse.

Vulnerable code:

createTool: ({ config }) => ({
  description: "Fetch a page using Firecrawl.",
  parameters: {},
  execute: async (args) => {
    const maxChars =
      typeof args.maxChars === "number" && Number.isFinite(args.maxChars)
        ? Math.floor(args.maxChars)
        : undefined;
    return await runFirecrawlScrape({ cfg: config, url, extractMode, maxChars });
  },
})

Even if the default agent web-fetch tool clamps maxChars in its own path, this provider tool can be executed directly (or via other callers) without those clamps.

Recommendation

  1. Define a strict JSON schema for the provider tool parameters (TypeBox/Zod/etc.) and validate/coerce inputs.
  2. Enforce an upper bound for maxChars (and any other size/complexity controls) inside the provider implementation, not only in higher-level wrappers.

Example (illustrative):

const MAX_CHARS_CAP = 200_000;

createTool: ({ config }) => ({
  description: "Fetch a page using Firecrawl.",
  parameters: {
    type: "object",
    additionalProperties: false,
    properties: {
      url: { type: "string", minLength: 1, maxLength: 2048 },
      extractMode: { type: "string", enum: ["markdown", "text"] },
      maxChars: { type: "integer", minimum: 100, maximum: MAX_CHARS_CAP },
      proxy: { type: "string", enum: ["auto", "basic", "stealth"] },
      storeInCache: { type: "boolean" },
    },
    required: ["url"],
  },
  execute: async (args) => {
    const maxChars =
      typeof args.maxChars === "number" && Number.isFinite(args.maxChars)
        ? Math.min(MAX_CHARS_CAP, Math.max(100, Math.floor(args.maxChars)))
        : undefined;
    return runFirecrawlScrape({ cfg: config, url: String(args.url), extractMode, maxChars });
  },
});

Also consider capping output size independent of maxChars (e.g., hard limit on response text length before wrapping/caching).

3. 🟡 Prompt-injection via unwrapped provider-controlled metadata fields in web_fetch fallback payload
Property Value
Severity Medium
CWE CWE-74
Location src/agents/tools/web-fetch.ts:368-405

Description

normalizeProviderWebFetchPayload correctly wraps and truncates text/title/warning, but it returns several provider-controlled string fields without wrapping or strict sanitization. Since tool output is delivered to an LLM, these fields can carry prompt-injection content (or control characters) that bypasses the external-content wrapper.

Issues:

  • extractor is taken directly from payload.extractor (only trim() checked) and returned verbatim.
  • fetchedAt is accepted verbatim when payload.fetchedAt is a non-empty string.
  • contentType only splits on ; and trim()s; it does not reject embedded control characters (e.g., \r, \n).

While these are “metadata” fields, they still appear in the tool JSON and can influence downstream tool chaining / agent behavior.

Vulnerable code:

const contentType =
  typeof payload.contentType === "string" ? normalizeContentType(payload.contentType) : undefined;
...
const extractor =
  typeof payload.extractor === "string" && payload.extractor.trim()
    ? payload.extractor
    : params.providerId;
...
fetchedAt:
  typeof payload.fetchedAt === "string" && payload.fetchedAt
    ? payload.fetchedAt
    : new Date().toISOString(),

Recommendation

Treat all provider-originated strings as untrusted and either wrap them (if they are meant to be read by the model) or strictly validate/normalize them (if they are protocol metadata).

Suggested hardening:

  • Make extractor an allowlisted identifier (e.g., [a-z0-9._-]{1,64}) and fall back to providerId if it doesn’t match.
  • Only accept fetchedAt if it parses as an ISO date and contains no control characters; otherwise overwrite with new Date().toISOString().
  • For contentType, reject values containing control characters and cap length.

Example:

function hasCtl(s: string) {
  for (const ch of s) {
    const c = ch.charCodeAt(0);
    if (c <= 0x1f || c === 0x7f) return true;
  }
  return false;
}

function normalizeExtractor(x: unknown, fallback: string) {
  if (typeof x !== 'string') return fallback;
  const v = x.trim();
  if (!v || v.length > 64 || hasCtl(v) || !/^[a-z0-9._-]+$/i.test(v)) return fallback;
  return v;
}

function normalizeFetchedAt(x: unknown) {
  if (typeof x !== 'string') return undefined;
  const v = x.trim();
  if (!v || v.length > 64 || hasCtl(v)) return undefined;
  const t = Date.parse(v);
  return Number.isFinite(t) ? new Date(t).toISOString() : undefined;
}

Then use these normalizers in normalizeProviderWebFetchPayload.

4. 🟡 SSRF guard bypass via Firecrawl web fetch provider (arbitrary URL forwarded to Firecrawl)
Property Value
Severity Medium
CWE CWE-918
Location extensions/firecrawl/src/firecrawl-fetch-provider.ts:70-89

Description

The new Firecrawl web-fetch provider forwards an arbitrary user-controlled url to Firecrawl without applying the project's local SSRF / network guard checks.

  • Input: args.url is taken directly from the tool invocation.
  • Sink: runFirecrawlScrape() sends this URL in the POST body to Firecrawl (/v2/scrape).
  • This bypasses the existing web_fetch SSRF protections (e.g., blocking localhost, private CIDRs, and cloud metadata IPs) because the validation happens in the local fetch path, not in the Firecrawl provider/tool.
  • Additionally, the standalone firecrawl_scrape tool (extensions/firecrawl/src/firecrawl-scrape-tool.ts) also passes arbitrary URLs to runFirecrawlScrape().

Impact depends on Firecrawl’s own protections, but if Firecrawl allows fetching internal/metadata endpoints, an attacker could use OpenClaw to retrieve and exfiltrate such content via Firecrawl responses (an indirect SSRF / internal resource access vector).

Vulnerable code:

const url = typeof args.url === "string" ? args.url : "";
...
return await runFirecrawlScrape({
  cfg: config,
  url,
  extractMode,
  maxChars,
  ...(proxy ? { proxy } : {}),
  ...(storeInCache !== undefined ? { storeInCache } : {}),
});

Recommendation

Apply the same SSRF / URL validation rules used by the built-in web_fetch tool before calling Firecrawl.

Minimum hardening:

  • Require http: / https: scheme
  • Block localhost, 127.0.0.0/8, ::1, RFC1918 private ranges, link-local (169.254.0.0/16), and cloud metadata hostnames/IPs
  • Consider resolving DNS and blocking private IP results
  • Reject URLs containing credentials

Example (illustrative):

import { assertWebUrlAllowed } from "../infra/net/ssrf.js"; // or existing helper

execute: async (args) => {
  const raw = typeof args.url === "string" ? args.url : "";
  const parsed = new URL(raw);
  assertWebUrlAllowed(parsed); // throws SsrFBlockedError or similar

  return await runFirecrawlScrape({ cfg: config, url: parsed.toString(), ... });
}

Also apply the same validation in the standalone firecrawl_scrape tool path (or centrally inside runFirecrawlScrape() so all callers benefit).

5. 🔵 Sensitive config (potential secrets) embedded into web fetch snapshot cache key
Property Value
Severity Low
CWE CWE-200
Location src/plugins/web-fetch-providers.runtime.ts:47-55

Description

buildWebFetchSnapshotCacheKey() serializes the entire OpenClawConfig into a JSON string used as a Map key. If the config contains inline secrets (API keys, tokens, etc.), those secret values become part of a long-lived in-memory string (until eviction/TTL) and can be inadvertently exposed via memory inspection, heap dumps, crash reports, or any future/debug logging that prints cache keys.

Key points:

  • Input: params.config (full OpenClawConfig, may include plugin API keys)
  • Transformation: JSON.stringify({ ..., config: params.config ?? null, ... })
  • Sink: stored as a key in envCache.set(cacheKey, ...)

Vulnerable code:

return JSON.stringify({
  ​// ...
  config: params.config ?? null,
  env: buildPluginSnapshotCacheEnvKey(params.env),
});

Recommendation

Do not include raw config values in cache keys.

Since the cache is already scoped by OpenClawConfig identity via the outer WeakMap<OpenClawConfig, ...>, remove config from the key entirely.

function buildWebFetchSnapshotCacheKey(params: {
  workspaceDir?: string;
  bundledAllowlistCompat?: boolean;
  onlyPluginIds?: readonly string[];
  env: NodeJS.ProcessEnv;
}): string {
  return JSON.stringify({
    workspaceDir: params.workspaceDir ?? "",
    bundledAllowlistCompat: params.bundledAllowlistCompat === true,
    onlyPluginIds: [...new Set(params.onlyPluginIds ?? [])].toSorted((l, r) => l.localeCompare(r)),
    env: buildPluginSnapshotCacheEnvKey(params.env),
  });
}

If you truly need to differentiate configs beyond object identity, compute a redacted or hashed fingerprint (e.g., include only non-sensitive fields, or hash a redacted structure) rather than serializing the full config object.


Analyzed PR: #59465 at commit d7f401a

Last updated on: 2026-04-02T11:43:16Z

Latest run failed. Keeping previous successful results. Trace ID: 019d4debfb35d6e2b70ece5657e16361.

Last updated on: 2026-04-02T12:52:22Z

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c73e54e07

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/tools/web-tools.ts Resolved
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime extensions: lobster Extension: lobster labels Apr 2, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e1992e53b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/web-fetch/runtime.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d3804acb1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/config/legacy-web-fetch.ts Resolved
@vincentkoc vincentkoc changed the title feat(plugins): add web fetch provider boundary !feat(plugins): add web fetch provider boundary Apr 2, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7f401a1db

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/web-fetch/runtime.ts Resolved
Comment thread src/secrets/runtime-web-tools.ts Resolved
Comment thread src/agents/tools/web-fetch.ts Resolved
@vincentkoc
vincentkoc merged commit 38d2fae into main Apr 2, 2026
9 checks passed
@vincentkoc
vincentkoc deleted the feat/web-fetch-provider-boundary branch April 2, 2026 11:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41bc8ef24c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +93 to +94
if (pluginWebFetch && typeof pluginWebFetch === "object" && !Array.isArray(pluginWebFetch)) {
return pluginWebFetch;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve legacy fetch key fallback when plugin config is partial

Do not return pluginWebFetch unconditionally here: if plugins.entries.firecrawl.config.webFetch exists but only sets non-secret fields (for example baseUrl), this early return suppresses fallback to tools.web.fetch.firecrawl.*, so resolveFirecrawlApiKey can no longer see a still-valid legacy key and Firecrawl fetch/search starts failing with “needs a Firecrawl API key.” This is a regression for partial migrations where users add new plugin-owned fetch settings before moving the legacy key.

Useful? React with 👍 / 👎.

ngutman pushed a commit that referenced this pull request Apr 3, 2026
* feat(plugins): add web fetch provider boundary

* feat(plugins): add web fetch provider modules

* refactor(web-fetch): remove remaining core firecrawl fetch config

* fix(web-fetch): address review follow-ups

* fix(web-fetch): harden provider runtime boundaries

* fix(web-fetch): restore firecrawl compare helper

* fix(web-fetch): restore env-based provider autodetect

* fix(web-fetch): tighten provider hardening

* fix(web-fetch): restore fetch autodetect and compat args

* chore(changelog): note firecrawl fetch config break
steipete pushed a commit to duncanita/openclaw that referenced this pull request Apr 4, 2026
* feat(plugins): add web fetch provider boundary

* feat(plugins): add web fetch provider modules

* refactor(web-fetch): remove remaining core firecrawl fetch config

* fix(web-fetch): address review follow-ups

* fix(web-fetch): harden provider runtime boundaries

* fix(web-fetch): restore firecrawl compare helper

* fix(web-fetch): restore env-based provider autodetect

* fix(web-fetch): tighten provider hardening

* fix(web-fetch): restore fetch autodetect and compat args

* chore(changelog): note firecrawl fetch config break
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
* feat(plugins): add web fetch provider boundary

* feat(plugins): add web fetch provider modules

* refactor(web-fetch): remove remaining core firecrawl fetch config

* fix(web-fetch): address review follow-ups

* fix(web-fetch): harden provider runtime boundaries

* fix(web-fetch): restore firecrawl compare helper

* fix(web-fetch): restore env-based provider autodetect

* fix(web-fetch): tighten provider hardening

* fix(web-fetch): restore fetch autodetect and compat args

* chore(changelog): note firecrawl fetch config break
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* feat(plugins): add web fetch provider boundary

* feat(plugins): add web fetch provider modules

* refactor(web-fetch): remove remaining core firecrawl fetch config

* fix(web-fetch): address review follow-ups

* fix(web-fetch): harden provider runtime boundaries

* fix(web-fetch): restore firecrawl compare helper

* fix(web-fetch): restore env-based provider autodetect

* fix(web-fetch): tighten provider hardening

* fix(web-fetch): restore fetch autodetect and compat args

* chore(changelog): note firecrawl fetch config break
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* feat(plugins): add web fetch provider boundary

* feat(plugins): add web fetch provider modules

* refactor(web-fetch): remove remaining core firecrawl fetch config

* fix(web-fetch): address review follow-ups

* fix(web-fetch): harden provider runtime boundaries

* fix(web-fetch): restore firecrawl compare helper

* fix(web-fetch): restore env-based provider autodetect

* fix(web-fetch): tighten provider hardening

* fix(web-fetch): restore fetch autodetect and compat args

* chore(changelog): note firecrawl fetch config break
Nachx639 pushed a commit to Nachx639/clawdbot that referenced this pull request Jun 17, 2026
* feat(plugins): add web fetch provider boundary

* feat(plugins): add web fetch provider modules

* refactor(web-fetch): remove remaining core firecrawl fetch config

* fix(web-fetch): address review follow-ups

* fix(web-fetch): harden provider runtime boundaries

* fix(web-fetch): restore firecrawl compare helper

* fix(web-fetch): restore env-based provider autodetect

* fix(web-fetch): tighten provider hardening

* fix(web-fetch): restore fetch autodetect and compat args

* chore(changelog): note firecrawl fetch config break
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
* feat(plugins): add web fetch provider boundary

* feat(plugins): add web fetch provider modules

* refactor(web-fetch): remove remaining core firecrawl fetch config

* fix(web-fetch): address review follow-ups

* fix(web-fetch): harden provider runtime boundaries

* fix(web-fetch): restore firecrawl compare helper

* fix(web-fetch): restore env-based provider autodetect

* fix(web-fetch): tighten provider hardening

* fix(web-fetch): restore fetch autodetect and compat args

* chore(changelog): note firecrawl fetch config break
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request Sep 29, 2026
* feat(plugins): add web fetch provider boundary

* feat(plugins): add web fetch provider modules

* refactor(web-fetch): remove remaining core firecrawl fetch config

* fix(web-fetch): address review follow-ups

* fix(web-fetch): harden provider runtime boundaries

* fix(web-fetch): restore firecrawl compare helper

* fix(web-fetch): restore env-based provider autodetect

* fix(web-fetch): tighten provider hardening

* fix(web-fetch): restore fetch autodetect and compat args

* chore(changelog): note firecrawl fetch config break
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
* feat(plugins): add web fetch provider boundary

* feat(plugins): add web fetch provider modules

* refactor(web-fetch): remove remaining core firecrawl fetch config

* fix(web-fetch): address review follow-ups

* fix(web-fetch): harden provider runtime boundaries

* fix(web-fetch): restore firecrawl compare helper

* fix(web-fetch): restore env-based provider autodetect

* fix(web-fetch): tighten provider hardening

* fix(web-fetch): restore fetch autodetect and compat args

* chore(changelog): note firecrawl fetch config break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: lobster Extension: lobster gateway Gateway runtime maintainer Maintainer-authored PR scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant