Skip to content

Reject invalid demo uploads before storage - #885

Merged
frasermolyneux merged 4 commits into
mainfrom
fix/reject-invalid-demo-uploads
Oct 3, 2026
Merged

frasermolyneux merged 4 commits into
mainfrom
fix/reject-invalid-demo-uploads

Conversation

@frasermolyneux

Copy link
Copy Markdown
Owner

Summary

  • update MX.CodDemoReader to 1.0.49 with the corrected CoD demo decoder
  • parse demo metadata before uploading to blob storage
  • return 422 Unprocessable Entity with INVALID_DEMO_FILE instead of persisting File corrupted! metadata
  • guarantee temporary upload cleanup and add regression coverage for valid and invalid processing paths

Validation

  • clean solution restore from NuGet.org using MX.CodDemoReader 1.0.49
  • Release solution build: 0 warnings, 0 errors
  • focused V1 demo tests: 9 passed on net9.0 and 9 passed on net10.0
  • formatting verification passed

Depends on the reader fix released by frasermolyneux/cod-demo-reader#36.

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
Copilot AI balanced review requested due to automatic review settings October 3, 2026 18:32
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 2 package(s) with unknown licenses.
See the Details below.

License Issues

src/XtremeIdiots.Portal.Repository.Api.V1/XtremeIdiots.Portal.Repository.Api.V1.csproj

PackageVersionLicenseIssue Type
MX.CodDemoReader1.0.49NullUnknown License

src/XtremeIdiots.Portal.Repository.Api.V2/XtremeIdiots.Portal.Repository.Api.V2.csproj

PackageVersionLicenseIssue Type
MX.CodDemoReader1.0.49NullUnknown License

OpenSSF Scorecard

PackageVersionScoreDetails
nuget/MX.CodDemoReader 1.0.49 UnknownUnknown
nuget/MX.CodDemoReader 1.0.49 UnknownUnknown

Scanned Files

  • src/XtremeIdiots.Portal.Repository.Api.V1/XtremeIdiots.Portal.Repository.Api.V1.csproj
  • src/XtremeIdiots.Portal.Repository.Api.V2/XtremeIdiots.Portal.Repository.Api.V2.csproj

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Medium severity · 1 Low severity

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.CodDemoReader to 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
Copilot AI balanced review requested due to automatic review settings October 3, 2026 18:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation and tests consistently enforce validation before storage and expose the documented error contract.

Review effort: Balanced
Findings: None

Resolved since last review (2)

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Test results

Head: 032fea9e7230 | Tested: 4c2b37349dc3 | Run 37146316556, attempt 1

Job / report / suite Status Passed Failed Skipped Total TRX windows Results
build-and-test / test_report / Unit passed: Completed 1470 0 16 1486 48.056 s TRX
build-and-test / v1_ci_test_report / Unit passed: Completed 1470 0 16 1486 41.184 s TRX
build-and-test / shared_tests_3_test_report / Unit passed: Completed 1470 0 16 1486 37.199 s TRX
build-and-test / integration_v1_test_report / Integration-V1 passed: Completed 15 0 0 15 4.574 s TRX
build-and-test / integration_v2_test_report / Integration-V2 passed: Completed 4 0 0 4 1.785 s TRX

Counts include each project/framework execution; summed TRX windows are not wall-clock time. No cross-suite totals are inferred.
The test/build jobs remain authoritative. Missing reports and unsuccessful job outcomes are never presented as passing.

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor
⛔ Superseded — A newer run has replaced this result.
⛔ Superseded — A newer run has replaced this result.

🏗️ Terraform Plan

🌍 Environment: dev

✅ Validate — Passed

✅ Plan

Count
➕ Add 23
📋 Resource Details
Action Resource
➕ Create azurerm_api_management_api_version_set.api_version_set
➕ Create azurerm_api_management_product.api_product
➕ Create azurerm_api_management_product_policy.api_product_policy
➕ Create azurerm_linux_web_app.app_v1
➕ Create azurerm_linux_web_app.app_v2
➕ Create azurerm_monitor_activity_log_alert.rg_resource_health
➕ Create azurerm_mssql_database.database
➕ Create azurerm_portal_dashboard.app
➕ Create azurerm_portal_dashboard.staging_dashboard[0]
➕ Create azurerm_role_assignment.app-to-storage
➕ Create azurerm_role_assignment.app-to-storage-table
➕ Create azurerm_role_assignment.workflow-sp-to-backup-storage
➕ Create azurerm_storage_account.sql_backup_storage
➕ Create azurerm_storage_account.table_storage
➕ Create azurerm_storage_account.web_api_storage
➕ Create azurerm_storage_container.demos_container
➕ Create azurerm_storage_container.gametracker_container
➕ Create azurerm_storage_container.map_images_container
➕ Create azurerm_storage_container.sql_backups_container
➕ Create azurerm_storage_management_policy.sql_backup_lifecycle
➕ Create azurerm_storage_table.live_players
➕ Create azurerm_storage_table.live_status
➕ Create random_id.environment_id

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5220096-f71b-449f-b76a-f07fc9a5a4f4
Copilot AI balanced review requested due to automatic review settings October 3, 2026 18:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The validation, storage ordering, API response contract, cleanup, dependency release, and regression coverage are aligned.

Review effort: Balanced
Findings: None

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor
⛔ Superseded — A newer run has replaced this result.

🏗️ Terraform Plan

🌍 Environment: dev

✅ Validate — Passed

✅ Plan

Count
➕ Add 23
📋 Resource Details
Action Resource
➕ Create azurerm_api_management_api_version_set.api_version_set
➕ Create azurerm_api_management_product.api_product
➕ Create azurerm_api_management_product_policy.api_product_policy
➕ Create azurerm_linux_web_app.app_v1
➕ Create azurerm_linux_web_app.app_v2
➕ Create azurerm_monitor_activity_log_alert.rg_resource_health
➕ Create azurerm_mssql_database.database
➕ Create azurerm_portal_dashboard.app
➕ Create azurerm_portal_dashboard.staging_dashboard[0]
➕ Create azurerm_role_assignment.app-to-storage
➕ Create azurerm_role_assignment.app-to-storage-table
➕ Create azurerm_role_assignment.workflow-sp-to-backup-storage
➕ Create azurerm_storage_account.sql_backup_storage
➕ Create azurerm_storage_account.table_storage
➕ Create azurerm_storage_account.web_api_storage
➕ Create azurerm_storage_container.demos_container
➕ Create azurerm_storage_container.gametracker_container
➕ Create azurerm_storage_container.map_images_container
➕ Create azurerm_storage_container.sql_backups_container
➕ Create azurerm_storage_management_policy.sql_backup_lifecycle
➕ Create azurerm_storage_table.live_players
➕ Create azurerm_storage_table.live_status
➕ Create random_id.environment_id

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5220096-f71b-449f-b76a-f07fc9a5a4f4
Copilot AI balanced review requested due to automatic review settings October 3, 2026 19:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The validation, error contract, cleanup behavior, dependency update, and regression coverage are aligned with the stated purpose.

Review effort: Balanced
Findings: None

@sonarqubecloud

sonarqubecloud Bot commented Oct 3, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

🏗️ Terraform Plan

🌍 Environment: dev

✅ Validate — Passed

✅ Plan

Count
➕ Add 23
📋 Resource Details
Action Resource
➕ Create azurerm_api_management_api_version_set.api_version_set
➕ Create azurerm_api_management_product.api_product
➕ Create azurerm_api_management_product_policy.api_product_policy
➕ Create azurerm_linux_web_app.app_v1
➕ Create azurerm_linux_web_app.app_v2
➕ Create azurerm_monitor_activity_log_alert.rg_resource_health
➕ Create azurerm_mssql_database.database
➕ Create azurerm_portal_dashboard.app
➕ Create azurerm_portal_dashboard.staging_dashboard[0]
➕ Create azurerm_role_assignment.app-to-storage
➕ Create azurerm_role_assignment.app-to-storage-table
➕ Create azurerm_role_assignment.workflow-sp-to-backup-storage
➕ Create azurerm_storage_account.sql_backup_storage
➕ Create azurerm_storage_account.table_storage
➕ Create azurerm_storage_account.web_api_storage
➕ Create azurerm_storage_container.demos_container
➕ Create azurerm_storage_container.gametracker_container
➕ Create azurerm_storage_container.map_images_container
➕ Create azurerm_storage_container.sql_backups_container
➕ Create azurerm_storage_management_policy.sql_backup_lifecycle
➕ Create azurerm_storage_table.live_players
➕ Create azurerm_storage_table.live_status
➕ Create random_id.environment_id

This branch was successfully deployed

1 active deployment
Development — 032fea9e Deployed Oct 3, 2026 by frasermolyneux via terraform-plan-dev #669
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants