Skip to content

Conversation

@Arvind-Maan
Copy link

@Arvind-Maan Arvind-Maan commented Feb 2, 2026

Description

Creates an overridable Pattern interface in data-prepper-api that allows consumers to set the Pattern library used for regex evaluation through System environment field dataprepper.pattern.provider. By default, it will fallback to the Java SDK regex library (the current one), unless set in the system. Updates the corresponding modules that leverage Pattern to use the new Pattern interface.

Additionally, this CR creates a Pattern Provider leveraging the Re2j library, which works to minimize the risk of adversarial regex's directly resolving #6279

Issues Resolved

Resolves #6279

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR -> Documentation update for Pattern Interface #6477
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

- Create Pattern interface in data-prepper-api
- Add Re2J implementation with ServiceLoader
- Update all processors to use Pattern API
- Add Re2J tests to verify adversarial pattern protection
- Default to Java SDK Pattern for backward compatibility

Resolves opensearch-project#6279

Signed-off-by: Arvind Maan <arvindsmaan@gmail.com>
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.

[BUG] Regex evaluators catastrophic backtracking

1 participant