Skip to content

fix(pino): avoid mutating user options when reused#3360

Open
MUSKANNISHAD wants to merge 2 commits intoopen-telemetry:mainfrom
MUSKANNISHAD:fix/pino-avoid-mutating-options
Open

fix(pino): avoid mutating user options when reused#3360
MUSKANNISHAD wants to merge 2 commits intoopen-telemetry:mainfrom
MUSKANNISHAD:fix/pino-avoid-mutating-options

Conversation

@MUSKANNISHAD
Copy link

This change avoids mutating user-provided options when creating multiple Pino
logger instances with the same configuration object.

Previously, reusing the same options object across multiple pino(options)
calls could lead to mixin wrappers being stacked, since the options reference
was shared. This patch defensively clones the options argument before passing
it to pino(), preventing unintended side effects.

A regression test has been added to ensure that reusing the same options object
does not cause errors or recursive mixin behavior.

Fixes #2024

Note: On Windows, nx test instrumentation-pino fails locally due to Mocha glob
quoting ('test/**/*.test.ts'). Tests pass in CI (Linux), which is the supported
environment for this repository.

@MUSKANNISHAD MUSKANNISHAD force-pushed the fix/pino-avoid-mutating-options branch from b0a3067 to 777f850 Compare January 30, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pino instrumentation might modify user object

2 participants