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

Add config check to replace processor #40047

Merged

Conversation

fearful-symmetry
Copy link
Contributor

@fearful-symmetry fearful-symmetry commented Jun 27, 2024

Proposed commit message

fixes #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

  • My code follows the style guidelines of this project
  • 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
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

@fearful-symmetry fearful-symmetry added Team:Elastic-Agent Label for the Agent team bugfix labels Jun 27, 2024
@fearful-symmetry fearful-symmetry self-assigned this Jun 27, 2024
@fearful-symmetry fearful-symmetry requested a review from a team as a code owner June 27, 2024 16:58
@elasticmachine
Copy link
Collaborator

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

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jun 27, 2024
Copy link
Contributor

mergify bot commented Jun 27, 2024

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

@ycombinator ycombinator added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Jun 27, 2024
@elasticmachine
Copy link
Collaborator

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

@pierrehilbert pierrehilbert requested review from leehinman and removed request for AndersonQ June 28, 2024 07:20
libbeat/processors/actions/replace.go Outdated Show resolved Hide resolved
@efd6
Copy link
Contributor

efd6 commented Sep 11, 2024

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 added a commit that referenced this pull request Sep 12, 2024
…40751)

The change in #40047 breaks the use of the replace processor to do
s/<pattern>// replacement. So make the validation on absence, not zero state.
mergify bot pushed a commit that referenced this pull request Sep 12, 2024
…40751)

The change in #40047 breaks the use of the replace processor to do
s/<pattern>// replacement. So make the validation on absence, not zero state.

(cherry picked from commit a45a3ac)
efd6 added a commit that referenced this pull request Sep 13, 2024
…placement validation (#40801)

* libbeat/processors/replace: fix zero string replacement validation (#40751)

The change in #40047 breaks the use of the replace processor to do
s/<pattern>// replacement. So make the validation on absence, not zero state.

(cherry picked from commit a45a3ac)

* add missing pr number

---------

Co-authored-by: Dan Kortschak <[email protected]>
mergify bot pushed a commit that referenced this pull request Sep 20, 2024
…40751)

The change in #40047 breaks the use of the replace processor to do
s/<pattern>// replacement. So make the validation on absence, not zero state.

(cherry picked from commit a45a3ac)
efd6 added a commit that referenced this pull request Sep 20, 2024
…eplacement validation (#40917)

* libbeat/processors/replace: fix zero string replacement validation (#40751)

The change in #40047 breaks the use of the replace processor to do
s/<pattern>// replacement. So make the validation on absence, not zero state.

(cherry picked from commit a45a3ac)

* add missing pr number

---------

Co-authored-by: Dan Kortschak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Team:Elastic-Agent Label for the Agent team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[replace processor] Panic on invalid configuration
6 participants