Skip to content

fix(qoder): bound CN PNG raster dimensions - #8021

Merged
lidge-jun merged 4 commits into
lidge-jun:devfrom
luvs01:codex/fix-qoder-cn-image-vulnerability
Oct 31, 2026
Merged

lidge-jun merged 4 commits into
lidge-jun:devfrom
luvs01:codex/fix-qoder-cn-image-vulnerability

Conversation

@luvs01

@luvs01 luvs01 commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Bound Qoder CN PNG raster dimensions before CLI discovery: at most 8,192 pixels per edge and 16,000,000 pixels total, preserving existing decoded-byte (1 MiB), compressed-input and IHDR validation. The rejection message names all three limits. Accepted boundary fixtures, architecture documentation and the public provider guide preserve the supported contract.

Migrated from luvs01/opencodex#794, preserving HEAD 33dad092c460fb514619f7f965b55f443e0dec5f and original commits. The source includes current observed dev c34d26ff2bde9516517fe7fd58c2bcda70ca5e03 with a focused five-file delta and no GUI changes. The reviewed error-message omission was addressed in this head.

Verification

  • Current native Windows validation, pinned Bun 1.4.4 and isolated homes: focused image suites 53 pass / 191 assertions; typecheck 2,252 files, structure/privacy/file-size gates, docs build 633 pages / 91,435 links, and diff checks passed. Independent read-only review found no blocker.
  • Focused suites: bun test tests/providers/qoder-cn-image-validation.test.ts tests/providers/qoder-image-input.test.ts. Exact-event tests assert the complete rejection message; oversize width/height/total pixels and accepted boundary cases remain covered.
  • The initial file-size check lacked sparse GUI files; restoring the tracked GUI/skills inventory corrected the environment, without weakening a gate.
  • Exact-head fork CI41121411022 and Catalog41121411177 succeeded; all required source checks passed and no unresolved fork review remained. These are fork evidence, not upstream CI.
  • Earlier Linux/Bun 1.4.4 validation at 33769e1 passed 53 cases / 191 assertions and independently checked PNG chunk CRC, zlib raster length and Pillow full decoding of 8000×2000, 8192×1 and 1×8192 fixtures. That is historical evidence, not a repeat of those validations at the current head.
  • Full local repository testing is not claimed; focused image regression and listed gates provide local evidence, broader execution is left to exact-head hosted CI. Policy-skipped native lanes are not native execution. Vendor CLI image understanding was not tested. No live vendor request, installed runtime, configuration or dependency change was performed.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. Independent scoped review and bounded-input regressions are recorded; maintainer/security acceptance remains separate.

Upstream readiness

Initially submitted Draft. Exact upstream CI/Catalog succeeded; no merge, deployment or fork closure is requested.

  • Required local validation passed with its scope and remaining limitations documented.
  • Branch includes observed current dev c34d26f.
  • All correct Codex and CodeRabbit findings are addressed; no open inline findings at current readback. Draft automatic-review skip is not approval.
  • Ready for review: exact upstream CI and current review/base readback confirmed.

Exact upstream validation — 2026-10-30 20:57 UTC

Exact head 33dad092c460fb514619f7f965b55f443e0dec5f: Cross-platform CI41126106202 and Catalog41126106165 completed successfully. Hygiene passed; current dev remains c34d26f and the branch is zero behind. Inline review threads are zero; CodeRabbit skipped while Draft, not approval. Ready-event reviews will be tracked. Scoped native/local limitations and separate maintainer/security acceptance remain above.

Summary by CodeRabbit

  • Bug Fixes
    • PNG images on the China preset are now limited to 8,192 pixels per edge and 16 million pixels total, alongside the existing 1 MiB decoded-size limit. Images exceeding these limits are rejected.
  • Documentation
    • Updated the image-input guidance to reflect the PNG dimension and total-pixel limits.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between c34d26f and 33dad09.

Files selected for processing: 5
  • docs-site/src/content/docs/guides/providers.md
  • src/adapters/qoder/adapter.ts
  • src/adapters/qoder/image-input.ts
  • structure/providers/chat-compat.md
  • tests/providers/qoder-cn-image-validation.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Walkthrough

Qoder CN PNG validation now rejects images wider or taller than 8192 pixels and images with more than 16,000,000 pixels. Tests cover invalid dimensions and accepted boundary-sized rasters. Provider documentation describes the limits.

Changes: Qoder CN PNG validation

Layer / File(s) Summary
Enforce PNG dimension bounds
src/adapters/qoder/image-input.ts:7-8, src/adapters/qoder/image-input.ts:30-32, src/adapters/qoder/adapter.ts:283
boundedPngDataUrl rejects PNGs that exceed either edge limit or the total-pixel limit. The unsupported-input error message in the adapter hunk is unchanged.
Cover and document the limits
tests/providers/qoder-cn-image-validation.test.ts:2-128, docs-site/src/content/docs/guides/providers.md:1453, structure/providers/chat-compat.md:584
Tests cover dimensions above the limits and accepted boundary-sized rasters within the 1 MiB encoded-size ceiling. Both documentation sources state the new dimension limits.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • lidge-jun/opencodex#7536: This PR adds forwarding of supported Qoder CN raw images into the CLI flow, which is the image path where the new PNG validation applies.

Suggested reviewers: chilung-cgu

Merge Risk: Minimal · up to 33dad

The PNG dimension limits are enforced on reachable Qoder CN inputs, with boundary coverage and no established merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding bounds for Qoder CN PNG raster dimensions.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 3 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Oct 30, 2026
@luvs01
luvs01 marked this pull request as ready for review October 30, 2026 20:57
@lidge-jun

Copy link
Copy Markdown
Owner

Maintainer dev-integration decision: the owner (@lidge-jun) authorized admin integration of this PR into dev as part of the post-v2.95 batch.

Cross-platform coverage comes from the batched dev lane=all run after the batch.

@lidge-jun
lidge-jun merged commit 2ee32ab into lidge-jun:dev Oct 31, 2026
36 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants