@bymax-one/nest-auth 1.4.17 → 1.4.18

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,71 @@ what moves, and that note is the compatibility contract until strict SemVer begi
18
18
 
19
19
  ## [Unreleased]
20
20
 
21
+ ## [1.4.18] - 2026-11-07
22
+
23
+ ### Apply to a derived backend
24
+
25
+ - **A request body declared compressed is now refused with `415 auth.validation`, whatever the
26
+ host's body parser does.** Express's default parser decompresses `gzip`, `deflate` and `br`
27
+ before a handler runs, so these requests used to be accepted; rust-auth refuses them. The
28
+ library now answers `415` "Unsupported media type" in the library envelope for any
29
+ `Content-Encoding` other than `identity` on its JSON-body routes, before the handler. Refresh,
30
+ logout, revoke-all and the WebSocket ticket request are unchecked; the MFA setup routes, which
31
+ accept an empty body, refuse it only when a body is present; `GET`, `HEAD`, `OPTIONS` and
32
+ `DELETE` requests are never checked. The route-by-route scope is the new `requestEncoding`
33
+ section of `conformance/wire-contract.json`, and a test fails when a controller route is added
34
+ without a decision. A client that compresses its request bodies must send them uncompressed;
35
+ browsers and `fetch` do not compress them. A host that also sets `inflate: false` on its JSON
36
+ parser refuses earlier, with the same `415` through `AuthExceptionFilter`.
37
+ - **A body that claims to be compressed and is not now answers `400 auth.validation`
38
+ `Malformed request`, not `500`.** The body parser raises that failure as a plain 400 with no
39
+ `type`, so `AuthExceptionFilter` now answers a 400 error of that shape that arrived before any
40
+ route matched with the fixed message. The `transportErrors` section lists the row.
41
+ - **New public API:** `RequestEncodingGuard`, applied at class level to every library controller
42
+ and available for a host's own controllers; the `@RequestEncoding('unchecked' | 'when-body')`
43
+ decorator and its `RequestEncodingPolicy` type, which set a route's policy (a route with none is
44
+ strict). `content-encoding`, `content-length` and `transfer-encoding` join the headers the library reads,
45
+ so `apiKeys.header` can no longer name them.
46
+ - **A logout that needed a retry now fires `afterLogout` (and `afterPlatformLogout`) once, on the
47
+ retry that completes it.** A logout attempts every revocation write and answers `5xx` when one
48
+ failed, and the attempt had already deleted the refresh session, so the retry found no record to
49
+ say whose logout it was and the hook never fired for it. An attempt that fails a write while it
50
+ still has the session's owner now leaves a short-lived marker, `lp:{sha256(refreshToken)}` on the
51
+ dashboard plane and `plp:{...}` on the platform plane, holding the owner and tenant from the
52
+ session record; it lives for the access-token lifetime and never less than 300 seconds. A retry
53
+ that finds no session reads the owner from the marker, and when it completes with no failure it
54
+ removes the marker and fires the hook only if that removal removed it, so sequential retries
55
+ announce once and a repeat announces nothing; attempts of one logout that run concurrently are
56
+ at-least-once. The owner is never taken from an access
57
+ token's claims. A marker that cannot be written leaves the retry silent, as before, and a marker
58
+ that cannot be removed never fails a completed logout. HTTP statuses, bodies and cookies are
59
+ unchanged. The shared contract gains the two key prefixes and a `logoutPending` record row. A
60
+ consumer whose hook assumed a logout is announced only by the call that found the session now
61
+ also receives it from the completing retry. Private `blacklistWrites` (both services) and
62
+ `revokeSessionMetadata` (`AuthService`) appear in the declarations.
63
+ - **A late MFA re-encryption can no longer overwrite a `disable` or a re-enrolment.** This applies
64
+ only to a deployment that has configured `mfa.previousEncryptionKeys` and still holds secrets
65
+ stored under a retired key: the first successful challenge on such an account re-encrypts the
66
+ secret under the current key, and that write replaces the whole MFA record. If the user disabled
67
+ MFA, or re-enrolled with a new secret and recovery codes, while that write was in flight, it could
68
+ restore the removed factor or the replaced secret and recovery digests. The re-encryption is now
69
+ one of the serialized MFA transitions and writes only when the stored secret still decrypts to
70
+ the secret the challenge opened, and the recovery-code challenge makes the same check before it
71
+ writes back the list without the used code. A sibling challenge that only re-encrypted the same secret does not count as a
72
+ change. Accounts already past the migration, and deployments with no retired key, are not
73
+ affected; draining the retired keys closes the exposure. When another transition holds the lock
74
+ the migration is skipped and retried by the next challenge. No contract change. Private
75
+ `holdsSecret` appears in the `MfaService` declarations, and the private `reencryptSecret` loses
76
+ its recovery-codes parameter.
77
+
78
+ ### Fixed
79
+
80
+ - **Compressed request bodies are refused the way rust-auth refuses them, and a corrupt one no
81
+ longer answers `500`.** See the note above.
82
+ - **A logout completed by a retry no longer goes unannounced.** See the note above.
83
+ - **The MFA re-encryption under the current key no longer overwrites a concurrent `disable` or
84
+ re-enrolment.** See the note above.
85
+
21
86
  ## [1.4.17] - 2026-11-07
22
87
 
23
88
  ### Apply to a derived backend
@@ -4418,7 +4483,8 @@ ever installable.
4418
4483
  - 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
4419
4484
  - 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
4420
4485
 
4421
- [Unreleased]: https://github.com/bymaxone/nest-auth/compare/v1.4.17...HEAD
4486
+ [Unreleased]: https://github.com/bymaxone/nest-auth/compare/v1.4.18...HEAD
4487
+ [1.4.18]: https://github.com/bymaxone/nest-auth/compare/v1.4.17...v1.4.18
4422
4488
  [1.4.17]: https://github.com/bymaxone/nest-auth/compare/v1.4.16...v1.4.17
4423
4489
  [1.4.16]: https://github.com/bymaxone/nest-auth/compare/v1.4.15...v1.4.16
4424
4490
  [1.4.15]: https://github.com/bymaxone/nest-auth/compare/v1.4.14...v1.4.15