Skip to content

Commit

Permalink
Add security notice to be shown after install and upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusweig committed Aug 22, 2019
1 parent 739c312 commit e7d2a07
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
12 changes: 8 additions & 4 deletions cmd/krew/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ import (
"fmt"
"os"

"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/cobra"

"sigs.k8s.io/krew/pkg/constants"
"sigs.k8s.io/krew/pkg/index"
"sigs.k8s.io/krew/pkg/index/indexscanner"
"sigs.k8s.io/krew/pkg/index/validation"
"sigs.k8s.io/krew/pkg/installation"

"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)

func init() {
Expand Down Expand Up @@ -148,6 +149,9 @@ Remarks:
}
return ensureIndexUpdated(cmd, args)
},
PostRun: func(_ *cobra.Command, args []string) {
fmt.Fprintln(os.Stderr, constants.SecurityNotice)
},
}

manifest = installCmd.Flags().String("manifest", "", "(Development-only) specify plugin manifest directly.")
Expand Down
10 changes: 7 additions & 3 deletions cmd/krew/cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ import (
"fmt"
"os"

"sigs.k8s.io/krew/pkg/index/indexscanner"
"sigs.k8s.io/krew/pkg/installation"

"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/spf13/cobra"

"sigs.k8s.io/krew/pkg/constants"
"sigs.k8s.io/krew/pkg/index/indexscanner"
"sigs.k8s.io/krew/pkg/installation"
)

func init() {
Expand Down Expand Up @@ -81,6 +82,9 @@ kubectl krew upgrade foo bar"`,
}
return ensureIndexUpdated(cmd, args)
},
PostRun: func(_ *cobra.Command, args []string) {
fmt.Fprintln(os.Stderr, constants.SecurityNotice)
},
}

noUpdateIndex = upgradeCmd.Flags().Bool("no-update-index", false, "(Experimental) do not update local copy of plugin index before upgrading")
Expand Down
5 changes: 5 additions & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ const (

// IndexURI points to the upstream index.
IndexURI = "https://github.com/kubernetes-sigs/krew-index.git"

SecurityNotice = `
>> Plugins do not undergo any kind of security validation.
>> Please keep in mind that you are running these plugins at your own risk.
`
)

0 comments on commit e7d2a07

Please sign in to comment.