Skip to content

fix: harden DICOM and API error handling - #2

Merged
abla86 merged 3 commits into
mainfrom
fix/complete-hardening-2026-09-25
Sep 25, 2026
Merged

abla86 merged 3 commits into
mainfrom
fix/complete-hardening-2026-09-25

Conversation

@abla86

@abla86 abla86 commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Contain unexpected DICOM processing failures, make audit persistence non-fatal to API requests, and reject invalid device ids.

Copilot AI lite review requested due to automatic review settings September 25, 2026 20:32
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@abla86
abla86 merged commit 5cd7392 into main Sep 25, 2026
4 of 5 checks passed
@abla86
abla86 deleted the fix/complete-hardening-2026-09-25 branch September 25, 2026 20:33

Copilot AI left a comment

Copy link
Copy Markdown

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

Unresolved moderate issues affect error handling, validation consistency, and diagnostics.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

Hardens DICOM and API error handling, makes audit persistence mostly non-fatal, and adds device ID validation.

Changes:

  • Validates positive IDs for GET device requests.
  • Converts unexpected DICOM failures to generic 500 responses.
  • Makes most audit persistence failures non-fatal.
File Summary Findings
Program.cs Updates device validation, DICOM error handling, and audit persistence. Moderate (4): Route streamed-size audit writes through TryAuditAsync.
Moderate (3): Validate IDs consistently for PUT and DELETE.
Moderate (1): Log audit persistence failures.
Moderate (1): Log unexpected DICOM exceptions before returning 500.
Nit (1): Add boundary integration tests for zero and negative IDs.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Program.cs
Comment on lines +132 to +135
if (id <= 0)
{
return Results.BadRequest(new { message = "Device ID must be greater than zero." });
}
Comment thread Program.cs
if (request.ContentLength is > MaxDicomUploadBytes)
{
await repository.AddAuditEventAsync("dicom.inspect", "payload-too-large", cancellationToken);
await TryAuditAsync(repository, "dicom.inspect", "payload-too-large", cancellationToken);
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