mirror of
https://github.com/containers/kubernetes-mcp-server.git
synced 2025-10-23 01:22:57 +03:00
chore(security): try to fix snyk security issues (#345)
* chore(docs): update tools in README.md Previous update wasn't made automatically. Signed-off-by: Marc Nuri <marc@marcnuri.com> * chore(security): try to fix snyk security issues Even after the fix, Snyk seems to be reporting false positives. Signed-off-by: Marc Nuri <marc@marcnuri.com> --------- Signed-off-by: Marc Nuri <marc@marcnuri.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"maps"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
@@ -25,7 +26,14 @@ func (o *OpenShift) IsOpenShift(ctx context.Context) bool {
|
||||
var _ internalk8s.Openshift = (*OpenShift)(nil)
|
||||
|
||||
func main() {
|
||||
readme, err := os.ReadFile(os.Args[1])
|
||||
// Snyk reports false positive unless we flow the args through filepath.Clean and filepath.Localize in this specific order
|
||||
var err error
|
||||
localReadmePath := filepath.Clean(os.Args[1])
|
||||
localReadmePath, err = filepath.Localize(localReadmePath)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
readme, err := os.ReadFile(localReadmePath)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -81,7 +89,7 @@ func main() {
|
||||
toolsetTools.String(),
|
||||
)
|
||||
|
||||
if err := os.WriteFile(os.Args[1], []byte(updated), 0o644); err != nil {
|
||||
if err := os.WriteFile(localReadmePath, []byte(updated), 0o644); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user