Formats code comments as sentences in the tests.

Capitalizes the first word and adds the terminal period in the unit, integration and security tests. The AAA markers stay bare, the TODO bodies stay lowercase, and no assertion, payload, expected status code or test signature changes.
This commit is contained in:
BinaryAlley committed 2026-11-16 18:17:29 +02:00
1 parent 727aa33318
commit 057f557791
540 files changed
+3888 -3888

No files matched your search

@@ -85,10 +85,10 @@ public class DeleteThemeEndpointTests : IClassFixture<LuminaApiFactory>, IDispos
}
[Theory]
[InlineData("..%2F..%2Fevil")] // encoded slash traversal
[InlineData("%2e%2e%2f%2e%2e%2fevil")] // encoded dot-slash traversal
[InlineData("..%5Cevil")] // encoded backslash traversal
[InlineData("..%2F")] // encoded trailing slash traversal
[InlineData("..%2F..%2Fevil")] // Encoded slash traversal.
[InlineData("%2e%2e%2f%2e%2e%2fevil")] // Encoded dot-slash traversal.
[InlineData("..%5Cevil")] // Encoded backslash traversal.
[InlineData("..%2F")] // Encoded trailing slash traversal.
public async Task DeleteTheme_WithPathTraversalInThemeId_ShouldReturnCleanNotFoundProblemDetails(string maliciousThemeId)
{
// Arrange
@@ -107,8 +107,8 @@ public class DeleteThemeEndpointTests : IClassFixture<LuminaApiFactory>, IDispos
Assert.DoesNotContain("stack trace", content, StringComparison.OrdinalIgnoreCase);
Assert.DoesNotContain(AppContext.BaseDirectory, content, StringComparison.OrdinalIgnoreCase);
// note: some payloads are normalized away by the server before routing, producing an empty-body 404;
// when the value reaches the handler, the failure must still be the generic theme-not-found problem
// Note: some payloads are normalized away by the server before routing, producing an empty-body 404;
// when the value reaches the handler, the failure must still be the generic theme-not-found problem.
if (!string.IsNullOrWhiteSpace(content))
{
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
@@ -132,7 +132,7 @@ public class InstallThemeEndpointTests : IClassFixture<LuminaApiFactory>, IDispo
await _apiFactory.CreateAndAuthenticateAdminUserAsync(client);
// Act
// a multipart upload carrying a 0 byte archive reaches the theme service, which must reject it without crashing
// A multipart upload carrying a 0 byte archive reaches the theme service, which must reject it without crashing.
using MultipartFormDataContent form = CreateMultipartForm([], "pack.zip", "application/zip");
HttpResponseMessage response = await client.PostAsync("/api/v1/themes", form);
string content = await response.Content.ReadAsStringAsync();
@@ -187,7 +187,7 @@ public class InstallThemeEndpointTests : IClassFixture<LuminaApiFactory>, IDispo
{
["theme.json"] = VALID_MANIFEST_JSON,
["templates/default.html"] = "<html><body>default</body></html>",
[@"..\evil.txt"] = "evil" // path traversal entry inside the archive
[@"..\evil.txt"] = "evil" // Path traversal entry inside the archive.
});
// Act
@@ -118,10 +118,10 @@ public class RestoreThemeEndpointTests : IClassFixture<LuminaApiFactory>, IDispo
}
[Theory]
[InlineData("..%2F..%2Fevil")] // encoded slash traversal
[InlineData("%2e%2e%2f%2e%2e%2fevil")] // encoded dot-slash traversal
[InlineData("..%5Cevil")] // encoded backslash traversal
[InlineData("..%2F")] // encoded trailing slash traversal
[InlineData("..%2F..%2Fevil")] // Encoded slash traversal.
[InlineData("%2e%2e%2f%2e%2e%2fevil")] // Encoded dot-slash traversal.
[InlineData("..%5Cevil")] // Encoded backslash traversal.
[InlineData("..%2F")] // Encoded trailing slash traversal.
public async Task RestoreTheme_WithPathTraversalInThemeId_ShouldReturnCleanNotFoundProblemDetails(string maliciousThemeId)
{
// Arrange
@@ -140,8 +140,8 @@ public class RestoreThemeEndpointTests : IClassFixture<LuminaApiFactory>, IDispo
Assert.DoesNotContain("stack trace", content, StringComparison.OrdinalIgnoreCase);
Assert.DoesNotContain(AppContext.BaseDirectory, content, StringComparison.OrdinalIgnoreCase);
// note: some payloads are normalized away by the server before routing, producing an empty-body 404;
// when the value reaches the handler, the failure must still be the generic theme-not-found problem
// Note: some payloads are normalized away by the server before routing, producing an empty-body 404;
// when the value reaches the handler, the failure must still be the generic theme-not-found problem.
if (!string.IsNullOrWhiteSpace(content))
{
Dictionary<string, JsonElement>? problemDetails = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(content, _jsonOptions);
@@ -87,11 +87,11 @@ public class SetCurrentThemeEndpointTests : IClassFixture<LuminaApiFactory>, IDi
}
[Theory]
[InlineData("../evil")] // dot-dot path traversal
[InlineData("..\\..\\evil")] // backslash path traversal
[InlineData("/etc/passwd")] // absolute path traversal
[InlineData("C:\\windows\\system32")] // absolute windows path traversal
[InlineData("' OR '1'='1")] // SQL injection attempt
[InlineData("../evil")] // Dot-dot path traversal.
[InlineData("..\\..\\evil")] // Backslash path traversal.
[InlineData("/etc/passwd")] // Absolute path traversal.
[InlineData("C:\\windows\\system32")] // Absolute windows path traversal.
[InlineData("' OR '1'='1")] // SQL injection attempt.
public async Task SetCurrentTheme_WithPathTraversalInThemeId_ShouldReturnCleanNotFoundProblemDetails(string maliciousThemeId)
{
// Arrange
@@ -59,10 +59,10 @@ public class GetThemeArchiveEndpointTests : IClassFixture<LuminaApiFactory>, IDi
}
[Theory]
[InlineData("..%2F..%2Fevil")] // encoded slash traversal
[InlineData("%2e%2e%2f%2e%2e%2fevil")] // encoded dot-slash traversal
[InlineData("..%5Cevil")] // encoded backslash traversal
[InlineData("..%2F")] // encoded trailing slash traversal
[InlineData("..%2F..%2Fevil")] // Encoded slash traversal.
[InlineData("%2e%2e%2f%2e%2e%2fevil")] // Encoded dot-slash traversal.
[InlineData("..%5Cevil")] // Encoded backslash traversal.
[InlineData("..%2F")] // Encoded trailing slash traversal.
public async Task GetThemeArchive_WithPathTraversalInThemeId_ShouldReturnCleanNotFoundProblemDetails(string maliciousThemeId)
{
// Arrange
@@ -74,12 +74,12 @@ public class GetThemeAssetEndpointTests : IClassFixture<LuminaApiFactory>, IDisp
}
[Theory]
[InlineData("..%2F..%2Fevil.txt")] // encoded slash path traversal
[InlineData("%2e%2e%2f%2e%2e%2fevil.txt")] // encoded dot-slash path traversal
[InlineData("..%5C..%5Cevil.txt")] // encoded backslash path traversal
[InlineData("assets%2F..%2F..%2Fevil.txt")] // traversal hiding behind the assets prefix
[InlineData("C:%5Cwindows%5Csystem32%5Cdrivers%5Cetc%5Chosts")] // absolute windows path
[InlineData("..%2F..%2F..%2F..%2Fdecoy-secret.txt")] // deep traversal targeting a decoy file outside the pack
[InlineData("..%2F..%2Fevil.txt")] // Encoded slash path traversal.
[InlineData("%2e%2e%2f%2e%2e%2fevil.txt")] // Encoded dot-slash path traversal.
[InlineData("..%5C..%5Cevil.txt")] // Encoded backslash path traversal.
[InlineData("assets%2F..%2F..%2Fevil.txt")] // Traversal hiding behind the assets prefix.
[InlineData("C:%5Cwindows%5Csystem32%5Cdrivers%5Cetc%5Chosts")] // Absolute windows path.
[InlineData("..%2F..%2F..%2F..%2Fdecoy-secret.txt")] // Deep traversal targeting a decoy file outside the pack.
public async Task GetThemeAsset_WithEncodedPathTraversalInAssetPath_ShouldReturnPackageInvalid(string maliciousAssetPath)
{
// Arrange
@@ -123,10 +123,10 @@ public class GetThemeAssetEndpointTests : IClassFixture<LuminaApiFactory>, IDisp
}
[Theory]
[InlineData("..%2F..%2Fevil")] // encoded slash traversal
[InlineData("%2e%2e%2f%2e%2e%2fevil")] // encoded dot-slash traversal
[InlineData("..%5Cevil")] // encoded backslash traversal
[InlineData("..%2F")] // encoded trailing slash traversal
[InlineData("..%2F..%2Fevil")] // Encoded slash traversal.
[InlineData("%2e%2e%2f%2e%2e%2fevil")] // Encoded dot-slash traversal.
[InlineData("..%5Cevil")] // Encoded backslash traversal.
[InlineData("..%2F")] // Encoded trailing slash traversal.
public async Task GetThemeAsset_WithPathTraversalInThemeId_ShouldReturnCleanNotFoundProblemDetails(string maliciousThemeId)
{
// Arrange
@@ -70,10 +70,10 @@ public class GetThemeTemplateEndpointTests : IClassFixture<LuminaApiFactory>, ID
}
[Theory]
[InlineData("..%2F..%2Fevil.html")] // encoded slash path traversal
[InlineData("%2e%2e%2f%2e%2e%2fevil.html")] // encoded dot-slash path traversal
[InlineData("..%5C..%5Cevil.html")] // encoded backslash path traversal
[InlineData("..%2F..%2F..%2F..%2Fdecoy-secret.txt")] // deep traversal targeting a decoy file outside the pack
[InlineData("..%2F..%2Fevil.html")] // Encoded slash path traversal.
[InlineData("%2e%2e%2f%2e%2e%2fevil.html")] // Encoded dot-slash path traversal.
[InlineData("..%5C..%5Cevil.html")] // Encoded backslash path traversal.
[InlineData("..%2F..%2F..%2F..%2Fdecoy-secret.txt")] // Deep traversal targeting a decoy file outside the pack.
public async Task GetThemeTemplate_WithEncodedPathTraversalInPageKey_ShouldOnlyServeInPackTemplates(string maliciousPageKey)
{
// Arrange
@@ -120,10 +120,10 @@ public class GetThemeTemplateEndpointTests : IClassFixture<LuminaApiFactory>, ID
}
[Theory]
[InlineData("..%2F..%2Fevil")] // encoded slash traversal
[InlineData("%2e%2e%2f%2e%2e%2fevil")] // encoded dot-slash traversal
[InlineData("..%5Cevil")] // encoded backslash traversal
[InlineData("..%2F")] // encoded trailing slash traversal
[InlineData("..%2F..%2Fevil")] // Encoded slash traversal.
[InlineData("%2e%2e%2f%2e%2e%2fevil")] // Encoded dot-slash traversal.
[InlineData("..%5Cevil")] // Encoded backslash traversal.
[InlineData("..%2F")] // Encoded trailing slash traversal.
public async Task GetThemeTemplate_WithPathTraversalInThemeId_ShouldReturnCleanNotFoundProblemDetails(string maliciousThemeId)
{
// Arrange