beats icon indicating copy to clipboard operation
beats copied to clipboard

Add config check to replace processor

Open fearful-symmetry opened this issue 1 year ago • 3 comments

Proposed commit message

fixes https://github.com/elastic/beats/issues/38747

This adds a validation method to the config for the replace processor, so we don't get a null pointer deref and explosion in cases where a user hasn't configured a regex pattern.

Checklist

  • [x] My code follows the style guidelines of this project
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

fearful-symmetry avatar Jun 27 '24 16:06 fearful-symmetry

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

elasticmachine avatar Jun 27 '24 16:06 elasticmachine

This pull request does not have a backport label. If this is a bug or security fix, could you label this PR @fearful-symmetry? 🙏. For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

mergify[bot] avatar Jun 27 '24 16:06 mergify[bot]

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

elasticmachine avatar Jun 27 '24 19:06 elasticmachine

I think this may be overly strict. The implementation here prevents the use of the replace processor for removing a pattern; it is not possible to express s/<pattern>// while it was previously. The conventional approach of putting the value on a pointer to allow differentiation between an absence and a zero does not work with ucfg, it seems, so the validation would have to be done in code rather than in the struct tag.

efd6 avatar Sep 11 '24 11:09 efd6