fast-redact
fast-redact copied to clipboard
Multi-wildcard implementation broke paths passed to censor function
Hi! I love the new support for multiple wildcards in redaction paths. Unfortunately, when the PR for that feature was merged, it looks like it introduced some weird behavior.
As shown in this test and the one right below it, when a wildcard is used in a redaction path, and that path is exposed to the censor
function, the prior contract was for the censor function to see a path based on what the wildcard actually matched. E.g., the path '*.b'
would be passed to the censor function as ['a', 'b']
if the wildcard matched a key named 'a'
.
With multiple wildcards, though, as shown in this test, the first wildcard in the path is exposed to the censor function using the actual key it matched, but subsequent wildcards are passed in as a literal '*'
.
I implemented the original support for passing a path to the censor function, so I'd normally be open to fixing this ticket, but I really have no time right now. I've also completely forgotten everything figured out about specialSet
, and generally how all the pieces of this library fit together.
If @lukehedger is able to fix this, that would be amazing, since he's obviously touched the code more recently and wrote the multi-wildcard code. But, if he doesn't have time either, I figured I'd still open this issue just to document the problem.
Thanks, that would be amazing.
I think you've got the wrong guy @ethanresnick! At least, I have no memory of writing this code 😄
Doh, my bad. I meant @lrecknagel