Skip to content

FCT2-20857: Sanitise JSON deserialisation error response - #194

Merged
HasanCPS merged 1 commit into
mainfrom
fix/FCT2-20857-sanitise-json-error-response
Aug 3, 2026
Merged

FCT2-20857: Sanitise JSON deserialisation error response#194
HasanCPS merged 1 commit into
mainfrom
fix/FCT2-20857-sanitise-json-error-response

Conversation

@HasanCPS

@HasanCPS HasanCPS commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

FCT2-20857: Sanitise JSON deserialisation error response

What

Removes leaked System.Text.Json exception internals from the 400 Bad Request
response body on POST /v1/cases.

Why

Identified in the ITHC penetration test. The API was returning
raw framework diagnostics (.NET type names, Path, LineNumber,
BytePositionInLine) to the client. While no direct compromise was possible,
this aids information gathering for a targeted attack by confirming the backend
stack and internal field types.

Scope

GetJsonBody is only called in RegisterCase.cs, so POST /v1/cases is the
only endpoint currently affected. The fix lives in RequestValidator.cs so any
future endpoint using the same helper is automatically covered.

Links

Replace leaked System.Text.Json exception message with a generic
client-facing error. Log the full exception server-side via ILogger
to preserve observability without exposing .NET internals.

Adds unit tests asserting no framework internals appear in the
400 response body.
@sonarqubecloud

Copy link
Copy Markdown

@HasanCPS
HasanCPS requested a review from bridgesr July 31, 2026 15:40
@HasanCPS
HasanCPS merged commit cd46c11 into main Aug 3, 2026
11 checks passed
@HasanCPS
HasanCPS deleted the fix/FCT2-20857-sanitise-json-error-response branch August 3, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants