refactor(shell): move path boundary guard after safe-path check

This commit is contained in:
李龙 0668001470 2026-03-16 09:16:34 +08:00
parent 3981a1a58e
commit 1c62971dc3

View file

@ -407,10 +407,6 @@ func (t *ExecTool) guardCommand(command, cwd string) string {
}
}
if !isPathBoundary(cmd, loc[0]) {
continue
}
p, err := filepath.Abs(raw)
if err != nil {
continue
@ -420,6 +416,10 @@ func (t *ExecTool) guardCommand(command, cwd string) string {
continue
}
if !isPathBoundary(cmd, loc[0]) {
continue
}
rel, err := filepath.Rel(cwdPath, p)
if err != nil {
continue