@bymax-one/nest-auth 1.5.11 → 1.5.12
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 +62 -1
- package/dist/server/index.cjs +579 -47
- package/dist/server/index.d.cts +3 -4
- package/dist/server/index.d.ts +3 -4
- package/dist/server/index.mjs +580 -48
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,66 @@ what moves, and that note is the compatibility contract until strict SemVer begi
|
|
|
18
18
|
|
|
19
19
|
## [Unreleased]
|
|
20
20
|
|
|
21
|
+
## [1.5.12] - 2026-11-21
|
|
22
|
+
|
|
23
|
+
A patch release.
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- **A host getter, Proxy or factory that throws no longer leaves the library as the host's own error.** The options a
|
|
28
|
+
host returns are read inside one boundary: a failure ends as `[BymaxAuthModule] the options could not be read…` with
|
|
29
|
+
the host's error as its `cause` and none of its text. Each repository the host provides is read through a guarded
|
|
30
|
+
view that the library's own services use: an answer is read for the fields its method promises and for nothing
|
|
31
|
+
else (a contract for each repository method, checked by the compiler), so an entity whose relation throws until it
|
|
32
|
+
is loaded still answers, a field the contract names that throws ends as `auth.internal` with the cause, and a failure
|
|
33
|
+
of the repository itself is the same error. A typed `HttpException` the repository throws goes out as it is. Any
|
|
34
|
+
other own data field of the host's record is passed on by reference without being read, host callbacks
|
|
35
|
+
(`maxSessionsResolver`) still receive the host's own entity, the token the module exports is still the host's own
|
|
36
|
+
instance, and `OAuthModule.register` used on its own provides its own guarded view.
|
|
37
|
+
- **A field that decides an admission is read as the kind its contract gives it.** The contract of each repository
|
|
38
|
+
method names, for every field, the kind of the type the interface declares, and the compiler checks it. The fields
|
|
39
|
+
a service reads to allow or to deny (`mfaEnabled`, `emailVerified`, `status`, `role`, the credentials, an
|
|
40
|
+
API key's `digest`, `scopes`, `expiresAt` and `revokedAt`, a workspace's `deletionScheduledAt`) are strict: a boolean
|
|
41
|
+
is a boolean and not a wrapper of one (`new Boolean(false)` is truthy), a string is a string, a date is a date with a
|
|
42
|
+
real time, a list of strings holds strings, and a field the interface requires is refused when a record lacks it. A
|
|
43
|
+
function, a symbol, a bigint or a wrapper there ends as `auth.internal` instead of being dropped as absent or
|
|
44
|
+
coerced: read as absent, `mfaEnabled` served as a function would have issued tokens where a second factor is due, and
|
|
45
|
+
a wrapper in `emailVerified` would have passed an unverified account. A field the interface allows to be absent may
|
|
46
|
+
be absent or `null`. The fields that only inform (an id, a name, the dates the library returns or displays) are
|
|
47
|
+
lenient: an id may be a string, a finite number or an instance of a class of the host (the id type of a driver, kept
|
|
48
|
+
as the host's own object), a date may be a date, a string, a number or an instance of another class (a date
|
|
49
|
+
library's), and absence is accepted; a function, a symbol, a bigint and the other values no reader lists are still
|
|
50
|
+
refused there. A method that owes a record, a page or a list and answers nothing ends as `auth.internal`; only a
|
|
51
|
+
lookup that may find nothing passes the nothing on.
|
|
52
|
+
- **A date a host wraps in a Proxy is read as a date.** A valid API key whose `expiresAt` was a Proxy of a `Date` was
|
|
53
|
+
refused, and a workspace whose `deletionScheduledAt` was one could be neither restored nor finalized, because the copy
|
|
54
|
+
of the record turned the Proxy into a plain object with no `getTime`. A Proxy whose prototype chain holds
|
|
55
|
+
`Date.prototype` is now copied as the date it answers as, and an object that only has methods named like a date's is
|
|
56
|
+
not taken for one. An answer with more elements or keys than a copy follows, or an array where a record is promised, is
|
|
57
|
+
refused as `auth.internal`.
|
|
58
|
+
|
|
59
|
+
### Changed
|
|
60
|
+
|
|
61
|
+
- **A date that is not a time is refused.** A record a repository returns with a date in a field that decides an
|
|
62
|
+
admission that compares false with every instant (an Invalid Date, or a Proxy whose `getTime` answers something that
|
|
63
|
+
is not a time, a string and an empty value among it) ends as `auth.internal`. Before, and in 1.5.11 and earlier, it was copied as it was, and a workspace
|
|
64
|
+
pending deletion whose deadline was such a date was finalized, because `due.getTime() > now` is false for it, and
|
|
65
|
+
could be restored past its grace period.
|
|
66
|
+
- **The fields of the contract are visible to a spread of the copy.** An entity that serves its fields through its
|
|
67
|
+
prototype (a Sequelize or Mongoose one) used to log in and then fail every later request with a 401, because the copy
|
|
68
|
+
kept those fields out of the token payload. They are now enumerable, except the credentials (`passwordHash`,
|
|
69
|
+
`mfaSecret`, `mfaRecoveryCodes`, `digest`), which are as visible as the host's record made them, so no spread of the
|
|
70
|
+
copy can carry them out.
|
|
71
|
+
- **Apply to a derived backend:** a repository has to serve every field a service decides on, as the type the
|
|
72
|
+
interface declares. A record that does not now ends as `auth.internal` (HTTP 500, no token) where 1.5.11 and earlier
|
|
73
|
+
accepted it: a field a service decides on that is absent (`mfaEnabled`, `emailVerified`, `status`, `role` or
|
|
74
|
+
`tenantId` missing from the row, which used to read as the default of its type, so an absent `mfaEnabled` was a user
|
|
75
|
+
without a second factor); a number where a string is declared (a numeric `tenantId`); a wrapper where a boolean is
|
|
76
|
+
declared (`new Boolean(false)` is truthy); a date of another class, or an Invalid Date, where a deadline is declared;
|
|
77
|
+
and a function, a symbol or a bigint in any field the contract names. A real `false` for `mfaEnabled` still logs in,
|
|
78
|
+
and a real `true` still gets the second-factor challenge. A column that holds nothing may be `null` or absent where
|
|
79
|
+
the interface marks the field optional.
|
|
80
|
+
|
|
21
81
|
## [1.5.11] - 2026-11-20
|
|
22
82
|
|
|
23
83
|
A patch release.
|
|
@@ -5452,7 +5512,8 @@ ever installable.
|
|
|
5452
5512
|
- 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
|
|
5453
5513
|
- 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
|
|
5454
5514
|
|
|
5455
|
-
[Unreleased]: https://github.com/bymaxone/nest-auth/compare/v1.5.
|
|
5515
|
+
[Unreleased]: https://github.com/bymaxone/nest-auth/compare/v1.5.12...HEAD
|
|
5516
|
+
[1.5.12]: https://github.com/bymaxone/nest-auth/compare/v1.5.11...v1.5.12
|
|
5456
5517
|
[1.5.11]: https://github.com/bymaxone/nest-auth/compare/v1.5.10...v1.5.11
|
|
5457
5518
|
[1.5.10]: https://github.com/bymaxone/nest-auth/compare/v1.5.9...v1.5.10
|
|
5458
5519
|
[1.5.9]: https://github.com/bymaxone/nest-auth/compare/v1.5.8...v1.5.9
|