fix(webapp): return 415 for invalid SSO form content types (#4238)

## Summary

SSO form submissions with an unsupported content type now receive a 415
response instead of failing while parsing the request body.
This commit is contained in:
Chris Arderne
2026-07-13 11:01:08 +01:00
committed by GitHub
parent c601739d35
commit c0f7c803b1
2 changed files with 14 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
---
area: webapp
type: fix
---
Return a clear client error when SSO form submissions use an unsupported content type
+8
View File
@@ -23,6 +23,14 @@ export async function action({ request }: ActionFunctionArgs) {
return new Response(null, { status: 405 });
}
const contentType = request.headers.get("content-type")?.toLowerCase() ?? "";
if (
!contentType.includes("application/x-www-form-urlencoded") &&
!contentType.includes("multipart/form-data")
) {
return new Response(null, { status: 415 });
}
const form = await request.formData();
const rawEmail = form.get("email");
if (typeof rawEmail !== "string" || rawEmail.trim().length === 0) {