Skip to content

Fix redaction when double wildcards are used in certain conditions #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2025

Conversation

satazor
Copy link
Contributor

@satazor satazor commented Apr 15, 2025

Given the following data:

{
  "evaluation": {
    "rules": [
      {
        "conditions": {
          "name-matching-score": {
            "name": "foo",
            "details": {
              "userFullName": "raj"
            }
          }
        }
      }
    ]
  }
}

And the following whitelist patterns:

['evaluation.rules.**.name']

The redaction is unredacting userFullName but it shouldn't.

@Copilot Copilot AI review requested due to automatic review settings April 15, 2025 17:08
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

src/index.js:127

  • Removing this regex replacement may impact patterns that require a preceding dot. Please verify that the new regex replacements fully cover all intended double wildcard scenarios without causing mis-matches.
.replaceAll('\.\*\*\.', '\..*')

test/src/index.test.js:236

  • [nitpick] Consider adding additional tests to cover edge cases involving double wildcard patterns, ensuring that only the intended properties are redacted under various nesting and path conditions.
expect(anonymizer({ whitelist: ['parent1.**.oo'] })(data)).toEqual({

@fixe fixe merged commit 342704e into master Apr 15, 2025
2 checks passed
@fixe fixe deleted the bugfix/fix-incorrect-redaction-double-wildcard branch April 15, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants