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

[syslog] Fix handling of escaped characters in structured data #40446

Merged
merged 3 commits into from
Aug 8, 2024

Conversation

taylor-swanson
Copy link
Contributor

@taylor-swanson taylor-swanson commented Aug 6, 2024

Proposed commit message

  • Improved syslog RFC 5424 parser to handle escaped closing square brackets in structured data.
  • Fix incorrect offset being passed to removeBytes function, which would not remove escaped characters from structured data values.
  • Add tests which include escaped brackets in structured data.

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.

Disruptive User Impact

N/A

How to test this PR locally

Run unit tests in libbeat/reader/syslog

Related issues

- Improved parser to handle escaped closing square brackets in structured data.
- Fix incorrect offset being passed to removeBytes function, which would not remove
escaped characters from structured data values.
- Add tests
@taylor-swanson taylor-swanson added bug libbeat Team:Security-Deployment and Devices Deployment and Devices Team in Security Solution backport-v8.14.0 Automated backport with mergify backport-8.15 Automated backport to the 8.15 branch with mergify labels Aug 6, 2024
@taylor-swanson taylor-swanson self-assigned this Aug 6, 2024
@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 Aug 6, 2024
@botelastic
Copy link

botelastic bot commented Aug 6, 2024

This pull request doesn't have a Team:<team> label.

@taylor-swanson taylor-swanson marked this pull request as ready for review August 7, 2024 13:03
@taylor-swanson taylor-swanson requested a review from a team as a code owner August 7, 2024 13:03
@elasticmachine
Copy link
Collaborator

Pinging @elastic/sec-deployment-and-devices (Team:Security-Deployment and Devices)

@taylor-swanson
Copy link
Contributor Author

/test

@taylor-swanson taylor-swanson marked this pull request as draft August 7, 2024 13:14
@taylor-swanson
Copy link
Contributor Author

Moving back to draft, as another edge case was found with structured data parsing.

- The non-compliant-sd cases now include escapes on the closing brackets
within the structured data, something that should have always been there.
@taylor-swanson taylor-swanson marked this pull request as ready for review August 7, 2024 16:02
@taylor-swanson taylor-swanson merged commit 1c01d0e into elastic:main Aug 8, 2024
122 checks passed
@taylor-swanson taylor-swanson deleted the bug/syslog-escapes branch August 8, 2024 13:51
mergify bot pushed a commit that referenced this pull request Aug 8, 2024
- Improved parser to handle escaped closing square brackets in structured data, along
with square brackets in the normal, non-structured data portion of the message.
- Fix incorrect offset being passed to removeBytes function, which would not remove
escaped characters from structured data values.
- The non-compliant-sd unit test cases now include escapes on the closing brackets
within the structured data, something that should have always been there.
- Add tests

(cherry picked from commit 1c01d0e)
mergify bot pushed a commit that referenced this pull request Aug 8, 2024
- Improved parser to handle escaped closing square brackets in structured data, along
with square brackets in the normal, non-structured data portion of the message.
- Fix incorrect offset being passed to removeBytes function, which would not remove
escaped characters from structured data values.
- The non-compliant-sd unit test cases now include escapes on the closing brackets
within the structured data, something that should have always been there.
- Add tests

(cherry picked from commit 1c01d0e)
pierrehilbert pushed a commit that referenced this pull request Aug 12, 2024
…n structured data (#40463)

* [syslog] Fix handling of escaped characters in structured data (#40446)

- Improved parser to handle escaped closing square brackets in structured data, along
with square brackets in the normal, non-structured data portion of the message.
- Fix incorrect offset being passed to removeBytes function, which would not remove
escaped characters from structured data values.
- The non-compliant-sd unit test cases now include escapes on the closing brackets
within the structured data, something that should have always been there.
- Add tests

(cherry picked from commit 1c01d0e)

* fix up changelog

---------

Co-authored-by: Taylor Swanson <[email protected]>
Co-authored-by: Taylor Swanson <[email protected]>
taylor-swanson added a commit that referenced this pull request Aug 30, 2024
…n structured data (#40464)

- Improved parser to handle escaped closing square brackets in structured data, along
with square brackets in the normal, non-structured data portion of the message.
- Fix incorrect offset being passed to removeBytes function, which would not remove
escaped characters from structured data values.
- The non-compliant-sd unit test cases now include escapes on the closing brackets
within the structured data, something that should have always been there.
- Add tests

(cherry picked from commit 1c01d0e)

---------

Co-authored-by: Taylor Swanson <[email protected]>
Co-authored-by: Taylor Swanson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.15 Automated backport to the 8.15 branch with mergify backport-v8.14.0 Automated backport with mergify bug libbeat Team:Security-Deployment and Devices Deployment and Devices Team in Security Solution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Syslog reader/processor does not handle escaped brackets in structured data fields
3 participants