Hardens outbound host validation against SSRF

- resolves host names and validates every address, with a connect callback that pins the checked address

- applies the guard to every outbound HTTP client, with distinct rejection and resolution failures and warning logs

- scopes the MusicBrainz private base URL permission to the configured host and blocks link local and cloud metadata endpoints

- keeps provider redirects bounded and strips credentials and hop-by-hop headers on cross-origin redirects

- adds unit, security, and end-to-end coverage, and updates the manual
This commit is contained in:
BinaryAlley committed 2026-11-18 10:51:41 +02:00
1 parent ecdb39cc6a
commit 24af00579c
28 files changed
+2977 -162

No files matched your search

@@ -0,0 +1,47 @@
namespace Lumina.Domain.SharedKernel.Common.Enums.Networking;
/// <summary>
/// Enumeration for the reasons an outbound request was rejected by the host address policy.
/// </summary>
public enum OutboundRequestRejectionReason
{
/// <summary>
/// The request was not rejected.
/// </summary>
None,
/// <summary>
/// The host name could not be resolved.
/// </summary>
HostCouldNotBeResolved,
/// <summary>
/// The host resolved to an address that is not public and was not explicitly allowed.
/// </summary>
AddressNotAllowed,
/// <summary>
/// The host resolved to a link local or cloud metadata address, which is never allowed.
/// </summary>
LinkLocalOrMetadataAddress,
/// <summary>
/// The redirect target is not an HTTPS URL.
/// </summary>
RedirectSchemeNotHttps,
/// <summary>
/// The redirect target could not be resolved from the location of the response.
/// </summary>
RedirectTargetInvalid,
/// <summary>
/// The request was redirected too many times.
/// </summary>
TooManyRedirects,
/// <summary>
/// The outbound request has no absolute URI, so its host cannot be validated.
/// </summary>
RequestHasNoAbsoluteUri
}