Address code review feedback: improve validation patterns and escaping

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-08 15:27:29 +00:00
co-authored by whyour
parent 0a2d7b1597
commit d20e154f21
4 changed files with 9 additions and 147 deletions
+3 -2
View File
@@ -646,8 +646,9 @@ export default class CronService {
private escapeShellArg(arg: string): string {
if (!arg) return "''";
// Remove newlines and normalize whitespace
arg = arg.replace(/\r?\n/g, ';').trim();
// Remove newlines to prevent creating command chains
// Replace with space to maintain token separation
arg = arg.replace(/\r?\n/g, ' ').trim();
// Use single quotes and escape any single quotes within
// This is the most secure way to pass arbitrary strings to shell