Skip to content

Commit

Permalink
feat: add DANGEROUSLY_DISABLE_PBKDF2_ITERATION option for demo
Browse files Browse the repository at this point in the history
  • Loading branch information
joshunrau committed Jul 19, 2024
1 parent 5a06310 commit 447f988
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ VERBOSE=false
NODE_OPTIONS="--max-old-space-size=8192"
# Enable rate limitting
THROTTLER_ENABLED=true
# Disable iteration for password hashing (not recommended for production)
# See https://pages.nist.gov/800-63-3/sp800-63b.html
# DANGEROUSLY_DISABLE_PBKDF2_ITERATION=

## ---------------------------------
## DEVELOPMENT
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ import { UsersModule } from './users/users.module';
inject: [ConfigurationService],
isGlobal: true,
useFactory: (configurationService: ConfigurationService) => ({
pbkdf2Params: {
iterations: configurationService.get('DANGEROUSLY_DISABLE_PBKDF2_ITERATION') ? 1 : 100_000
},
secretKey: configurationService.get('SECRET_KEY')
})
}),
Expand Down
1 change: 1 addition & 0 deletions apps/api/src/configuration/configuration.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const $Configuration = z
.object({
API_DEV_SERVER_PORT: z.coerce.number().positive().int().optional(),
API_PROD_SERVER_PORT: z.coerce.number().positive().int().default(80),
DANGEROUSLY_DISABLE_PBKDF2_ITERATION: $BooleanString.default(false),
DEBUG: $BooleanString,
GATEWAY_API_KEY: z.string().min(32),
GATEWAY_DEV_SERVER_PORT: z.coerce.number().positive().int().optional(),
Expand Down

0 comments on commit 447f988

Please sign in to comment.