Repository navigation
fix(image-backends): reject inline base64 that does not decode to PNG, JPEG or WebP - #2927
Conversation
…, JPEG or WebP A relay returning a bare status word such as SUCCESS in the image_b64 field decoded as valid base64, so the garbage bytes were written as the image and the endpoint test reported a byte count. Check the decoded head against the PNG/JPEG/WebP magic numbers and fail the same way an invalid base64 string does.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (4)
🧰 Additional context used📓 Path-based instructions (1)Source excerpt: lint、类型检查、依赖检查报错时修改代码,不加 baseline、计数阈值或整条规则关闭。豁免只用于确认过的误报,每一处都写明理由,理由与豁免写在同一行。 Source excerpt: 行内语法不可用时,豁免写在配置条目旁,每个条目旁用一行注释写明理由: Source excerpt: deptry 的 `DEP002` / `DEP004`:写在 `[tool.deptry.per_rule_ignores]`,按包名逐项列出。 Sour...📄 CodeRabbit inference engine (docs/standards/general.md) Files:
📝 WalkthroughWalkthrough
Changes图片 Base64 校验
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change rejects non-image Base64 content while preserving PNG, JPEG, and WebP inputs and existing failure reporting. No merge-blocking issue is identified from the supplied evidence; merge after normal checks pass. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Closes #2924.
变更
A relay that returns a bare status word such as
SUCCESSin theimage_b64field passes base64 decoding, so the garbage bytes were saved as the image and the endpoint test reported a byte count.decode_image_b64now checks the decoded head for PNG, JPEG or WebP and raisesValueErrorotherwise, the same as invalid base64.验证
风险与遗留
无
Summary by CodeRabbit