Conversation
PR Reviewer Guide 🔍
|
| if (receiptLoadTraker < config.receiptLoadTrakerLimit) { | ||
| if (config.workerProcessesDebugLog) | ||
| console.log(`Receipt load is below the limit: ${receiptLoadTraker}/${config.receiptLoadTrakerLimit}`) | ||
| Logger.workerProcessLogger.debug(`Receipt load is below the limit: ${receiptLoadTraker}/${config.receiptLoadTrakerLimit}`) |
Check warning
Code scanning / CodeQL
Log injection
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI over 1 year ago
To fix the log injection issue, we need to sanitize the user-provided values before logging them. Specifically, we should remove any newline characters from the config.receiptLoadTrakerLimit value before it is included in the log message. This can be done using String.prototype.replace to ensure no line endings are present in the user input.
| @@ -50,4 +50,6 @@ | ||
| if (receiptLoadTraker < config.receiptLoadTrakerLimit) { | ||
| if (config.workerProcessesDebugLog) | ||
| Logger.workerProcessLogger.debug(`Receipt load is below the limit: ${receiptLoadTraker}/${config.receiptLoadTrakerLimit}`) | ||
| if (config.workerProcessesDebugLog) { | ||
| const sanitizedLimit = String(config.receiptLoadTrakerLimit).replace(/\n|\r/g, ""); | ||
| Logger.workerProcessLogger.debug(`Receipt load is below the limit: ${receiptLoadTraker}/${sanitizedLimit}`) | ||
| } | ||
| // Kill the extra workers from the end of the array |
| "saveConsoleOutput": true, | ||
| "dir": "archiver-logs", | ||
| "files": { "main": "", "fatal": "", "net": "" }, | ||
| "files": { "main": "", "fatal": "", "net": "", "workerProcess": "" }, |
There was a problem hiding this comment.
Can we give the name as workerHandler instead? I think since it's more about the debug logs by the main process handling the worker processes.
No description provided.