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]andwhyour committed 2026-02-08 15:27:29 +00:00
1 parent 0a2d7b1597
commit d20e154f21
4 files changed
+9 -147

No files matched your search

+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