Secure password reset endpoints (#5167)

fix: prevent sensitive data exposure in password reset
This commit is contained in:
Ong Chung Yau
2025-09-04 18:14:11 +08:00
committed by GitHub
parent 2ab20f71d9
commit 9e178d6887
3 changed files with 15 additions and 3 deletions
@@ -1,3 +1,5 @@
import { User } from '../enterprise/database/entities/user.entity'
export function sanitizeNullBytes(obj: any): any {
const stack = [obj]
@@ -30,3 +32,11 @@ export function sanitizeNullBytes(obj: any): any {
return obj
}
export function sanitizeUser(user: Partial<User>) {
delete user.credential
delete user.tempToken
delete user.tokenExpiry
return user
}