Skip to content

Commit

Permalink
Fixes gosec errors (#1665)
Browse files Browse the repository at this point in the history
* Fixes `_test_plugins` type redeclation
* Excludes `G402` `gosec` due to securego/gosec#551 and securego/gosec#528

Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov authored Jan 4, 2021
1 parent 7a390bd commit db7d0dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ staticcheck: $(SOURCES)
# G101 find by variable name match "oauth" are not hardcoded credentials
# G104 ignoring errors are in few cases fine
# G304 reading kubernetes secret filepaths are not a file inclusions
# G402 See https://github.com/securego/gosec/issues/551 and https://github.com/securego/gosec/issues/528
gosec: $(SOURCES)
GO111MODULE=$(GO111) .bin/gosec -quiet -exclude="G101,G104,G304" ./...
GO111MODULE=$(GO111) .bin/gosec -quiet -exclude="G101,G104,G304,G402" ./...

fmt: $(SOURCES)
@gofmt -w -s $(SOURCES)
Expand Down
10 changes: 5 additions & 5 deletions _test_plugins/multitype_noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ import (
"github.com/zalando/skipper/routing"
)

type noopSpec struct {
type multiSpec struct {
Type string
}

func InitPlugin(opts []string) ([]filters.Spec, []routing.PredicateSpec, []routing.DataClient, error) {
return []filters.Spec{noopSpec{"noop"}}, []routing.PredicateSpec{noopSpec{"None"}}, nil, nil
return []filters.Spec{multiSpec{"noop"}}, []routing.PredicateSpec{multiSpec{"None"}}, nil, nil
}

func (s noopSpec) Name() string {
func (s multiSpec) Name() string {
return s.Type
}

func (s noopSpec) CreateFilter(config []interface{}) (filters.Filter, error) {
func (s multiSpec) CreateFilter(config []interface{}) (filters.Filter, error) {
return noop{}, nil
}

func (s noopSpec) Create(config []interface{}) (routing.Predicate, error) {
func (s multiSpec) Create(config []interface{}) (routing.Predicate, error) {
return noop{}, nil
}

Expand Down

0 comments on commit db7d0dc

Please sign in to comment.