fix(exec): extract absolute paths after equals sign in shell guard (#4594)

This commit is contained in:
AxelRay
2026-07-23 23:58:01 +08:00
committed by GitHub
parent 7e9426d9bd
commit 78f4c132d9
2 changed files with 24 additions and 2 deletions
+2 -2
View File
@@ -918,6 +918,6 @@ class ExecTool(Tool):
r"(?<![A-Za-z])(?:[A-Za-z]:[^\s\"'|><;]*|\\\\[^\s\"'|><;]+(?:\\[^\s\"'|><;]+)*)",
command
)
posix_paths = re.findall(r"(?:^|[\s|>'\"])(/[^\s\"'>;|<]+)", command) # POSIX: /absolute only
home_paths = re.findall(r"(?:^|[\s>'\"])(~[^\s\"'>;|<]*)", command) # POSIX/Windows home shortcut: ~
posix_paths = re.findall(r"(?:^|[\s|>='\"])(/[^\s\"'>;|<]+)", command) # POSIX: /absolute only
home_paths = re.findall(r"(?:^|[\s>='\"])(~[/+][^\s\"'>;|<]*)", command) # POSIX/Windows home shortcut: ~/ or ~+
return win_paths + posix_paths + home_paths