Skip to content

Commit 3e252cd

Browse files
Potential fix for code scanning alert no. 16: Log entries created from user input
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent d3c365e commit 3e252cd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Services/MqttCoordinator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ public async Task EnqueueAsync(string topic, string? payload, bool retain = fals
270270
}
271271
catch (Exception ex)
272272
{
273-
_logger.LogError(ex, "Failed to enqueue MQTT message to {Topic}", topic);
273+
var sanitizedTopic = topic.Replace(Environment.NewLine, "").Replace("\n", "").Replace("\r", "");
274+
_logger.LogError(ex, "Failed to enqueue MQTT message to {Topic}", sanitizedTopic);
274275
throw;
275276
}
276277
}

0 commit comments

Comments
 (0)