Repository navigation
Reject invalid demo uploads before storage - #885
Conversation
Parse demo metadata before blob upload and return a clear 422 response instead of persisting corrupted sentinel values. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b5220096-f71b-449f-b76a-f07fc9a5a4f4
Dependency ReviewThe following issues were found:
License Issuessrc/XtremeIdiots.Portal.Repository.Api.V1/XtremeIdiots.Portal.Repository.Api.V1.csproj
src/XtremeIdiots.Portal.Repository.Api.V2/XtremeIdiots.Portal.Repository.Api.V2.csproj
OpenSSF Scorecard
Scanned Files
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new 422 response is missing from OpenAPI metadata, and its error-code contract is not asserted.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Updates V1 demo uploads to validate metadata before blob storage, using the corrected demo decoder.
Changes:
- Upgrades
MX.CodDemoReaderto 1.0.49. - Adds a demo-processing service and returns 422 for invalid demos.
- Ensures temporary-file cleanup and adds regression tests.
| File | Description |
|---|---|
Api.V2.csproj |
Upgrades the demo reader dependency. |
Api.V1.csproj |
Upgrades the demo reader dependency. |
ServiceCollectionExtensions.cs |
Registers the processor service. |
IDemoFileProcessor.cs |
Defines processing contracts. |
DemoFileProcessor.cs |
Validates metadata before storage. |
DemosController.cs |
Handles invalid demos and cleans temporary files. |
DemoFileProcessorTests.cs |
Tests rejection before storage access. |
DemosControllerTests.cs |
Tests valid and invalid persistence paths. |
ApiErrorMessages.cs |
Adds the invalid-demo message. |
ApiErrorCodes.cs |
Adds INVALID_DEMO_FILE. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b5220096-f71b-449f-b76a-f07fc9a5a4f4
Test resultsHead:
Counts include each project/framework execution; summed TRX windows are not wall-clock time. No cross-suite totals are inferred. |
⛔ Superseded — A newer run has replaced this result.⛔ Superseded — A newer run has replaced this result.🏗️ Terraform Plan
✅ Validate — Passed ✅ Plan
📋 Resource Details
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b5220096-f71b-449f-b76a-f07fc9a5a4f4
⛔ Superseded — A newer run has replaced this result.🏗️ Terraform Plan
✅ Validate — Passed ✅ Plan
📋 Resource Details
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b5220096-f71b-449f-b76a-f07fc9a5a4f4
|
🏗️ Terraform Plan
✅ Validate — Passed ✅ Plan
📋 Resource Details
|





Summary
MX.CodDemoReaderto 1.0.49 with the corrected CoD demo decoder422 Unprocessable EntitywithINVALID_DEMO_FILEinstead of persistingFile corrupted!metadataValidation
MX.CodDemoReader1.0.49Depends on the reader fix released by frasermolyneux/cod-demo-reader#36.