Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: password resets not working

Daniel Hougaard986fe2fe2336
diff --git a/backend/src/server/routes/v1/user-router.ts b/backend/src/server/routes/v1/user-router.ts
index b519b8ac31..7ef2e0d33f 100644
--- a/backend/src/server/routes/v1/user-router.ts
+++ b/backend/src/server/routes/v1/user-router.ts
@@ -19,7 +19,9 @@ export const registerUserRouter = async (server: FastifyZodProvider) => {
schema: {
response: {
200: z.object({
- user: UsersSchema
+ user: UsersSchema.extend({
+ encryptionVersion: z.number()
+ })
})
}
},
diff --git a/backend/src/server/routes/v2/password-router.ts b/backend/src/server/routes/v2/password-router.ts
index 63b6d8aac6..0f0747c3fe 100644
--- a/backend/src/server/routes/v2/password-router.ts
+++ b/backend/src/server/routes/v2/password-router.ts
@@ -1,5 +1,6 @@
import { z } from "zod";
+import { getConfig } from "@app/lib/config/env";
import { authRateLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { validatePasswordResetAuthorization } from "@app/services/auth/auth-fns";
@@ -41,13 +42,38 @@ export const registerPasswordRouter = async (server: FastifyZodProvider) => {
rateLimit: authRateLimit
},
onRequest: verifyAuth([AuthMode.JWT], { requireOrg: false }),
- handler: async (req) => {
+ handler: async (req, res) => {
+ const appCfg = getConfig();
+
await server.services.password.resetPasswordV2({
type: ResetPasswordV2Type.LoggedInReset,
userId: req.permission.id,
newPassword: req.body.newPassword,
oldPassword: req.body.oldPassword
});
+
+ void res.cookie("jid", "", {
+ httpOnly: true,
+ path: "/",
+ sameSite: "strict",
+ secure: appCfg.HTTPS_ENABLED
+ });
+
+ void res.cookie("infisical-project-assume-privileges", "", {
+ httpOnly: true,
+ path: "/",
+ sameSite: "strict",
+ secure: appCfg.HTTPS_ENABLED,
+ maxAge: 0
+ });
+
+ void res.cookie("aod", "", {
+ httpOnly: false,
+ path: "/",
+ sameSite: "lax",
+ secure: appCfg.HTTPS_ENABLED,
+ maxAge: 0
+ });
}
});
};