fix(pingora): bound decoded PNG size separately from the HTTP response cap - #2498
Conversation
…e cap _is_complete_png rejected any PNG whose decoded scanlines exceed MAX_RESPONSE_BYTES (16 MiB), a limit meant for REST responses. A valid 2238x2052 RGBA macOS screenshot decodes to 18.4 MB, so it was treated as not-a-PNG, fell through to the text scan and failed as "not valid UTF-8". This blocked five screenshots under a declared artifact prefix in late-life-anxiety-reanalysis#257. Add MAX_PNG_DECODED_BYTES (128 MiB) for the decoded-pixel bound and keep the response cap unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011arF4D6VAoT48vh5HvyHtD
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The lockfile was generated by a local `uv run` and is not part of the PNG bound fix. main has no root uv.lock, and adding one widens this PR into a dependency change. tests/test_pingora_edge_policy.py passes without it (100 passed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N9qbK6d91C7LkriuTf7dR8
|
관리자 우회 병합 기록(사용자 승인, 메인 코디네이터 run_b22de9a1c59d). 병합한 head는 직접 확인한 것: 디코딩 상한만 우회한 검사: 호스팅 러너를 기다리던 Semgrep, gitleaks, CodeQL(javascript-typescript), strix, noema-review와, current-head 판정이 없어 fail-closed로 실패한 opencode-review. 사후 결과가 나오면 이 PR에 남긴다. |
Problem
_is_complete_pngcaps the decoded scanline size atMAX_RESPONSE_BYTES(16 MiB). That constant is the REST response cap, and it has nothing to do with image size. A valid 2238×2052 RGBA screenshot decodes to 18,371,556 bytes, so the checker returnsFalsefor it. The file then falls through to the text scan and fails withRuntime policy candidate … is not valid UTF-8.Evidence from ContextualWisdomLab/late-life-anxiety-reanalysis#257 (head
3936039):docs/delivery_interim_20260920/. All chunk CRCs are valid, and each file passes_is_complete_pngonce the decoded bound is raised.evaluate_pull_requestfrommain(3295c25) with the changed-file pages taken from the API and the file bytes served from local Git objects.bcea800the replay fails on the same file with the same message as the hostedrequired-workflow-bootstraprun 36256600471.6b0efdb(after Tighten OpenCode mapped-output regression review #269's declaration) it stops at the first oversized screenshot, after 1,431 admissions.Change
MAX_PNG_DECODED_BYTES = 128 MiBand use it for the decoded-pixel bound. The response cap stays as it is.hugeboundary test now points at the new constant.pytest tests/test_pingora_edge_policy.py tests/test_pingora_hwpx_evidence.py tests/test_pingora_edge_workflow_contract.py: 123 passed. Branch coverage ofpingora_edge_policy.pyis unchanged frommain: the new lines are covered, and the same 4 lines were already uncovered in this subset.Separate finding, not changed here
Each binary file costs one Contents request, plus a blob request above 1 MiB. PR #257 has about 1,660 changed files, so one evaluation needs roughly 1,700–3,300 requests. GitHub documents the
GITHUB_TOKENlimit as 1,000 requests per hour per repository (15,000 for Enterprise Cloud). A local run under a 5,000/h user token also ran out partway. Very large PRs may therefore hit a rate-limitHTTPErroreven after this fix.🤖 Generated with Claude Code
https://claude.ai/code/session_011arF4D6VAoT48vh5HvyHtD