Repository navigation
Conversation
f2e9cbf to
ffda110
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 6:49 AM ET / 10:49 UTC. ClawSweeper reviewWhat this changesThe PR redacts credentials reflected in Parallel web-search HTTP failure bodies and empty-body reason phrases before they reach tool-visible errors. Merge readinessThis PR remains necessary: current main still inserts a Parallel response body or reason phrase directly into an error after sending an API key. The exact-head patch repairs that plugin-owned boundary with the public SDK redactors and covers the configured-pattern ordering case; no blocking finding was identified. Priority: P1 Review scores
Verification
How this fits togetherThe Parallel plugin makes authenticated web-search requests and translates failed HTTP responses into agent-visible errors. This change filters untrusted provider or proxy response text before it enters diagnostics, logs, or tool results. flowchart LR
A[Authenticated Parallel search] --> B[Provider or proxy]
B --> C[Failure body or reason phrase]
C --> D[Parallel error boundary]
D --> E[SDK redaction layers]
E --> F[Tool-visible diagnostic]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +12, Tests +83. Total +95 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Merge the focused plugin-local repair after normal exact-head merge gating; retain the separate shared-helper work in #120200 for bearer-auth web-search providers. Do we have a high-confidence way to reproduce the issue? Yes—an authenticated controlled endpoint that reflects x-api-key in a 502 body or reason phrase reaches the raw current-main error construction; the PR includes before/after real transport output for both paths. Is this the best way to solve the issue? Yes—the Parallel runtime owns its distinct x-api-key request and error boundary, while bearer-auth shared web-search helpers are separately covered by #120200. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8b501c1c1343. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
ffda110 to
a2bf4b8
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review — the P1 finding is addressed at head 272793c: the error boundary now runs the canonical redactToolPayloadText (configured logging.redactPatterns + defaults) layered over the tools-mode pass that keeps header-shaped value masking intact; a regression test with both an org-secret pattern and a header-name-mangling pattern (api[_-]?key) proves neither secret survives. Note: running redactToolPayloadText alone regresses the header-shaped case — a configured field-name pattern rewrites x-api-key to x-*** before the structured matcher sees it; the two-layer order is load-bearing and covered by the new test. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…penclaw#120205) * fix(parallel): redact x-api-key reflected in web search error bodies * fix(parallel): use canonical tool-payload redactor for reflected error bodies * fix(parallel): layer configured redactPatterns over header-shape redaction
Summary
The Parallel web_search provider (
extensions/parallel/src/parallel-web-search-provider.runtime.ts) posts with anx-api-keyheader and, on a non-2xx response, splices server-controlled error text — the bounded body, or thestatusTextreason phrase when the body is empty — into the thrown error message. Any proxy/edge error page that reflects request material then leaks the API key into user-facing error text. The composed detail is now redacted in two layers: a tools-mode pass that masks header-shaped reflections, then the canonicalredactToolPayloadTextso configuredlogging.redactPatternsapply on top of the built-in credential patterns.What Problem This Solves
runParallelSearch()sendsx-api-key: params.apiKeyand, on!res.ok, throws`Parallel API error (${res.status}): ${detail || res.statusText}`with the raw text (extensions/parallel/src/parallel-web-search-provider.runtime.ts:163).plugins.entries.parallel.config.webSearch.baseUrl), so deployments routinely front it with corporate proxies or gateways — exactly the class of intermediary whose error responses echo request material, includingx-api-key.Bad Gateway reflected x-api-key: <key>exposes the key through thestatusTextfallback even when there is no body.Errormessage, and from there into tool results, transcripts, and logs.代码证据: on
main, pointingbaseUrlat a local server that answers 502 with the request'sx-api-keyreflected in the page producesError: Parallel API error (502): …x-api-key: par-live-4c9d2e7ab1f0c9d2e7ab1f0c9d2e7…; an empty-body 502 with the key in the reason phrase leaks it through the fallback the same way.Same defect class as the merged #117304 (voice-call) and #119536 (discord) fixes, and the sibling web-search-provider-common fix in #120200.
Root Cause
The error path was written for diagnostics (
status + bounded body snippet) before credential redaction became the house standard for tool-facing text. The violated invariant: text derived from the response to an authenticated request — body and reason phrase alike — must be treated as potentially containing the request's credentials and may only reach user-facing surfaces after redaction. The body read is already bounded (PARALLEL_ERROR_BODY_LIMIT_BYTES= 8 KiB, with a.catch(() => "")), so only the redaction pass was missing.Why This Fix
statusTextfallback) so neither server-controlled channel can carry credential material into the message:redactToolPayloadText(redactSensitiveText(detail || res.statusText, { mode: "tools" })).redactSensitiveText(…, { mode: "tools" })masks header-shaped reflections (x-api-key: <key>→x-api-key: par-li…d2e7) via the structured auth-header matcher, and keeps redaction on regardless of the operator's log-redaction config.redactToolPayloadText(the canonicalopenclaw/plugin-sdk/logging-coresurface) then applies configuredlogging.redactPatternsmerged with the built-in defaults, so organization-specific secrets are stripped too.api[_-]?keyrewrites the header name tox-***before the structured matcher can recognize the shape, so running the canonical redactor alone (or first) leavesx-***: <value still visible>; running the tools-mode pass first preserves the shape for the structured matcher, and the canonical pass then handles configured patterns. Verified with both pattern classes configured at once.""for empty input, so the||fallback semantics are preserved exactly: non-empty body → redacted body; empty/unreadable body → redacted reason phrase.User Impact
PARALLEL_API_KEYin error text when a proxy or the provider edge reflects request material — in the error page or in the reason phrase.Evidence
x-api-key(1) into a 502 HTML page and (2) into the reason phrase of an empty-body 502; the realexecuteParallelWebSearchProviderTool()entry point ran end to end through the SSRF-guarded fetch → both messages contain the full key → FAIL ×2.x-api-key: par-li…d2e7), status and label intact → PASS ×2.logging.redactPatterns: ["acme-internal-[a-z0-9-]+", "api[_-]?key"], a 502 page reflecting both an org-specific secret and the key masks both (edge failure for acme-i…-042 on request with x-***: par-li…d2e7) → PASS. (Theapi[_-]?keycase proves the layering: the header name gets rewritten by the configured pattern, and the value stays masked because the tools-mode pass ran first.)Real Behavior Proof
Before (on main)
After (with fix)
(Real
node:httpserver bound to 198.18.0.1 — the RFC 2544 benchmark range the trusted-endpoint SSRF policy explicitly allows, since loopback is blocked — withbaseUrlpointed at it; the full guarded fetch, header injection, and error path execute for real. The proof key contains no dictionary words, so only credential-aware redaction can mask it.)Tests and Validation
node scripts/check.mjspassednpx vitest run extensions/parallel/src/parallel-web-search-provider.test.tspassed (54 tests, incl. regression tests: a 502 page echoing the configured key surfaces with the key masked — using a dictionary-word-free key so only credential-aware redaction catches it — an empty-body 502 with the key in the reason phrase is masked through thestatusTextfallback, and a 502 page reflecting an organization-specific secret plus the key under configuredlogging.redactPatterns(including a header-name-mangling pattern) masks both, while the label and status stay intact)