davidmarkclements / fast-redact

very fast object redaction
MIT License
284 stars 30 forks source link

fix: properly restore nested wildcard values #59

Closed matt-clarson closed 1 year ago

matt-clarson commented 1 year ago

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 and iterateNthLevel functions:

mcollina commented 1 year ago

this is amazing work, thanks!