@bymax-one/nest-logger 1.4.15 → 1.4.17
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 +136 -1
- package/README.md +280 -808
- package/dist/server/index.cjs +550 -74
- package/dist/server/index.d.cts +110 -6
- package/dist/server/index.d.ts +110 -6
- package/dist/server/index.mjs +551 -75
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,139 @@ heading here.
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [1.4.17] - 2026-11-14
|
|
15
|
+
|
|
16
|
+
### Changed (Security)
|
|
17
|
+
|
|
18
|
+
- **The default redaction list now covers the credential names real systems write.** A name is
|
|
19
|
+
matched as written (case-insensitively under the default `'names'` strategy), so `accessToken`
|
|
20
|
+
never covered `access_token`, the OAuth wire name, and a value under it was written in clear.
|
|
21
|
+
Measured on 1.4.16: `{ access_token, refresh_token, api_key, 'proxy-authorization' }` in the
|
|
22
|
+
metadata of a log call reached the line unredacted. `REDACT_COMMON_FIELDS` grows from 32 to 62
|
|
23
|
+
names, append-only: the snake and kebab spellings of the token, key and secret names
|
|
24
|
+
(`access_token`, `refresh-token`, `client_secret`, `private-key`, `api_key`, `secret_key`, and
|
|
25
|
+
the rest), `proxy-authorization`, the session-token and CSRF names (`session_token`,
|
|
26
|
+
`sessionToken`, `x-csrf-token`, `x-xsrf-token`, `csrf_token`) and the snake forms of the
|
|
27
|
+
password family. The lower-case `apikey` and `sessiontoken` are listed as well, because the legacy
|
|
28
|
+
`'paths'` strategy is case-sensitive. A bare `sessionId` is deliberately **not** listed: it is
|
|
29
|
+
often a correlation key, and a name cannot be turned off alone.
|
|
30
|
+
**Apply to a derived backend:** a field named like any added name now arrives as `[REDACTED]`, so
|
|
31
|
+
a query or alert that matched its value stops matching. The README's redaction table lists every
|
|
32
|
+
name. A field you relied on under one of them keeps working if you carry it under a different
|
|
33
|
+
key; a name that is not a credential in your system cannot be removed from the list, because the
|
|
34
|
+
only switch is `shouldDisableDefaultRedact: true`, which disables all of them. Conversely, a
|
|
35
|
+
session id that is a bearer credential in your system is not covered by default: add `sessionId`
|
|
36
|
+
to your `redactPaths`.
|
|
37
|
+
**Cost under `redactStrategy: 'paths'`:** `DEFAULT_REDACT_PATHS` grows from 165 to 315 entries,
|
|
38
|
+
and that engine is slower in proportion; the default `'names'` strategy is a set lookup and is
|
|
39
|
+
unchanged, and is the recommended one.
|
|
40
|
+
|
|
41
|
+
- **A credential in a path segment no longer reaches a log line.** A reset, verification or
|
|
42
|
+
invitation link carries its token in the path (`/auth/reset/<token>`), where the query-string
|
|
43
|
+
stripping does not reach and key-name redaction cannot censor it, because it is the value of a
|
|
44
|
+
string field. Measured before this change: a 64-digit hex token and a JWT in the path were written in
|
|
45
|
+
clear in `fullUrl`, in the `url` of an exception entry, and in the not-found message
|
|
46
|
+
(`Cannot GET /auth/reset/<token>`). Each path segment that is a hex value of 32 or more digits, a
|
|
47
|
+
JWT, an opaque token of 32 or more base64 or base64url characters, or an email address is now written as
|
|
48
|
+
`:redacted`, in `url`, `fullUrl` and the not-found message, through the interceptor, the access
|
|
49
|
+
log (`applyAccessLog`) and the exception filter. The rest of the route is kept, so per-route
|
|
50
|
+
queries still group the requests. A slug, a snake_case name and a UUID are identifiers, not credentials, and are left as they
|
|
51
|
+
are, unless a hex run of 32 or more digits sits inside them (`rst_<hex>`) (`url` still collapses a UUID to `/:id`). The new
|
|
52
|
+
`http.secretPathSegments` adds your own patterns, each tested against one percent-decoded
|
|
53
|
+
segment, for a token shape the built-in rules do not see (`[/^tok_/]`). `HttpExceptionFilter`
|
|
54
|
+
takes the resolved options as an optional second constructor argument, so a filter you build with
|
|
55
|
+
the logger alone keeps working and applies the built-in patterns.
|
|
56
|
+
**Apply to a derived backend:** a query or alert on `fullUrl` that matched such a token as text
|
|
57
|
+
stops matching; `fullUrl` is the raw path with the query removed and the credential segments
|
|
58
|
+
replaced, not the request as received. A path your route table cannot tell apart from a token (a
|
|
59
|
+
long segment with digits or mixed case that is a name, not a secret) is replaced too, and the way
|
|
60
|
+
back is to carry that name in a shorter or hyphenated lowercase form.
|
|
61
|
+
|
|
62
|
+
- **A request object passed as log metadata no longer writes the credentials of the call.** Measured
|
|
63
|
+
before this change: `logger.info(key, msg, userId, { req })` with a Node `IncomingMessage` wrote
|
|
64
|
+
the whole object, the connection and the server included, and its `rawHeaders` array carried the
|
|
65
|
+
`Authorization`, `X-Api-Key` and `Cookie` values in clear, because the array holds a value beside
|
|
66
|
+
its name and not under a key. A request under the `req` key is now written as its `method`, its
|
|
67
|
+
`url` (without the query, with a credential path segment replaced), its `headers` (censored by
|
|
68
|
+
name) and the peer's `remoteAddress`. Anywhere else in a record, the value beside a sensitive name
|
|
69
|
+
in a `rawHeaders` or `rawTrailers` array is censored. A host that registers its own `serializers.req`
|
|
70
|
+
replaces the default and receives the redaction walk's copy of the request, as before, and a record
|
|
71
|
+
under `req` that is not a request is written as it was.
|
|
72
|
+
**Apply to a derived backend:** an entry that logged a whole request and read a field of it that
|
|
73
|
+
is no longer written (`socket`, `rawHeaders`, a framework field such as `params`) stops carrying
|
|
74
|
+
it. Log the field you need under its own key, or register `serializers.req`.
|
|
75
|
+
|
|
76
|
+
### Changed
|
|
77
|
+
|
|
78
|
+
- **The release workflow packs the tarball once, in a job that holds no publish credential.** The
|
|
79
|
+
`build` job installs, runs the gates and packs; type resolution and the smoke test that installs
|
|
80
|
+
the package into a consumer run on a copy of that tarball, and the size budget reads a `dist/`
|
|
81
|
+
that the build checks is the one that was packed. The `publish` job installs nothing
|
|
82
|
+
and runs no code from the package: it checks the tarball's sha256 against the one `build`
|
|
83
|
+
reported and publishes that exact file with provenance. No file of the package changes with this.
|
|
84
|
+
|
|
85
|
+
### Documentation
|
|
86
|
+
|
|
87
|
+
- The README states the limits of the request serializer and of the shutdown budget.
|
|
88
|
+
|
|
89
|
+
### Fixed
|
|
90
|
+
|
|
91
|
+
- **Shutdown waits for the queue of a slow destination, and no destination hook can hold the
|
|
92
|
+
application forever.** Measured before this change: a destination that takes 5 ms per write,
|
|
93
|
+
given 300 entries and then `app.close()`, was told `onShutdown` before any of them had started
|
|
94
|
+
(301 writes began after it). Each destination sits behind a `Writable` that holds the entries
|
|
95
|
+
Pino has written and the destination has not taken, and the registry never looked at it. Shutdown
|
|
96
|
+
now waits, for all destinations at once, until no queue holds an entry, then calls `onShutdown`
|
|
97
|
+
in reverse registration order. An entry written during the wait extends it. The new `shutdown`
|
|
98
|
+
option bounds the whole sequence: `timeoutMs` (default 10000) covers the drain and every
|
|
99
|
+
`onShutdown`, so the worst case is that value whatever the number of destinations, and
|
|
100
|
+
`drainTimeoutMs` (default 5000, not above `timeoutMs`) bounds the drain. When the drain ends with
|
|
101
|
+
entries still queued, one stderr line names the destinations and the size of what each holds, and
|
|
102
|
+
no entry content. A destination reached after the budget is spent is named in one stderr line and
|
|
103
|
+
its `onShutdown` is not called. `onInit` and `onRegistryReady` had no deadline either; the new
|
|
104
|
+
`destinationHookTimeoutMs` (default 10000) bounds them. An `onInit` that does not settle in time
|
|
105
|
+
counts as one that threw: the destination is marked failed, skipped and reported, and if the
|
|
106
|
+
abandoned call settles later the destination stays inactive and receives no write and no
|
|
107
|
+
`onShutdown`. A hung `onInit` cannot be cancelled and may leak what it opened. An
|
|
108
|
+
`onRegistryReady` that does not settle is reported and bootstrap goes on. Entries logged after the
|
|
109
|
+
drain ended (a host that logs in its own shutdown hook) are not waited for.
|
|
110
|
+
**Apply to a derived backend:** a destination whose `onInit` legitimately takes more than 10
|
|
111
|
+
seconds (a slow connection) is now failed and skipped; raise `destinationHookTimeoutMs`. A
|
|
112
|
+
destination with a long flush in `onShutdown` is cut off at the shutdown budget; raise
|
|
113
|
+
`shutdown.timeoutMs` (and `shutdown.drainTimeoutMs`) and keep the total below the grace period your
|
|
114
|
+
platform gives the process. Shutdown of a process with queued entries now takes up to the drain
|
|
115
|
+
budget longer.
|
|
116
|
+
|
|
117
|
+
- **A destination, and stdout, can no longer grow the process without limit.** Measured before this
|
|
118
|
+
change: 1,000,000 lines to a pipe nobody reads queued 234 MB in `process.stdout` and grew the
|
|
119
|
+
process by 1.36 GB, with no signal, and a destination slower than the application queued in the
|
|
120
|
+
same way. Pino does not slow down for either. The new `destinationQueue.maxBytes` (default
|
|
121
|
+
33554432, 32 MiB; an integer from 1024 to 2147483647, or `0` for no bound) bounds what each
|
|
122
|
+
destination may hold. Past it the NEW entry is dropped for that destination, the others still
|
|
123
|
+
receive it, and stderr says so: a line for the first drop, then at most one every 10 seconds per
|
|
124
|
+
destination with the name, the count and the limit and never an entry's content, and a total at
|
|
125
|
+
shutdown. The count is the module's own queue plus what the destination reports through the new
|
|
126
|
+
optional `ILogDestination.queuedBytes()`, which the default stdout destination implements for
|
|
127
|
+
`process.stdout`. Measured on 400,000 lines to an unread pipe: growth of 289,865,728 bytes with no
|
|
128
|
+
bound and 69,681,152 bytes with a 4 MiB bound. The shutdown path now reads a monotonic clock, so a
|
|
129
|
+
wall-clock step during shutdown no longer stretches or cuts the budget.
|
|
130
|
+
**Apply to a derived backend:** a stalled stdout consumer now loses entries past
|
|
131
|
+
`destinationQueue.maxBytes` instead of growing the process; set `destinationQueue: { maxBytes: 0 }`
|
|
132
|
+
to restore the old behaviour. A custom destination that buffers on its own can implement
|
|
133
|
+
`queuedBytes()` to be counted. `process.exit()` still does not wait for a queue (measured: 568 of
|
|
134
|
+
200,000 lines delivered on a pipe); `await app.close()` before exiting delivers them.
|
|
135
|
+
|
|
136
|
+
## [1.4.16] - 2026-11-12
|
|
137
|
+
|
|
138
|
+
### Documentation
|
|
139
|
+
|
|
140
|
+
- The README is about a third shorter. Reference material that sat inside the Quick Start (HTTP logging, OpenTelemetry, resource identity, event names, error fields, context propagation) now has its own sections after Configuration, the Quick Start keeps install, register, async and inject, and release history and process notes are gone.
|
|
141
|
+
- The Performance section no longer quotes figures for bare Pino from Pino's own benchmark (its Node version did not match the specification's). It reports this repository's benchmark of the shipped configuration: about 274,000 entries/s, 0.345× of the bare wrapper.
|
|
142
|
+
- Removed the mention of a future `@bymax-one/nest-audit`, a package that does not exist.
|
|
143
|
+
- The README keeps the house section order: a compact Features list after Overview, and a Security Table and Tech Stack between Security Model and Testing & Quality.
|
|
144
|
+
- Two precision notes on the 1.4.15 entry below. Both concern a host on `redactStrategy: 'paths'` with `errorOwnFields: 'safe'`: there the redaction walk already converted a nested `Error` to data, so it was never written as `{}`, and it did not run the `Error`'s `toJSON`, so the output of that method, which is what the leak above describes, was not what reached the log. With the default `errorOwnFields: 'all'` the entry stands as written.
|
|
145
|
+
- `dist/` is unchanged.
|
|
146
|
+
|
|
14
147
|
## [1.4.15] - 2026-11-10
|
|
15
148
|
|
|
16
149
|
### Fixed
|
|
@@ -2713,7 +2846,9 @@ published `dist/` is identical — no runtime behaviour changes for consumers.
|
|
|
2713
2846
|
- Professional CI suite: `ci.yml`, `bench.yml`, `codeql.yml`, `scorecard.yml`,
|
|
2714
2847
|
`release.yml`, Dependabot, and issue templates
|
|
2715
2848
|
|
|
2716
|
-
[Unreleased]: https://github.com/bymaxone/nest-logger/compare/v1.4.
|
|
2849
|
+
[Unreleased]: https://github.com/bymaxone/nest-logger/compare/v1.4.17...HEAD
|
|
2850
|
+
[1.4.17]: https://github.com/bymaxone/nest-logger/compare/v1.4.16...v1.4.17
|
|
2851
|
+
[1.4.16]: https://github.com/bymaxone/nest-logger/compare/v1.4.15...v1.4.16
|
|
2717
2852
|
[1.4.15]: https://github.com/bymaxone/nest-logger/compare/v1.4.14...v1.4.15
|
|
2718
2853
|
[1.4.14]: https://github.com/bymaxone/nest-logger/compare/v1.4.13...v1.4.14
|
|
2719
2854
|
[1.4.13]: https://github.com/bymaxone/nest-logger/compare/v1.4.12...v1.4.13
|