Fix RFC 5424 syslog parser to handle \\ and \" escapes in structured data#49595
Fix RFC 5424 syslog parser to handle \\ and \" escapes in structured data#49595
\\ and \" escapes in structured data#49595Conversation
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
…canner The sd_raw scanner in rfc5424.rl only treated \] as a valid escape sequence. Per RFC 5424 §6.3.3, \\, \", and \] must all be recognized as escapes inside SD-PARAM-VALUE. This caused parsing failures for messages containing escaped backslashes (e.g. tenantNodePath="1\\2"). Changed sd_raw_values to use escape_chars (which includes all three escape characters) instead of only ']', and regenerated the Go parser. Co-authored-by: bhapas <123897612+bhapas@users.noreply.github.com> Agent-Logs-Url: https://github.com/elastic/beats/sessions/4169e697-a80d-44cf-babc-3c867b6e23a3
\\ and \" escapes in structured data
|
@copilot Add a test under processors/syslog_test.go |
Co-authored-by: bhapas <123897612+bhapas@users.noreply.github.com> Agent-Logs-Url: https://github.com/elastic/beats/sessions/c5577186-8e13-4630-a7b3-d6dddb90d689
Added in f84cf85. The new |
|
@copilot Add changelog fragment |
Co-authored-by: bhapas <123897612+bhapas@users.noreply.github.com> Agent-Logs-Url: https://github.com/elastic/beats/sessions/57dbc961-daa2-4fbe-a8ac-791c41b6ab64
|
Pinging @elastic/integration-experience (Team:Integration-Experience) |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR fixes RFC 5424 syslog message parsing to correctly handle escaped backslashes and quotes in structured-data parameter values. The grammar in 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This comment has been minimized.
This comment has been minimized.
|
@copilot Fix golangci-lint issues |
…t.Equal Co-authored-by: bhapas <123897612+bhapas@users.noreply.github.com> Agent-Logs-Url: https://github.com/elastic/beats/sessions/d2709a08-99f5-46f8-a236-3a78e58ac155
TL;DR
Remediation
Investigation detailsRoot CauseThe Evidence
Validation
Follow-up
What is this? | From workflow: PR Actions Detective Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
There was a problem hiding this comment.
This appears to be fixing the same issue as #49392
The
sd_rawscanner in the Ragel grammar only recognized\]as a valid escape sequence, but RFC 5424 §6.3.3 requires\",\\, and\]. Messages with escaped backslashes (e.g.tenantNodePath="1\\2") would fail withunexpected EOF.Grammar fix (
rfc5424.rl):escape_charsis already defined as('"' | ']' | bs)and used by theparam_valuerule —sd_rawwas the only path that didn't use it.parser/rfc5424.rl— one-line fix tosd_raw_valuesrfc5424_gen.go— regenerated viaragel -Z -G2rfc5424_test.go/message_test.go— test cases for\\,\", and combined escapes in bothparseRFC5424andparseStructuredDataprocessors/syslog_test.go— end-to-end test case for escaped backslash in structured data through the syslog processorchangelog/fragments/— changelog fragment for the bug fixOriginal prompt
⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.