OpenSearch icon indicating copy to clipboard operation
OpenSearch copied to clipboard

Refactor Grok validate pattern to iterative approach

Open sandeshkr419 opened this issue 8 months ago • 29 comments

Description

Unchecked recursive call in https://github.com/opensearch-project/OpenSearch/blob/main/libs/grok/src/main/java/org/opensearch/grok/Grok.java#L183 is expensive and indeterministic.

  1. Changing the approach to iterative to prevent stack overflow.
  2. Adding a limit on max depth size for a pattern resolution to prevent OOM.

Related Issues

Check List

  • [x] Functionality includes testing.
  • [x] API changes companion pull request created, if applicable.
  • [x] Public documentation issue/PR created, if applicable.

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.

sandeshkr419 avatar Jun 12 '24 00:06 sandeshkr419