@fonderie/auth 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -2,8 +2,8 @@ export { IMfaChallenge, ISession, IUser } from './types.cjs';
2
2
  import { IFonderieModule, IReadinessProblem, IFonderieApp } from '@fonderie/core';
3
3
  import { IStoreAdapter } from '@fonderie/store';
4
4
  import { EventBus } from '@fonderie/events';
5
- import { I as IAuthConfig } from './session-DJNd1xp_.cjs';
6
- export { A as AUTH_CONFIG_KEYS, a as AuthLimitedRoute, b as AuthMessageKey, c as IAuthRateLimitConfig, d as IAuthRuntimeConfig, e as IAuthSecrets, f as IDataExportContributor, M as MESSAGE_KEYS, g as buildAuthAccountLimiter, h as buildAuthIpLimiter, w as withSession } from './session-DJNd1xp_.cjs';
5
+ import { I as IAuthConfig } from './session-jITwnc3m.cjs';
6
+ export { A as AUTH_CONFIG_KEYS, a as AuthLimitedRoute, b as AuthMessageKey, c as IAuthRateLimitConfig, d as IAuthRuntimeConfig, e as IAuthSecrets, f as IDataExportContributor, M as MESSAGE_KEYS, g as buildAuthAccountLimiter, h as buildAuthIpLimiter, w as withSession } from './session-jITwnc3m.cjs';
7
7
  export { IUserDTO, toUserDTO } from './dtos/user.cjs';
8
8
  export { requireAuth, validate } from '@fonderie/core/middlewares';
9
9
  import { z } from 'zod';
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ export { IMfaChallenge, ISession, IUser } from './types.js';
2
2
  import { IFonderieModule, IReadinessProblem, IFonderieApp } from '@fonderie/core';
3
3
  import { IStoreAdapter } from '@fonderie/store';
4
4
  import { EventBus } from '@fonderie/events';
5
- import { I as IAuthConfig } from './session-DJNd1xp_.js';
6
- export { A as AUTH_CONFIG_KEYS, a as AuthLimitedRoute, b as AuthMessageKey, c as IAuthRateLimitConfig, d as IAuthRuntimeConfig, e as IAuthSecrets, f as IDataExportContributor, M as MESSAGE_KEYS, g as buildAuthAccountLimiter, h as buildAuthIpLimiter, w as withSession } from './session-DJNd1xp_.js';
5
+ import { I as IAuthConfig } from './session-jITwnc3m.js';
6
+ export { A as AUTH_CONFIG_KEYS, a as AuthLimitedRoute, b as AuthMessageKey, c as IAuthRateLimitConfig, d as IAuthRuntimeConfig, e as IAuthSecrets, f as IDataExportContributor, M as MESSAGE_KEYS, g as buildAuthAccountLimiter, h as buildAuthIpLimiter, w as withSession } from './session-jITwnc3m.js';
7
7
  export { IUserDTO, toUserDTO } from './dtos/user.js';
8
8
  export { requireAuth, validate } from '@fonderie/core/middlewares';
9
9
  import { z } from 'zod';
package/dist/index.js CHANGED
@@ -86,6 +86,12 @@ var DEFAULTS = {
86
86
  account: { capacity: 3, refillPerSec: 3 / min(60) },
87
87
  accountField: "email"
88
88
  },
89
+ // reset: 10/15min per IP — the reset PIN is a 6-digit code looked up
90
+ // globally, so an unthrottled endpoint is brute-forceable into an account
91
+ // takeover. There's no email in the reset body to key an account bucket on,
92
+ // so this IP bucket is the guard. (Moving reset to a high-entropy opaque
93
+ // token is tracked as a follow-up hardening.)
94
+ reset: { ip: { capacity: 10, refillPerSec: 10 / min(15) } },
89
95
  // mfaVerify: 10/15min per IP — TOTP brute-force.
90
96
  mfaVerify: { ip: { capacity: 10, refillPerSec: 10 / min(15) } }
91
97
  };
@@ -2367,7 +2373,7 @@ function buildAuthRoutes(store, config, bus) {
2367
2373
  R("refresh", "POST", "/auth/refresh", validate(refreshSchema), auth.refresh),
2368
2374
  // Email — Password Recovery (Public)
2369
2375
  R("forgotPassword", "POST", "/auth/email/forgot", ipLimit("forgot"), validate(forgotPasswordSchema), acctLimit("forgot"), auth.forgotPassword),
2370
- R("resetPassword", "POST", "/auth/email/reset", validate(resetPasswordSchema), auth.resetPassword),
2376
+ R("resetPassword", "POST", "/auth/email/reset", ipLimit("reset"), validate(resetPasswordSchema), auth.resetPassword),
2371
2377
  // Verification (Protected — email or phone, determined by loginMethod)
2372
2378
  R("verifyEmail", "POST", "/auth/verify", requireAuth, validate(verifySchema), auth.verify),
2373
2379
  R("sendVerification", "GET", "/auth/send-verification", requireAuth, auth.sendVerification),