Skip to content

Commit 8b64815

Browse files
vikyw89claude
andauthored
fix: add method="post" to auth forms to prevent credential leak in URL (#4683)
Auth forms (login, register, 2FA, backup-code, reset-password) had no method attribute, defaulting to GET. react-hook-form's handleSubmit preventDefault()s only after hydration; submitting in the pre-hydration or no-JS window triggers a native GET to the current URL, leaking email/password into the URL, history, access logs and Referer header. Setting method="post" makes the native fallback a POST so credentials go in the request body instead. Normal JS submit path is unchanged. Verified in a browser: GET (?email&password) -> POST (clean URL). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ed0abb2 commit 8b64815

4 files changed

Lines changed: 10 additions & 1 deletion

File tree

apps/dokploy/pages/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ export default function Home({ IS_CLOUD, enforceSSO }: Props) {
182182
{IS_CLOUD && <SignInWithGoogle />}
183183
<Form {...loginForm}>
184184
<form
185+
method="post"
185186
onSubmit={loginForm.handleSubmit(onSubmit)}
186187
className="space-y-4"
187188
id="login-form"
@@ -263,6 +264,7 @@ export default function Home({ IS_CLOUD, enforceSSO }: Props) {
263264
) : (
264265
<>
265266
<form
267+
method="post"
266268
onSubmit={onTwoFactorSubmit}
267269
className="space-y-4"
268270
id="two-factor-form"
@@ -326,7 +328,11 @@ export default function Home({ IS_CLOUD, enforceSSO }: Props) {
326328
</DialogDescription>
327329
</DialogHeader>
328330

329-
<form onSubmit={onBackupCodeSubmit} className="space-y-4">
331+
<form
332+
method="post"
333+
onSubmit={onBackupCodeSubmit}
334+
className="space-y-4"
335+
>
330336
<div className="flex flex-col gap-2">
331337
<Label>Backup Code</Label>
332338
<Input

apps/dokploy/pages/register.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ const Register = ({ isCloud }: Props) => {
172172
)}
173173
<Form {...form}>
174174
<form
175+
method="post"
175176
onSubmit={form.handleSubmit(onSubmit)}
176177
className="grid gap-4"
177178
>

apps/dokploy/pages/reset-password.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export default function Home({ tokenResetPassword }: Props) {
123123
)}
124124
<Form {...form}>
125125
<form
126+
method="post"
126127
onSubmit={form.handleSubmit(onSubmit)}
127128
className="grid gap-4"
128129
>

apps/dokploy/pages/send-reset-password.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export default function Home() {
110110
{!temp.is2FAEnabled ? (
111111
<Form {...form}>
112112
<form
113+
method="post"
113114
onSubmit={form.handleSubmit(onSubmit)}
114115
className="grid gap-4"
115116
>

0 commit comments

Comments
 (0)