@bymax-one/nest-auth 1.5.13 → 1.5.15

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/CHANGELOG.md CHANGED
@@ -18,6 +18,54 @@ what moves, and that note is the compatibility contract until strict SemVer begi
18
18
 
19
19
  ## [Unreleased]
20
20
 
21
+ ## [1.5.15] - 2026-11-22
22
+
23
+ A patch release.
24
+
25
+ ### Fixed
26
+
27
+ - **A key planted on `Object.prototype` is not an option.** The options a host did not write were read by property from objects that inherit from `Object.prototype`, so a key planted there by a library with a prototype-pollution flaw (`sessions`, `invitations`, `emailChange`, `workspaces`, `apiKeys`, `mfa`, `blockedStatuses`, `environment`, `tokenDelivery`, `redisNamespace` and the rest) reached every option the host left unwritten: it switched a feature on, turned `emailVerification.required` off or emptied the blocked statuses. The options are read from the object itself or from the class it is an instance of, never from the runtime's root object, and the resolved options and their groups hold no prototype to fall through to.
28
+ - **A key planted on `Object.prototype` is not a field of a record a repository answers.** A field the record lacks was read from the root object of the runtime, so with a strict field removed from the row and its name planted, `mfaEnabled` false, `emailVerified` true, `status`, `role`, `tenantId` and `id` were accepted instead of refused as absent, and a planted `mfaSecret` or `mfaRecoveryCodes` appeared on the copy of a record that never held one. A field is read from the record itself or from the class it is an instance of, and the copy holds no prototype. The copies handed to host hooks hold no prototype either, so `toString` and `hasOwnProperty` are absent on them (use `Object.hasOwn` and `String(…)`). A record whose fields are served by an ancestor with no prototype of its own is not read from that ancestor, because it cannot be told from the root object of a realm; a strict field held only there is refused as absent.
29
+ - **A child in a role hierarchy is a role name.** A child of `roles.hierarchy` or `roles.platformHierarchy` that is not a string is refused naming its position and what it is (`must name roles as strings (received … at position N)`), and the value is no longer printed, so a `toString` the host wrote does not run and a symbol does not throw from the message.
30
+ - **The tenant of a record is not blank.** A `tenantId` that is empty or only whitespace is refused as `auth.internal`, with the other tenants that are no string. **Apply to a derived backend:** a host that stores an empty string as the tenant of its single-tenant rows must serve a real tenant id, because that record is now refused.
31
+ - **A lookalike of an error, a date, a regular expression, a view of bytes, a link or a locale is no id.** A Proxy of one, an object made from the prototype of one and an instance of a subclass are refused as an id, as the real ones already were.
32
+ - **A key planted on `Object.prototype` is not read by the libraries the options are handed to.** `@nestjs/jwt`, `jsonwebtoken` and `express` copy the options they are given into a new object and read names the library never set, so a key planted on the root object was read as one. A planted `secretOrPrivateKey` made a token forged under any secret verify; a planted `clockTolerance`, `clockTimestamp` or `verifyOptions` made an expired token verify; `noTimestamp`, `header` and `keyid` changed what the backend signed; a planted `cost`, `blockSize` or `parallelization` made every login and password change throw; a planted `domain` scoped the auth cookies. Every call now carries an own key with a neutral value for each option the dependency reads and the library does not choose, and the module options of `@nestjs/jwt` shadow the options that pick another key. The names that have no neutral value (`keyid`, `notBefore`, `jwtid`, `subject`, `issuer`, `audience`) refuse the signature with `auth.internal` while the process carries one of them on `Object.prototype`. A test reads the sources of the pinned dependencies and fails when one reads an option name the library neither sets nor shadows. Beside the own keys, the library refuses while `Object.prototype` holds an entry that is not the runtime's own: it does not start, and it refuses every signature, verification, password hash and verification and cookie write with `auth.internal`. The standard entries are listed by name and compared, by value, accessors and enumerability, with what they were at load, so an overwritten `hasOwnProperty`, `toString` or `constructor` counts like a new key, and the error reports a count and no name. A runtime started with `--disable-proto=delete`, which has no `__proto__`, has a standard root. One limit remains: `express` removes `maxAge` from its copy in `clearCookie`, so a planted `maxAge` lengthens the life of the empty cookie that ends a session.
33
+
34
+ ## [1.5.14] - 2026-11-22
35
+
36
+ A patch release.
37
+
38
+ ### Fixed
39
+
40
+ - **The lists a host keeps in its options are read once and what is checked is what is kept.** The permissions of the
41
+ workspaces (`manageWorkspace`, `deleteWorkspace`, `manageMembers`, `viewMembers`) were validated through their own
42
+ entries and then read again by property and kept as the host's arrays: a typed configuration class that served them on
43
+ its prototype was never validated, and a change by the host after start reached the authorization table. They are read
44
+ by property like the other groups and kept as copies, and so are `jwt.previousSecrets`,
45
+ `mfa.previousEncryptionKeys` and `apiKeys.scopes`, whose strength and format checks ran once at start.
46
+ `jwt`, `mfa`, `apiKeys` and `workspaces.permissions` must be objects: a function, an array or a primitive given for
47
+ one is refused with `[BymaxAuthModule] <option> must be an object (received …)`.
48
+ - **The id of a row is required.** The ids of a user, a platform user, an API key, a workspace and of a membership (its
49
+ workspace and its user) were accepted when absent or `null`, so a row without an id logged in with a token whose
50
+ subject was nothing. Each is refused as `auth.internal` when it is absent, `undefined` or `null`; an id that
51
+ is optional by design, such as the user that invited a member, is still accepted when absent.
52
+ - **A resend of the verification code gives the cooldown back when the code cannot be stored.** The write of the code
53
+ to the store was the one failure on the path that the response had not left yet and that kept the cooldown. A request
54
+ that finds no account, or an account that is already verified, still keeps it, so the throttle never tells the two
55
+ apart. A mail provider that fails after the response left does not release it: a delete by key from there could remove
56
+ the cooldown of a later request, so the user retries after the minute.
57
+ - **The hierarchy of the platform is judged as the others are.** When the platform is enabled, `roles.platformHierarchy`
58
+ must be an object that names at least one role, whose children are lists of roles it declares (a string, a number, a
59
+ child that is no list or a child nobody declares ends the boot with the option and the role named).
60
+ - **An id is never blank, the text of a missing value, an error or a buffer.** A string or a printed text that is empty
61
+ or only whitespace, `undefined` or `null`, and an `Error`, a `Buffer` or any other view of bytes, are refused as an id
62
+ with `auth.internal`.
63
+ - **The ids of the rows the workspace access reads are compared with the ones asked about.** The id of the workspace, the
64
+ workspace of the membership and the user of the membership are compared exactly, as the tenant already was; a
65
+ repository that answers another row is denied access and nothing is cached. **Apply to a derived backend:** the ids
66
+ are compared as the exact strings the library keeps, so a store that normalises an id when it reads it (a column that
67
+ lowercases a uuid) has to be asked for the id in the form it returns, or it answers a row that is denied.
68
+
21
69
  ## [1.5.13] - 2026-11-21
22
70
 
23
71
  A patch release.
@@ -5560,7 +5608,9 @@ ever installable.
5560
5608
  - Phase 4 password-reset tests cover: both `token` and `otp` flows, mutual exclusivity validation, `verifiedToken` exchange, resend cooldown, anti-enumeration (no error on unknown email), and session invalidation on reset
5561
5609
  - Phase 5 tests cover: platform login with MFA path and brute-force lockout, `JwtPlatformGuard` cross-context rejection, `PlatformRolesGuard` hierarchy enforcement, OAuth CSRF state lifecycle, `onOAuthLogin` hook resolution strategies, and invitation role-authorization + acceptance single-use enforcement
5562
5610
 
5563
- [Unreleased]: https://github.com/bymaxone/nest-auth/compare/v1.5.13...HEAD
5611
+ [Unreleased]: https://github.com/bymaxone/nest-auth/compare/v1.5.15...HEAD
5612
+ [1.5.15]: https://github.com/bymaxone/nest-auth/compare/v1.5.14...v1.5.15
5613
+ [1.5.14]: https://github.com/bymaxone/nest-auth/compare/v1.5.13...v1.5.14
5564
5614
  [1.5.13]: https://github.com/bymaxone/nest-auth/compare/v1.5.12...v1.5.13
5565
5615
  [1.5.12]: https://github.com/bymaxone/nest-auth/compare/v1.5.11...v1.5.12
5566
5616
  [1.5.11]: https://github.com/bymaxone/nest-auth/compare/v1.5.10...v1.5.11