Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions internal/normalizer/normalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ func classifyShellRisk(command string) action.RiskLevel {
}
}

// Check read-only patterns: command must START with one of these.
for _, prefix := range readOnlyCommands {
if strings.HasPrefix(trimmed, prefix) {
// Check read-only patterns: command must be exactly the token or start with
// "<token> " (space boundary) to avoid matching longer commands that share a
// prefix (e.g. "catalog_tool" matching "cat", "finder.sh" matching "find").
for _, cmd := range readOnlyCommands {
if trimmed == cmd || strings.HasPrefix(trimmed, cmd+" ") {
return action.RiskReadOnly
}
}
Expand Down
Loading