Repository navigation
Conversation
…format string
Request and response content was concatenated into the message template
passed to ILogger.Log, flagged by CodeQL cs/log-forging. The content now
travels as the {LogMessage} argument of a constant template; rendered
output is unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Hi @senrecep, a follow-up question on this one before I open anything. I agree that stripping CR/LF would corrupt the logged bodies. I tried a variant that escapes them instead of stripping: The rest of the change:
Why I think it might be worth it beyond the scanner:
Branch with tests (test-first; 82/82 logging tests green): https://github.com/kathelon/CSharpEssentials/tree/fix/logging-log-forging Would you be open to a PR with this approach, possibly behind an option if you'd rather not change the default output? If the one-line-body trade-off is a no-go, no problem; I'll drop it. |
Closes the two CodeQL
cs/log-forgingalerts (#7, #8) from #146 item A.LoggerFactoryLogWriter: when the creator returns no values, content is logged as the argument of constant template{LogMessage}.LogMessage.Log(level, msg)with no args does not format, so this was a scanner/hygiene fix, not a runtime bug.🤖 Generated with Claude Code