This fixes the issue of restoring redacting values across multiple nested wildcards - the problem was that the redact/restore modifiers assumed the same value could be used to restore all instances of a redacted path. To fix, I've changed the specialSet function to keep track of the paths it visits in a tree, so that the correct path/value can be stored for use in restoring.
This has required a couple of extra modifications to the specialSet and iterateNthLevel functions:
special set now doesn't return anything - it takes the store as an argument and pushes restore instructions to it directly
this also means that there's no need to return an exists value for paths that aren't being redacted - where that was being done we can just not update the store
the iterateNthLevel function also doesn't returning anything now, similarly taking and mutating the store itself
as far as i can tell, this change also fixed a separate bug where iterateNthLevel would exit early, leaving some parts of a wildcard path untouched - this is covered in a new test case
fixes #50 also fixes https://github.com/pinojs/pino/issues/1745
This fixes the issue of restoring redacting values across multiple nested wildcards - the problem was that the redact/restore modifiers assumed the same value could be used to restore all instances of a redacted path. To fix, I've changed the
specialSet
function to keep track of the paths it visits in a tree, so that the correct path/value can be stored for use in restoring.This has required a couple of extra modifications to the
specialSet
anditerateNthLevel
functions:exists
value for paths that aren't being redacted - where that was being done we can just not update the storeiterateNthLevel
function also doesn't returning anything now, similarly taking and mutating the store itselfiterateNthLevel
would exit early, leaving some parts of a wildcard path untouched - this is covered in a new test case