Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .server-changes/sso-form-content-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
area: webapp
type: fix
---

Return a clear client error when SSO form submissions use an unsupported content type
8 changes: 8 additions & 0 deletions apps/webapp/app/routes/auth.sso.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
) {
Comment thread
carderne marked this conversation as resolved.
return new Response(null, { status: 415 });
}

const form = await request.formData();
const rawEmail = form.get("email");
if (typeof rawEmail !== "string" || rawEmail.trim().length === 0) {
Expand Down