Skip to content

Commit 9b29027

Browse files
committed
fix(webapp): return 415 for invalid SSO form content types
1 parent c601739 commit 9b29027

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: fix
4+
---
5+
6+
Return a clear client error when SSO form submissions use an unsupported content type

apps/webapp/app/routes/auth.sso.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ export async function action({ request }: ActionFunctionArgs) {
2323
return new Response(null, { status: 405 });
2424
}
2525

26+
const contentType = request.headers.get("content-type")?.toLowerCase() ?? "";
27+
if (
28+
!contentType.includes("application/x-www-form-urlencoded") &&
29+
!contentType.includes("multipart/form-data")
30+
) {
31+
return new Response(null, { status: 415 });
32+
}
33+
2634
const form = await request.formData();
2735
const rawEmail = form.get("email");
2836
if (typeof rawEmail !== "string" || rawEmail.trim().length === 0) {

0 commit comments

Comments
 (0)