mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 13:40:44 +00:00
fix(security): align QQBot log sanitizer with CodeQL
Aligns QQBot debug log newline removal with the CodeQL js/log-injection sanitizer model to close alert 232.
This commit is contained in:
@@ -42,20 +42,20 @@ function formatDebugLogArgs(args: unknown[]): string {
|
||||
/** Debug-level log; only outputs when QQBOT_DEBUG is enabled. */
|
||||
export function debugLog(...args: unknown[]): void {
|
||||
if (isDebug()) {
|
||||
console.log(formatDebugLogArgs(args).replace(/[\r\n]/g, " "));
|
||||
console.log(formatDebugLogArgs(args).replace(/\n|\r/g, ""));
|
||||
}
|
||||
}
|
||||
|
||||
/** Debug-level warning; only outputs when QQBOT_DEBUG is enabled. */
|
||||
export function debugWarn(...args: unknown[]): void {
|
||||
if (isDebug()) {
|
||||
console.warn(formatDebugLogArgs(args).replace(/[\r\n]/g, " "));
|
||||
console.warn(formatDebugLogArgs(args).replace(/\n|\r/g, ""));
|
||||
}
|
||||
}
|
||||
|
||||
/** Debug-level error; only outputs when QQBOT_DEBUG is enabled. */
|
||||
export function debugError(...args: unknown[]): void {
|
||||
if (isDebug()) {
|
||||
console.error(formatDebugLogArgs(args).replace(/[\r\n]/g, " "));
|
||||
console.error(formatDebugLogArgs(args).replace(/\n|\r/g, ""));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user