mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 09:45:36 +08:00
Address code review feedback: improve validation patterns and escaping
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
1 parent
0a2d7b1597
commit
d20e154f21
4 files changed
+9
-147
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user