(command string)
| 289 | } |
| 290 | |
| 291 | func checkZshDangerous(command string) []SecurityFinding { |
| 292 | target := ExtractQuotedContent(command).FullyUnquoted |
| 293 | var findings []SecurityFinding |
| 294 | for _, token := range strings.Fields(target) { |
| 295 | base := token |
| 296 | if idx := strings.LastIndex(base, "/"); idx >= 0 { |
| 297 | base = base[idx+1:] |
| 298 | } |
| 299 | if zshDangerousCommands[base] { |
| 300 | findings = append(findings, SecurityFinding{ |
| 301 | ID: CheckZshDangerousCommands, |
| 302 | Description: "Zsh dangerous command: " + base, |
| 303 | }) |
| 304 | } |
| 305 | } |
| 306 | return findings |
| 307 | } |
| 308 | |
| 309 | func checkShellMetacharacters(command string) []SecurityFinding { |
| 310 | target := ExtractQuotedContent(command).FullyUnquoted |
no test coverage detected