Skip to content
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

feat(ruby): Add Nested path filtering support with dot notation #1129

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kylewelsby
Copy link

@kylewelsby kylewelsby commented Nov 27, 2024

🧰 Changes

This PR adds the abuility to filter nested objects using dot notation (e.g. user.password, payment.card.number). The feature improves API logging security by allowing precise filtering of nested sensitive data.

Key changes:

  • Added PathProcessor module to handling dot notation paths
  • Support for array path notation (users[].password)
  • Case-insensitive path matching
  • Maintains string length in redacted values
  • Adds support for both reject and allow-only filtering

Example usage:

# Reject specific nested fields
filter = Readme::Filter.for(reject: ['user.password', 'payment.card.number'])
filter.filter({
  user: { 
    name: 'John',
    password: 'secret'
  }
})
# => { user: { name: 'John', password: '[REDACTED 6]' } }

# Allow only specific nested fields
filter = Readme::Filter.for(allow_only: ['user.name'])

🧬 QA & Testing

Screenshot 2024-11-14 at 14 40 21

@kylewelsby kylewelsby changed the title Add Nested path filtering support with dot notation feat(:filter) Add Nested path filtering support with dot notation Nov 27, 2024
@kylewelsby kylewelsby marked this pull request as ready for review November 27, 2024 14:19
@kylewelsby kylewelsby changed the title feat(:filter) Add Nested path filtering support with dot notation feat(ruby) Add Nested path filtering support with dot notation Nov 27, 2024
@kylewelsby kylewelsby changed the title feat(ruby) Add Nested path filtering support with dot notation feat(ruby): Add Nested path filtering support with dot notation Nov 27, 2024
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.

1 participant