Heimdall completion route: no antiforgery opt-out (the form is read by hand); pin a malformed form body

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-11 04:43:45 +02:00
commit ad06e2ffd5
2 changed files with 5 additions and 1 deletions

View file

@ -550,7 +550,7 @@ app.MapPost("/auth/heimdall/complete", async (
return Results.Redirect(HeimdallAuthService.ErrorRedirect);
}
}).AllowAnonymous().DisableAntiforgery();
}).AllowAnonymous();
app.MapPost("/auth/sign-out", async (HttpContext httpContext) =>
{

View file

@ -679,6 +679,10 @@ public sealed class HeimdallCompletionTests
"/auth/heimdall/complete",
new StringContent("{\"attempt\":\"x\"}", Encoding.UTF8, "application/json"));
results.Add(("json body", new CompletionResult(json, false), "Heimdall completion has no attempt for this browser."));
using var malformed = await client.PostAsync(
"/auth/heimdall/complete",
new StringContent("not a multipart body", Encoding.UTF8, "multipart/form-data"));
results.Add(("malformed form", new CompletionResult(malformed, false), "Heimdall completion has no attempt for this browser."));
foreach (var (name, result, reason) in results)
{