FCT2-20857: Sanitise JSON deserialisation error response - #194
Merged
Conversation
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.
|
bridgesr
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



FCT2-20857: Sanitise JSON deserialisation error response
What
Removes leaked
System.Text.Jsonexception internals from the400 Bad Requestresponse 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
GetJsonBodyis only called inRegisterCase.cs, soPOST /v1/casesis theonly endpoint currently affected. The fix lives in
RequestValidator.csso anyfuture endpoint using the same helper is automatically covered.
Links