vindeckyy commented on PR #4424:
URL: https://github.com/apache/logging-log4j2/pull/4424#issuecomment-6686392889

   All three checks fire on output the layouts are meant to produce:
   
   - `Rfc5424Layout` and `SyslogLayout` leave `\n` in `MSG` by default; the 
security FAQ lists that as by design. `NEWLINE_PATTERN` is `\r?\n`, so a lone 
`\r`, NEL, U+2028 and U+2029 are not replaced even with `newLineEscape` set. 
The frame check only holds for the sequences the option actually escapes.
   - `StructuredDataMessage.asString(FULL)` appends `MSG` after the SD-ELEMENT, 
so a quote in the message text breaks the quote count. The count also cannot 
separate a structural quote from a quote inside a PARAM-VALUE.
   - `GelfLayout` escapes a trailing `\` as `\\`; the scanner sees the closing 
quote as escaped and reports a control character.
   
   I split the target as you suggested:
   
   - `Rfc5424LayoutFuzzer`: `newLineEscape` set, MDC key and value fuzzed 
separately from the message.
   - `SyslogLayoutFuzzer`: `newLineEscape` set.
   - `GelfLayoutFuzzer`: compression off, using `JsonEncodingAppender` so JSON 
conformance comes from `JsonUtil.assertValidJson`.
   - `StructuredDataMessageFuzzer`: quote count removed, keys sanitized to a 
valid SD-NAME so the documented `put` validation does not show up as a crash.
   
   The syslog targets are crash and hang coverage now, like the existing ones. 
`EncodingAppender` discards the encoded bytes, so a rendering assertion would 
need a capturing appender; I left that out to keep the targets small.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to