[Security] log_correction uses raw_request.json() instead of Pydantic model; no CorrectionsLogService#2882
Conversation
…sLogService - Replace raw_request.json() parsing with CorrectionLogRequest Pydantic model - Use CorrectionsLogService (thread-safe, atomic) with log rotation (max 10000 entries) - Add CorrectionLogRequest, Message, TicketRecord, HealthResponse, ReadinessResponse models - Re-export all models from backend.models.__init__.py Fixes ritesh-1918#2870
|
Someone is attempting to deploy a commit to the ritesh Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
Target
\�ackend/routers/ai.py:log_correction
\�ackend/schemas.py, \�ackend/models/init.py\
Vector
Insecure Deserialization & Payload Validation (Security)
Problem
The \log_correction\ endpoint parsed the entire request via \�wait raw_request.json()\ with no size limits or schema enforcement. A malicious 100MB JSON body would be loaded into memory. Manual .get()\ calls lacked type coercion guarantees. The raw file I/O (read entire file → append → write entire file) was not thread-safe and would corrupt the log under concurrent admin corrections.
Changes
aw_request.json()\ with a new \CorrectionLogRequest\ Pydantic model
Fixes #2870