From 8175f6f61eb77cb7089acb2dc846f0b16091ad1c Mon Sep 17 00:00:00 2001 From: Heimdall Date: Sat, 14 Nov 2026 09:56:49 +0000 Subject: [PATCH] Auth and member clients follow no redirect: one WithoutRedirects for all three The mover's inline no-redirect handler becomes the shared extension; the app-secret auth client and the member-bearer client use it too. Co-Authored-By: Claude Sonnet 5.5 --- .../Features/Heimdall/HeimdallIdentityMoveClient.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Bifrost.Web/Features/Heimdall/HeimdallIdentityMoveClient.cs b/src/Bifrost.Web/Features/Heimdall/HeimdallIdentityMoveClient.cs index 69f0255..a92e916 100644 --- a/src/Bifrost.Web/Features/Heimdall/HeimdallIdentityMoveClient.cs +++ b/src/Bifrost.Web/Features/Heimdall/HeimdallIdentityMoveClient.cs @@ -323,13 +323,19 @@ public static class HeimdallClientServices { services.AddHttpClient((serviceProvider, client) => HeimdallAuthService.ConfigureClient(client, serviceProvider.GetRequiredService>().Value)) + .WithoutRedirects() .RedactLoggedHeaders(HeimdallAuthService.RedactsHeader); services.AddHttpClient((serviceProvider, client) => HeimdallMemberClient.ConfigureClient(client, serviceProvider.GetRequiredService>().Value)) + .WithoutRedirects() .RedactLoggedHeaders(HeimdallAuthService.RedactsHeader); services.AddHeimdallIdentityMoveClient(); } + /// A 3xx from Heimdall is its answer: following it would carry the app secret or a member's bearer to another origin. + public static IHttpClientBuilder WithoutRedirects(this IHttpClientBuilder builder) => + builder.ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler { AllowAutoRedirect = false, PooledConnectionLifetime = TimeSpan.FromMinutes(2) }); + /// /// The mover's HttpClient: Heimdall's base address and app secret from HeimdallAuthService.ConfigureClient (the one secret path), the /// call deadline, no redirects (a 3xx must never carry the secret or the proofs to another origin), and the shared header redaction. @@ -340,6 +346,6 @@ public static class HeimdallClientServices HeimdallAuthService.ConfigureClient(client, serviceProvider.GetRequiredService>().Value); client.Timeout = HeimdallIdentityMoveClient.Timeout; }) - .ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler { AllowAutoRedirect = false, PooledConnectionLifetime = TimeSpan.FromMinutes(2) }) + .WithoutRedirects() .RedactLoggedHeaders(HeimdallAuthService.RedactsHeader); }