You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use strings.NewReplacer as CodeQL-recognized sanitizer for log injection (CWE-117)
Replace custom byte-level loop with package-level strings.NewReplacer
variable (logSanitizer). CodeQL explicitly recognizes strings.Replacer.Replace
as a sanitizer for go/log-injection since github/codeql#11910.
Call logSanitizer.Replace() directly at each log site.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
// If keepAlive is enabled, disable scale-to-zero and log the event
312
297
ifkeepAlive {
313
-
safeName:=sanitizeLogValue(name)
314
-
safeCommand:=sanitizeLogValue(command)
315
298
iferr:=blaxel.ScaleDisable(); err!=nil {
316
-
logrus.Warnf("[KeepAlive] Failed to disable scale-to-zero for process %s (name: %s): %v", process.PID, safeName, err)
299
+
logrus.Warnf("[KeepAlive] Failed to disable scale-to-zero for process %s (name: %s): %v", process.PID, logSanitizer.Replace(name), err)
317
300
}
318
301
iftimeout>0 {
319
-
logrus.Infof("[KeepAlive] Started process %s (name: %s, command: %s) with timeout %ds", process.PID, safeName, safeCommand, timeout)
302
+
logrus.Infof("[KeepAlive] Started process %s (name: %s, command: %s) with timeout %ds", process.PID, logSanitizer.Replace(name), logSanitizer.Replace(command), timeout)
320
303
} else {
321
-
logrus.Infof("[KeepAlive] Started process %s (name: %s, command: %s) with infinite timeout", process.PID, safeName, safeCommand)
304
+
logrus.Infof("[KeepAlive] Started process %s (name: %s, command: %s) with infinite timeout", process.PID, logSanitizer.Replace(name), logSanitizer.Replace(command))
logrus.Warnf("[KeepAlive] Failed to enable scale-to-zero after killing process %s (name: %s): %v", process.PID, sanitizeLogValue(process.Name), err)
995
+
logrus.Warnf("[KeepAlive] Failed to enable scale-to-zero after killing process %s (name: %s): %v", process.PID, logSanitizer.Replace(process.Name), err)
0 commit comments