fix(bash): treat background & as a command separator in allowlist mode (S1)
This commit is contained in:
1 parent
34435736c5
commit
a5f21d3a2c
2 files changed
+41
-4
No files matched your search
+6
-4
@@ -132,10 +132,12 @@ func extractCommands(cmd string) []string {
|
||||
// Find the earliest operator
|
||||
minIdx := len(remaining)
|
||||
opLen := 0
|
||||
for _, op := range []string{"&&", "||", "|", ";"} {
|
||||
if idx := strings.Index(remaining, op); idx != -1 && idx < minIdx {
|
||||
minIdx = idx
|
||||
opLen = len(op)
|
||||
for _, op := range []string{"&&", "||", "|", ";", "&"} {
|
||||
if idx := strings.Index(remaining, op); idx != -1 {
|
||||
if idx < minIdx || (idx == minIdx && len(op) > opLen) {
|
||||
minIdx = idx
|
||||
opLen = len(op)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user