Repository navigation
fix: validate large media data URLs without stack overflow - #146972
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 7:39 AM ET / 11:39 UTC (Revision 2). ClawSweeper reviewWhat this changesThe Gateway validates inline media by searching for invalid base64 characters, avoiding regular-expression stack exhaustion while preserving existing input rules. Merge readiness✅ Ready for maintainer review This remains a useful, narrowly scoped fix: fetched main and the latest release retain the affected validator. No actionable correctness or security findings remain, and the previous review recorded no unresolved findings. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway turns media in assistant replies into managed attachments for chat display and download. Inline media passes through character validation, size checks, and decoding before storage. flowchart TD
A[Assistant reply media] --> B[Parse inline data URL]
B --> C[Check characters and empty payload]
C --> D[Check media size]
D --> E[Decode and store attachment]
E --> F[Chat display and download]
C --> G[Sanitized preparation error]
D --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +1. Total +1 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep validation in the existing managed-media parser, preserving its grammar, byte limits, decoding, and sanitized errors. Do we have a high-confidence way to reproduce the issue? Yes: the existing oversized audio/video cases exercise the affected production parser, and the PR reports a failing baseline in the original shared-worker order. This read-only review verified the path but did not execute that reproduction. Is this the best way to solve the issue? Yes: the replacement accepts the same nonempty character language while removing the quantified whole-payload match, without adding a competing parser or changing downstream policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4883e4699ee3. 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.
|
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (1537 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (30 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
What Problem This Solves
Fixes large inline media payloads failing with a generic preparation error when base64 validation exhausts the regexp stack before checking the size limit.
User Impact
The Gateway validates large media data URLs and reports the intended size or input error. Accepted characters, whitespace, padding, size limits, decoding, and error sanitization are unchanged.
Why This Change Was Made
The quantified whole-string alphabet match can throw
RangeError: Maximum call stack size exceededafter the shared Gateway test sequence warms it. Search for an invalid character instead, with an explicit empty-payload check. This preserves the existing grammar without the failing quantified match.Related: main-branch QA follow-up to #146897 and #146931.
Evidence
RegExp.testas the original exception; sanitization was behaving correctly.git diff --checkpassed. Independent Codex review through P2 found no actionable issues.