mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-26 15:01:14 +00:00
Sanitize 400 error messages in GlobalExceptionHandler and validation filters to use static strings. This change improves consistency and prevents leaking internal exception details. Updated tests to reflect new error messages for JSON parsing and bad request scenarios.
This commit is contained in:
@@ -171,6 +171,11 @@ public static class UavUploadValidationTests
|
||||
// Assert
|
||||
ProblemDetailsAssertions.AssertValidationProblem(problem, expectedStatus: 400, label: "AZ-810 malformed JSON");
|
||||
ProblemDetailsAssertions.AssertErrorsContainsMention(problem, expectedMention: "metadata", label: "AZ-810 malformed JSON");
|
||||
var metadataError = problem.GetProperty("errors").GetProperty("metadata")[0].GetString();
|
||||
if (metadataError is not null && metadataError.Contains("System.", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException("Malformed metadata response must not leak System.* type names.");
|
||||
}
|
||||
|
||||
Console.WriteLine(" ✓ Malformed metadata JSON rejected with errors[\"metadata\"]");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user