Skip to content

Commit

Permalink
Fix kubectl-delivery security issues (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantd authored Jun 22, 2021
1 parent 336fa6d commit 53e2922
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmd/kubectl-delivery/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"io"
"os"
"path/filepath"
"strings"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -91,11 +92,15 @@ func Run(opt *options.ServerOption) error {

kubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(kubeClient, 0, kubeinformers.WithNamespace(namespace))

fp, err := os.Open(filename)
fp, err := os.Open(filepath.Clean(filename))
if err != nil {
klog.Fatalf("Error open file[%s]: %v", filename, err)
}
defer fp.Close()
defer func() {
if err := fp.Close(); err != nil {
klog.Fatalf("Error closing file[%s]: %v", filename, err)
}
}()
bufReader := bufio.NewReader(fp)
pods := []string{}

Expand Down

0 comments on commit 53e2922

Please sign in to comment.