Skip to content

Commit

Permalink
Validate token payload before signing it (#1594)
Browse files Browse the repository at this point in the history
Adds validation of the payload passed to `AuthRepository['signToken']`, ensuring that it is a `AuthPayloadDto`.
  • Loading branch information
iamacook authored May 28, 2024
1 parent 2037dd4 commit 078d1d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/domain/auth/auth.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export class AuthRepository implements IAuthRepository {
notBefore?: number;
},
): string {
// TODO: Verify payload before signing it
return this.jwtService.sign(payload, options);
const authPayloadDto = AuthPayloadDtoSchema.parse(payload);
return this.jwtService.sign(authPayloadDto, options);
}

verifyToken(accessToken: string): AuthPayloadDto {
Expand Down

0 comments on commit 078d1d1

Please sign in to comment.