diff --git a/src/SafeWebCore/Infrastructure/NetSecureHeadersOptionsValidator.cs b/src/SafeWebCore/Infrastructure/NetSecureHeadersOptionsValidator.cs index 7342f6d..32d24d1 100644 --- a/src/SafeWebCore/Infrastructure/NetSecureHeadersOptionsValidator.cs +++ b/src/SafeWebCore/Infrastructure/NetSecureHeadersOptionsValidator.cs @@ -112,7 +112,9 @@ private static void ValidateReportingEndpoints(NetSecureHeadersOptions options, { failures.Add($"{scope}: Reporting endpoint '{endpoint.Group}' URL must not be null, empty, or whitespace. Fix: provide an absolute HTTPS URL such as 'https://reports.example.com/csp'."); } - else if (!Uri.TryCreate(endpoint.Url, UriKind.Absolute, out _)) + else if (!Uri.TryCreate(endpoint.Url, UriKind.Absolute, out var parsedUrl) || + parsedUrl is null || + (parsedUrl.Scheme != Uri.UriSchemeHttps && parsedUrl.Scheme != Uri.UriSchemeHttp)) { failures.Add($"{scope}: Reporting endpoint '{endpoint.Group}' URL must be absolute. Fix: use a full URL such as 'https://reports.example.com/csp'."); }