Cap progress request bodies and stored module ID lists (MM-70622) - #10
Cap progress request bodies and stored module ID lists (MM-70622)#10esethna wants to merge 3 commits into
Conversation
Authenticated users could send unbounded completedModuleIds arrays that the handler decoded fully and merged into a KV record that never shrinks. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Limit details: You’ve used the included review currently available. 📝 WalkthroughWalkthroughThe change adds bounded request-body reads and module-ID validation for progress updates. HTTP handlers return client errors for oversized or invalid payloads. Storage rejects merged records above the completed-module limit and preserves existing records. ChangesProgress limits
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ServeHTTP
participant ProgressHTTP
participant Store
Client->>ServeHTTP: Send progress update
ServeHTTP->>ProgressHTTP: Forward size-limited request body
ProgressHTTP->>ProgressHTTP: Read and validate payload
ProgressHTTP->>Store: Save validated progress
Store-->>ProgressHTTP: Return persistence result
ProgressHTTP-->>Client: Return HTTP response
Merge Risk: ⚪ Minimal · up to Progress updates now reject oversized bodies, invalid or excessive module IDs, and merged records above the storage cap while preserving existing records on rejection. The supplied coverage supports the new client-error behavior, with no outstanding merge-readiness risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Co-authored-by: Cursor <cursoragent@cursor.com>
|
@esethna Can we please have a dev review done as well? |
Summary
MaxBytesReadertrips, so progress PUTs cannot decode an unbounded payload into memory.completedModuleIds/moduleIdsover 256 entries or IDs that fail the same character-set and length rules as guide IDs.Test plan
PUTa body larger than 64 KiB to/plugins/com.mattermost.academy/api/v1/progress/{guideId}and confirm 413.PUTmore than 256 module IDs, or an ID like../x/AI, and confirm 400.Made with Cursor