-
Notifications
You must be signed in to change notification settings - Fork 633
Description
What did you do?
reviewed code of pino instrumentation
What did you expect to see?
Expected the instrumentation to have no visible side effects on the objects passed as parameters
What did you see instead?
There might be visible changes to the passed options object that if called with an additional constructor might result in multiple wrappers of the mixin function, in extreme situations very deep call stacks and possible crashes
If we consider following example:
const options = {};
const firstLogger = pino(options); // this will alter the options object => options.mixin = see here
const secondLogger = pino(options); // this will again alter it but at a different location => options.mixin = see here
const thirdLogger = pino(options); // this will again alter the object at the previous location
thirdLogger.error("some Error"); // this will have mixin => mixin => mixin on the call stack before it's done