Skip to content

Commit

Permalink
tighten up plugin-finding logic
Browse files Browse the repository at this point in the history
  • Loading branch information
squeed committed Jan 19, 2021
1 parent 77cd8fe commit 456d99d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/invoke/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
)

// FindInPath returns the full path of the plugin by searching in the provided path
Expand All @@ -26,6 +27,10 @@ func FindInPath(plugin string, paths []string) (string, error) {
return "", fmt.Errorf("no plugin name provided")
}

if strings.ContainsRune(plugin, os.PathSeparator) {
return "", fmt.Errorf("invalid plugin name: %s", plugin)
}

if len(paths) == 0 {
return "", fmt.Errorf("no paths provided")
}
Expand Down

0 comments on commit 456d99d

Please sign in to comment.