📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Revert verify guardrails
Blue Mousedc2d6f331d4c
diff --git a/backend/apps/cloud/src/twoFactorAuth/twoFactorAuth.service.ts b/backend/apps/cloud/src/twoFactorAuth/twoFactorAuth.service.tsindex b2b0bed49..98a4d1c05 100644--- a/backend/apps/cloud/src/twoFactorAuth/twoFactorAuth.service.ts+++ b/backend/apps/cloud/src/twoFactorAuth/twoFactorAuth.service.ts@@ -1,15 +1,10 @@import { Injectable } from '@nestjs/common'-import { generateSecret, generateURI, verify, createGuardrails } from 'otplib'+import { generateSecret, generateURI, verify } from 'otplib'import { UserService } from '../user/user.service'import { User } from '../user/entities/user.entity'import { TWO_FACTOR_AUTHENTICATION_APP_NAME } from '../common/constants'-// otplib v13 defaults to MIN_SECRET_BYTES=16, but secrets created under v12-// are 10 bytes (16 Base32 chars). Relax the guardrail so existing users can-// still verify.-const verifyGuardrails = createGuardrails({ MIN_SECRET_BYTES: 10 })-@Injectable()export class TwoFactorAuthService {constructor(private userService: UserService) {}@@ -44,7 +39,6 @@ export class TwoFactorAuthService {token: twoFactorAuthenticationCode,secret: user.twoFactorAuthenticationSecret,epochTolerance: 30,- guardrails: verifyGuardrails,})return result.validdiff --git a/backend/apps/community/src/twoFactorAuth/twoFactorAuth.service.ts b/backend/apps/community/src/twoFactorAuth/twoFactorAuth.service.tsindex 7799a34ed..fda5400c2 100644--- a/backend/apps/community/src/twoFactorAuth/twoFactorAuth.service.ts+++ b/backend/apps/community/src/twoFactorAuth/twoFactorAuth.service.ts@@ -1,16 +1,11 @@import { Injectable } from '@nestjs/common'-import { generateSecret, generateURI, verify, createGuardrails } from 'otplib'+import { generateSecret, generateURI, verify } from 'otplib'import { genSalt, hash, compare } from 'bcrypt'import { UserService } from '../user/user.service'import { User } from '../common/types'import { TWO_FACTOR_AUTHENTICATION_APP_NAME } from '../common/constants'-// otplib v13 defaults to MIN_SECRET_BYTES=16, but secrets created under v12-// are 10 bytes (16 Base32 chars). Relax the guardrail so existing users can-// still verify.-const verifyGuardrails = createGuardrails({ MIN_SECRET_BYTES: 10 })-@Injectable()export class TwoFactorAuthService {constructor(private userService: UserService) {}@@ -57,7 +52,6 @@ export class TwoFactorAuthService {token: twoFactorAuthenticationCode,secret: user.twoFactorAuthenticationSecret,epochTolerance: 30,- guardrails: verifyGuardrails,})return result.valid