Add support for array string masking with [] pattern #192
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
This PR adds support for masking arrays containing string values using the
["property", "[]"]pattern in the logger's JSON masking functionality. Previously, the masking system only supported patterns like["[]", "property"]but not the reverse where the array key comes at the end.Approach
The implementation adds support for the
["property", "[]"]pattern through several key changes:maskArrayRecursiveto handle the new pattern by detecting when array key ("[]") appears at the end of the key pathmaskArrayContentsandmaskAllStringValuesThe new pattern enables masking arrays like
["some value", "another value"]when using keys["test7", "[]"], making the masking system more flexible and intuitive.Testing
All existing tests pass, and new test cases have been added to verify the array string masking functionality works correctly with both single and multiple string values in arrays.