davidmarkclements / fast-redact

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

fix: restore with wildcard pattern repetition #51

Closed meirkl closed 2 years ago

meirkl commented 2 years ago

This PR is a draft because I discovered this bug through pino.

The behavior in pino is different than the behavior described in #50. In pino it causes infinite recursion. The changes in the PR doesn't fix the issue in pino.

Pino reproduction

const pino = require('pino');

const logger = pino({
  redact: { paths: ['*.d', '*.*.d', '*.*.*.d'] },
});

const obj = {
  x: { c: { d: 'hide me', e: 'leave me be' } },
  y: { c: { d: 'and me', f: 'I want to live' } },
  z: { c: { d: 'and also I', g: 'I want to run in a stream' } },
};

logger.info(obj);
console.log(obj);
mcollina commented 2 years ago

This seems correct

meirkeller commented 2 years ago

It doesn't fix https://github.com/pinojs/pino/issues/1513

meirkl commented 2 years ago

@mcollina What about this?

mcollina commented 2 years ago

@meirkl send a PR.

meirkl commented 2 years ago

@meirkl send a PR.

You want me to add this to the PR?

mcollina commented 2 years ago

I don't understand the status of this. We want the problem in pino resolved, right? Make it so ;).