From b86c85431158a2b013485fa74366d7dbf974ef46 Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Sat, 29 Aug 2026 13:55:03 +0300 Subject: [PATCH] Makes the path root security test deterministic against randomized fixture paths --- .../Path/GetPathRoot/GetPathRootEndpointTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/GetPathRoot/GetPathRootEndpointTests.cs b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/GetPathRoot/GetPathRootEndpointTests.cs index 772f7cdc..d088e589 100644 --- a/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/GetPathRoot/GetPathRootEndpointTests.cs +++ b/tests/SecurityTests/Lumina.Presentation.Web.SecurityTests/Core/Endpoints/FileSystemManagement/Path/GetPathRoot/GetPathRootEndpointTests.cs @@ -52,7 +52,9 @@ public class GetPathRootEndpointTests : IClassFixture // Arrange _apiFactory.ApiClientStub.Reset(); string expectedEndpoint = $"path/get-path-root?path={Uri.EscapeDataString(maliciousPath)}"; - _apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, _pathSegmentDtoFixture.Create()); + // a deterministic path keeps the content assertions independent of randomized fixture data, which could + // otherwise contain one of the forbidden substrings by coincidence + _apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, _pathSegmentDtoFixture.Create(path: "/documents/reports/final-report.pdf")); AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory); HttpRequestMessage getRequest = new(HttpMethod.Get, $"/path/api-get-path-root?path={Uri.EscapeDataString(maliciousPath)}"); getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));