Skip to content

fix(FLEETMDM-004): fmt.Sprintf used to build log message string instead of structured key-value logging - #127

Draft
flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/fleetmdm-004-53936797-f6d23861
Draft

fix(FLEETMDM-004): fmt.Sprintf used to build log message string instead of structured key-value logging#127
flamingo[bot] wants to merge 1 commit into
mainfrom
ai-fix/fleetmdm-004-53936797-f6d23861

Conversation

@flamingo

@flamingo flamingo Bot commented Aug 24, 2026

Copy link
Copy Markdown

Closes findings from rule FLEETMDM-004 — fmt.Sprintf used to build log message string instead of structured key-value logging.

Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.

# Fix confidence Finding Location
1 🟢 92 high fmt.Sprintf used to build log message string instead of structured key-value logging server/logging/webhook.go:35

What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.


Run: https://product-hub.flamingo.so/admin/code-review
Run id: f6d23861-693f-45a1-b5b3-570aa3bc9ea7

Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.

@flamingo flamingo Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 What this fix changed, finding by finding

1 finding(s) fixed in this draft — 1 explained inline on the diff.

Comment thread server/logging/webhook.go
Comment on lines 43 to 50
)

if err := server.PostJSONWithTimeout(ctx, w.url, payload, w.logger); err != nil {
w.logger.ErrorContext(ctx, fmt.Sprintf("failed to send automation webhook to %s", server.MaskSecretURLParams(w.url)),
w.logger.ErrorContext(ctx, "failed to send automation webhook",
"url", server.MaskSecretURLParams(w.url),
"err", server.MaskURLError(err).Error(),
)
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 fmt.Sprintf used to build log message string instead of structured key-value logging

In webhookLogWriter.Write, replaced the fmt.Sprintf-interpolated error log message with a static message "failed to send automation webhook" and added "url" as a separate structured key-value pair alongside the existing "err" key; removed the now-unused "fmt" import since it was only used for this Sprintf call.

🤖 Prompt for AI agents
In server/logging/webhook.go around line 35, review and complete this code-review fix: fmt.Sprintf used to build log message string instead of structured key-value logging.
What the draft fix changed: In webhookLogWriter.Write, replaced the fmt.Sprintf-interpolated error log message with a static message "failed to send automation webhook" and added "url" as a separate structured key-value pair alongside the existing "err" key; removed the now-unused "fmt" import since it was only used for this Sprintf call.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 92 high — react 👍/👎 to teach the reviewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants