GeezerVison is showing github.com — Prevent the ANSI appender and %aspnet-request dropping events by FreeAndNil · Pull Request #316 · apache/logging-log4net
Conversation
FreeAndNil
commented
Sep 3, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Both findings let content the application logged make log4net discard the whole
event. That is worse than log injection: the sender chooses what is not
recorded.
- f029
AnsiColorTerminalAppender. The branch meant for a one-character
message read message[0] without checking there was one, so an event that
rendered to nothing threw and AppenderSkeleton swallowed it. The reset codes
now go at one computed offset, leaving no short-message branch to get wrong.
- f019
%aspnet-request. Reading HttpRequest.Params runs ASP.NET request
validation on first access, so a request carrying <script> threw inside the
layout and the event was discarded. The converter reads through
HttpRequest.Unvalidated, which keeps the content instead of degrading the
field to NOT AVAILABLE. The try now also covers the body parse and
ServerVariables, two further paths that could throw there.
Two changelog-only commits ride along: every 3.5.0 entry now credits the fixer
per CLAUDE.md, and the Ext.Mail and remote-syslog entries cite the findings
behind them. Those touch entries owned by #313, #314 and #315.
Tests: f029 pins all ten line-break branches. f019 adds five, net462 only, so
they run on the Windows leg alone.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
FreeAndNil
added a commit
that referenced
this pull request
Sep 3, 2026
#316
- Reading HttpRequest.Params validates the query string, form and cookies on
first access, so a request carrying <script> threw inside the layout and
AppenderSkeleton discarded the whole event: a sender could suppress the log
record of their own request.
- The converter now reads through HttpRequest.Unvalidated, so the content is
kept rather than replaced by the not-available marker.
- The try now also covers the body parse and ServerVariables, which throw on an
oversized body or a lost client. Verified on Windows: with no worker request
behind it, ServerVariables is empty rather than throwing.
- Five tests, net462 only, so they run on the Windows leg alone. Reverting the
fix fails exactly the two that assert the content survives.
audit da18b6f-f019
FreeAndNil
added a commit
that referenced
this pull request
Sep 3, 2026
- Logging an empty message threw IndexOutOfRangeException: the branch meant for
a one-character message read message[0] without checking there was one.
- AppenderSkeleton caught it, so the event simply disappeared.
- The reset codes now go at one computed offset, leaving no short-message branch
to get wrong.
- All ten line-break cases are pinned by test. They carry explicit names because
dotnet test --filter cannot see them otherwise; CLAUDE.md records why.
audit da18b6f-f029
FreeAndNil
added a commit
that referenced
this pull request
Sep 3, 2026
#316
- Reading HttpRequest.Params validates the query string, form and cookies on
first access, so a request carrying <script> threw inside the layout and
AppenderSkeleton discarded the whole event: a sender could suppress the log
record of their own request.
- The converter now reads through HttpRequest.Unvalidated, so the content is
kept rather than replaced by the not-available marker.
- The try now also covers the body parse and ServerVariables, which throw on an
oversized body or a lost client. Verified on Windows: with no worker request
behind it, ServerVariables is empty rather than throwing.
- Five tests, net462 only, so they run on the Windows leg alone. Reverting the
fix fails exactly the two that assert the content survives.
audit da18b6f-f019
FreeAndNil
added a commit
that referenced
this pull request
Sep 3, 2026
- Logging an empty message threw IndexOutOfRangeException: the branch meant for
a one-character message read message[0] without checking there was one.
- AppenderSkeleton caught it, so the event simply disappeared.
- The reset codes now go at one computed offset, leaving no short-message branch
to get wrong.
- All ten line-break cases are pinned by test. They carry explicit names because
dotnet test --filter cannot see them otherwise; CLAUDE.md records why.
audit da18b6f-f029
FreeAndNil
added a commit
that referenced
this pull request
Sep 3, 2026
#316
- Reading HttpRequest.Params validates the query string, form and cookies on
first access, so a request carrying <script> threw inside the layout and
AppenderSkeleton discarded the whole event: a sender could suppress the log
record of their own request.
- The converter now reads through HttpRequest.Unvalidated, so the content is
kept rather than replaced by the not-available marker.
- The try now also covers the body parse and ServerVariables, which throw on an
oversized body or a lost client. Verified on Windows: with no worker request
behind it, ServerVariables is empty rather than throwing.
- Five tests, net462 only, so they run on the Windows leg alone. Reverting the
fix fails exactly the two that assert the content survives.
audit da18b6f-f019
FreeAndNil
changed the title
Feature/316 content loss
Prevent the ANSI appender and %aspnet-request dropping events (#316)
Sep 3, 2026
FreeAndNil
changed the title
Prevent the ANSI appender and %aspnet-request dropping events (#316)
Prevent the ANSI appender and %aspnet-request dropping events
Sep 3, 2026
- Logging an empty message threw IndexOutOfRangeException: the branch meant for
a one-character message read message[0] without checking there was one.
- AppenderSkeleton caught it, so the event simply disappeared.
- The reset codes now go at one computed offset, leaving no short-message branch
to get wrong.
- All ten line-break cases are pinned by test. They carry explicit names because
dotnet test --filter cannot see them otherwise; CLAUDE.md records why.
audit da18b6f-f029
#316
- Reading HttpRequest.Params validates the query string, form and cookies on
first access, so a request carrying <script> threw inside the layout and
AppenderSkeleton discarded the whole event: a sender could suppress the log
record of their own request.
- The converter now reads through HttpRequest.Unvalidated, so the content is
kept rather than replaced by the not-available marker.
- The try now also covers the body parse and ServerVariables, which throw on an
oversized body or a lost client. Verified on Windows: with no worker request
behind it, ServerVariables is empty rather than throwing.
- Five tests, net462 only, so they run on the Windows leg alone. Reverting the
fix fails exactly the two that assert the content survives.
audit da18b6f-f019
CLAUDE.md wants the description to close with both sides, who raised it and who
did the work. Eleven entries named only the audit finding. Nothing but the
attribution changed.
The Ext.Mail send rework answers f004 and the remote syslog queue and pump work
answers f034, but neither pair named the finding. The other five 314 and 315
entries stay unattributed: they are our own, not audit findings.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 1, 2026
This was referenced Nov 12, 2026
This was referenced Nov 19, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|