Repository navigation
fix(media): decode local file URLs safely - #122192
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 3:02 PM ET / 19:02 UTC. ClawSweeper reviewWhat this changesRoutes host-local Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open for normal maintainer review: current main still manually strips file URLs in the shared resolver and PDF tool, while this PR centralizes conversion through the existing safe path contract. It is a maintainer-authored, maintainer-labeled item, so it is not eligible for automated cleanup. Priority: P2 Review scores
Verification
How this fits togetherMedia tools turn local, sandboxed, and remote references into bytes for image, PDF, and generation workflows. The shared resolver determines the reference kind, enforces sandbox or local-root policy, and passes the resulting path to the media loader. flowchart LR
A[Tool input] --> B[Media reference resolver]
B --> C{Reference kind}
C -->|Local file URL| D[Safe path conversion]
C -->|Sandboxed reference| E[Sandbox bridge validation]
C -->|Remote reference| F[Remote access policy]
D --> G[Local root checks]
E --> G
F --> H[Media loader]
G --> H
H --> I[Image or PDF tool]
Decision needed
Why: The author is listed as a repository member and the PR carries the protected Before merge
Agent review detailsSecurityNone. PR surfaceSource -13, Tests +234, Config 0, Other 0. Total +221 across 9 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the canonical shared-resolver repair after the remaining exact-head checks complete, retaining the registered Windows tool-flow regression coverage and existing sandbox policy behavior. Do we have a high-confidence way to reproduce the issue? Yes, from current source: on Windows, pass a Unicode-and-space Is this the best way to solve the issue? Yes. Updating the existing shared reference-access owner fixes image and generation callers together, while moving PDF off its duplicate conversion path preserves the sandbox and root-policy boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7fe75acb5f46. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…-prep * commit 'edb7a1692e58d78ff7e196db39ea8eff297b2e19': (1351 commits) fix(telegram): expose live location updates to hooks (openclaw#122185) fix(ui): remove the pre-creation session row (openclaw#122259) fix(openai): surface failed realtime response outcomes (openclaw#121177) fix(logging): publish diagnostics ZIP through staged atomic overwrite (openclaw#122130) test(cli): trim duplicate MCP probe process cases (openclaw#122260) feat(agents): replay persisted native video (openclaw#122257) fix(test): serialize default e2e runner (openclaw#122203) fix(ui): always show full assistant responses (openclaw#122207) feat(mcp): per-requester OAuth for MCP servers (openclaw#122166) fix(ui): preserve focus on composer accessory clicks (openclaw#122243) fix(backup): exclude state temp files (openclaw#122250) fix(browser): let attached workers exit after CDP use (openclaw#122103) test(cli): trim duplicate Claw authoring process cases (openclaw#122248) refactor(outbound): inline delivery diagnostics (openclaw#122219) refactor: eliminate final wrapper-shadowing hazards (openclaw#122157) fix(ui): keep new-session identity anchored (openclaw#122242) test(cli): trim duplicate gateway process cases (openclaw#122240) fix(media): decode local file URLs safely (openclaw#122192) refactor(agents): centralize typed activity event emission (openclaw#122188) fix(ui): effort slider matches selected level after model switches (openclaw#122125) ...
* fix(media): decode local file URLs safely * refactor(media): remove obsolete helper exports
Summary
file://references through the canonicalsafeFileURLToPathcontract instead of stripping the scheme manually.Root cause and owner
The shared host media resolver and the PDF tool manually removed the
file://prefix. On Windows that left/C:/...paths and percent-encoded Unicode/spaces, so otherwise valid local files failed containment/loading.resolveMediaToolReferenceAccessis the canonical owner: it now classifies the reference and delegates local file URLs tosafeFileURLToPath; PDF reuses that owner while preserving sandbox bridge validation, local roots, remote SSRF policy, and non-file references.The attributable dependency gate also showed that the internal root helper had been exported unnecessarily and an obsolete sandbox-helper re-export remained. The final head makes the root helper private, removes only those dead surfaces, and keeps direct canonical imports unchanged.
Verification
LocalMediaAccessErroron/C:/...caf%C3%A9%20image.png.@openclaw/[email protected]source/types and direct Linux/Win32 conversion/rejection proof passed. An isolated0.5.2compatibility proof passed the same Unicode/space and unsafe-host/encoded-separator contract.deadcode:exportsanddeadcode:dependenciesclean; directoxfmt,oxlint, andgit diff --checkclean.Current-main composition
Fresh
origin/mainwas5179e1235293bbd80c623cf3b6359414b1cb1e74. Its only scoped drift is a hunk-disjointpackage.jsonchange to duplicate-check commands around line 1610; this PR changes the Windows CI test list around line 1968.git merge-tree --write-tree origin/main HEADcompleted cleanly with tree51f0bc60820e539adb3db3219c9eb304028c586f, so the exact reviewed head was preserved rather than rebased for unrelated churn.