azure-functions-host icon indicating copy to clipboard operation
azure-functions-host copied to clipboard

Fixing formattedMessage bug

Open RohitRanjanMS opened this issue 1 year ago • 2 comments

Fixing formattedMessage sanitize logic.

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • [x] Backporting to the in-proc branch is not required
    • Otherwise: Link to backporting PR
  • [x] My changes do not require documentation changes
    • [ ] Otherwise: Documentation issue linked to PR
  • [x] My changes should not be added to the release notes for the next release
    • [ ] Otherwise: I've added my notes to release_notes.md
  • [x] My changes do not need to be backported to a previous version
    • [ ] Otherwise: Backport tracked by issue/PR #issue_or_pr
  • [x] My changes do not require diagnostic events changes
    • Otherwise: I have added/updated all related diagnostic events and their documentation (Documentation issue linked to PR)
  • [ ] I have added all required tests (Unit tests, E2E tests)

Additional information

Additional PR information

RohitRanjanMS avatar Oct 22 '24 16:10 RohitRanjanMS

We need to ensure that formattedMessage has either a value or empty string. Sanitizer.Sanitize checks that and we will return early if formattedMessage is one of those so LGTM!

The sanitize only happens if there is an exception. We need to ensure it is non-null in other scenarios.

jviau avatar Oct 22 '24 17:10 jviau

We need to ensure that formattedMessage has either a value or empty string. Sanitizer.Sanitize checks that and we will return early if formattedMessage is one of those so LGTM!

The sanitize only happens if there is an exception. We need to ensure it is non-null in other scenarios.

Reading it now, it doesn't say what I wanted to say 🥲. I mean that Sanitizer.Sanitize checks that and that we also return early here, so we should be covered:

https://github.com/Azure/azure-functions-host/blob/351083550777eadf9fe793823ea03d7be1c33e00/src/WebJobs.Script.WebHost/Diagnostics/SystemLogger.cs#L122-L125

cjaliaga avatar Oct 22 '24 18:10 cjaliaga