Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion internal/detector/registry_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func readRegistryInstallInfo(_ context.Context, _ executor.Executor, appName str
}

displayName, _, _ := sk.GetStringValue("DisplayName")
if !strings.Contains(strings.ToLower(displayName), lowerAppName) {
if !strings.HasPrefix(strings.ToLower(displayName), lowerAppName) {
_ = sk.Close()
continue
}
Expand Down
15 changes: 7 additions & 8 deletions internal/detector/shellcmd.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package detector

import (
"strings"
"strconv"

"github.com/step-security/dev-machine-guard/internal/executor"
"github.com/step-security/dev-machine-guard/internal/model"
)

// platformShellQuote quotes a string for use in a shell command.
// On Unix: single quotes with escaping.
// On Windows: double quotes with escaping.
// On Unix: uses strconv.Quote for safe quoting.
// On Windows: uses strconv.Quote for safe quoting.
func platformShellQuote(exec executor.Executor, s string) string {
if exec.GOOS() == model.PlatformWindows {
return `"` + strings.ReplaceAll(s, `"`, `\"`) + `"`
}
return "'" + strings.ReplaceAll(s, "'", "'\\''") + "'"
}
_ = exec
_ = model.PlatformWindows
return strconv.Quote(s)
}