Secure receipt images, upload limits, consistent totals, and AI mismatch reconciliation#16
Conversation
- Remove public /uploads mount; add authenticated /receipts/{id}/image endpoint (header or cookie JWT)\n- Enforce 10MB upload limit (server chunked read + client-side guard)\n- Recompute receipt totals on item create/update/delete\n- Always send Gemini image bytes as PNG; redact validation request body logging\n- Fix login redirect param handling; add tests
Summary of ChangesHello @cgoncalves94, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the application's security posture and data integrity. It addresses critical vulnerabilities by securing receipt image access and preventing sensitive data leaks. Furthermore, it enhances data accuracy by ensuring receipt totals are always correctly calculated based on their items. User experience is also improved through client-side upload validation and proper redirection after login, making the application more robust and trustworthy. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2583a37822
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Code Review
This is a great pull request that addresses several important issues, including a critical security vulnerability with public receipt images, data consistency problems with receipt totals, and missing upload limits. The introduction of a secure, authenticated endpoint for images and the path traversal protection in resolve_image_path are well-implemented. The move to recalculate totals from items is a robust fix for data drift. The changes are well-tested, with new integration and unit tests covering the new logic. I have a few minor suggestions in backend/app/receipt/services.py to simplify the ORM usage and improve efficiency by removing some redundant session operations, but overall this is excellent work.
- Add same-origin proxy route for receipt images and update frontend usage - Simplify create_item total recalculation and fix unit test - Ensure API route cookie access is awaited
|
Addressed. Images are now fetched through a same-origin proxy route () that attaches the bearer token from the cookie. The receipt detail page uses that proxy, so it works across frontend/API origins. |
|
Addressed. Images are now fetched through a same-origin proxy route ( |
|
Addressed. now appends the new item to and recomputes totals without the extra refresh/append check; tests updated accordingly. |
|
Addressed. |
- Align app route handler signature with Next.js 16 params Promise
Executive Summary
This PR started with security and consistency hardening, and now also includes robust mismatch reconciliation for noisy receipt scans.
Delivered Scope
Added In This Iteration
item_id,remove=true, short reason).Why This Matters
Verification