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

@@ -28,13 +28,13 @@ public class CoverArtArchiveHttpClientSecurityTests
private readonly CoverArtArchiveSettingsDtoFixture _coverArtArchiveSettingsDtoFixture = new();
[Theory]
[InlineData("https://evil.example/index.json")] // an unrelated public host
[InlineData("https://localhost/index.json")] // the loopback host name
[InlineData("https://127.0.0.1/index.json")] // the IPv4 loopback address
[InlineData("https://169.254.169.254/latest/meta-data/")] // the link local cloud metadata endpoint
[InlineData("https://10.0.0.5/index.json")] // a private class A address
[InlineData("https://192.168.1.10/index.json")] // a private class C address
[InlineData("https://coverartarchive.org.evil.example/index.json")] // the trusted host used as a prefix of an attacker controlled host
[InlineData("https://evil.example/index.json")] // An unrelated public host.
[InlineData("https://localhost/index.json")] // The loopback host name.
[InlineData("https://127.0.0.1/index.json")] // The IPv4 loopback address.
[InlineData("https://169.254.169.254/latest/meta-data/")] // The link local cloud metadata endpoint.
[InlineData("https://10.0.0.5/index.json")] // A private class A address.
[InlineData("https://192.168.1.10/index.json")] // A private class C address.
[InlineData("https://coverartarchive.org.evil.example/index.json")] // The trusted host used as a prefix of an attacker controlled host.
public async Task GetReleaseArtworkAsync_WhenTheRedirectPointsAtADisallowedHost_ShouldThrowAndNotReachIt(string location)
{
// Arrange
@@ -59,8 +59,8 @@ public class CoverArtArchiveHttpClientSecurityTests
}
[Theory]
[InlineData("http://archive.org/index.json")] // a downgrade of the Internet Archive to plain HTTP
[InlineData("http://coverartarchive.org/index.json")] // a downgrade of the Cover Art Archive to plain HTTP
[InlineData("http://archive.org/index.json")] // A downgrade of the Internet Archive to plain HTTP.
[InlineData("http://coverartarchive.org/index.json")] // A downgrade of the Cover Art Archive to plain HTTP.
public async Task GetReleaseArtworkAsync_WhenTheRedirectDowngradesToPlainHttp_ShouldThrow(string location)
{
// Arrange
@@ -83,8 +83,8 @@ public class CoverArtArchiveHttpClientSecurityTests
}
[Theory]
[InlineData("user@example.com\r\nX-Injected: value")] // carriage return and line feed header injection
[InlineData("user@example.com\nX-Injected: value")] // line feed header injection
[InlineData("user@example.com\r\nX-Injected: value")] // Carriage return and line feed header injection.
[InlineData("user@example.com\nX-Injected: value")] // Line feed header injection.
public async Task GetReleaseArtworkAsync_WhenThePersistedContactEmailAttemptsHeaderInjection_ShouldNotInjectAnyHeader(string maliciousEmail)
{
// Arrange
@@ -19,18 +19,18 @@ public class CoverArtArchiveMapperSecurityTests
private readonly CoverArtArchiveImageResponseFixture _coverArtArchiveImageResponseFixture = new();
[Theory]
[InlineData("http://169.254.169.254/latest/meta-data/")] // the link local cloud metadata endpoint
[InlineData("http://localhost/admin")] // the loopback host name
[InlineData("http://127.0.0.1/admin")] // the IPv4 loopback address
[InlineData("http://[::1]/admin")] // the IPv6 loopback address
[InlineData("http://10.0.0.5/internal")] // a private class A address
[InlineData("http://172.16.0.1/internal")] // a private class B address
[InlineData("http://192.168.1.10/internal")] // a private class C address
[InlineData("http://0.0.0.0/internal")] // the unspecified address
[InlineData("http://[fc00::1]/internal")] // the IPv6 unique local range
[InlineData("https://evil.example/tracker.jpg")] // an unrelated public host
[InlineData("https://coverartarchive.org.evil.example/1.jpg")] // the trusted host used as a prefix of an attacker controlled host
[InlineData("https://archive.org.evil.example/1.jpg")] // the Internet Archive host used as a prefix of an attacker controlled host
[InlineData("http://169.254.169.254/latest/meta-data/")] // The link local cloud metadata endpoint.
[InlineData("http://localhost/admin")] // The loopback host name.
[InlineData("http://127.0.0.1/admin")] // The IPv4 loopback address.
[InlineData("http://[::1]/admin")] // The IPv6 loopback address.
[InlineData("http://10.0.0.5/internal")] // A private class A address.
[InlineData("http://172.16.0.1/internal")] // A private class B address.
[InlineData("http://192.168.1.10/internal")] // A private class C address.
[InlineData("http://0.0.0.0/internal")] // The unspecified address.
[InlineData("http://[fc00::1]/internal")] // The IPv6 unique local range.
[InlineData("https://evil.example/tracker.jpg")] // An unrelated public host.
[InlineData("https://coverartarchive.org.evil.example/1.jpg")] // The trusted host used as a prefix of an attacker controlled host.
[InlineData("https://archive.org.evil.example/1.jpg")] // The Internet Archive host used as a prefix of an attacker controlled host.
public void MapArtwork_WhenAnImageUrlPointsAtAnInternalOrUntrustedHost_ShouldDropIt(string maliciousUrl)
{
// Arrange
@@ -45,10 +45,10 @@ public class CoverArtArchiveMapperSecurityTests
}
[Theory]
[InlineData("file:///etc/passwd")] // a local file URI
[InlineData("ftp://coverartarchive.org/1.jpg")] // a non web scheme
[InlineData("javascript:alert(1)")] // a script scheme
[InlineData("data:image/png;base64,SGVsbG8=")] // an inline data URI
[InlineData("file:///etc/passwd")] // A local file URI.
[InlineData("ftp://coverartarchive.org/1.jpg")] // A non web scheme.
[InlineData("javascript:alert(1)")] // A script scheme.
[InlineData("data:image/png;base64,SGVsbG8=")] // An inline data URI.
public void MapArtwork_WhenAnImageUrlUsesAnUnsupportedScheme_ShouldDropIt(string maliciousUrl)
{
// Arrange
@@ -63,8 +63,8 @@ public class CoverArtArchiveMapperSecurityTests
}
[Theory]
[InlineData("https://coverartarchive.org/release/11111111-1111-1111-1111-111111111111/front.jpg")] // a trusted Cover Art Archive image
[InlineData("https://archive.org/download/mbid-11111111-1111-1111-1111-111111111111/front.jpg")] // a trusted Internet Archive image
[InlineData("https://coverartarchive.org/release/11111111-1111-1111-1111-111111111111/front.jpg")] // A trusted Cover Art Archive image.
[InlineData("https://archive.org/download/mbid-11111111-1111-1111-1111-111111111111/front.jpg")] // A trusted Internet Archive image.
public void MapArtwork_WhenAnImageUrlPointsAtATrustedHostOverHttps_ShouldKeepIt(string trustedUrl)
{
// Arrange