Skip to content

Commit

Permalink
Handle properly the gosec module version v2
Browse files Browse the repository at this point in the history
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
  • Loading branch information
ccojocar authored and Cosmin Cojocar committed Apr 6, 2020
1 parent e946c8c commit c6e10af
Show file tree
Hide file tree
Showing 45 changed files with 69 additions and 163 deletions.
6 changes: 3 additions & 3 deletions analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"os"
"strings"

"github.com/securego/gosec"
"github.com/securego/gosec/rules"
"github.com/securego/gosec/v2"
"github.com/securego/gosec/v2/rules"
"golang.org/x/tools/go/packages"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/securego/gosec/testutils"
"github.com/securego/gosec/v2/testutils"
)

var _ = Describe("Analyzer", func() {
Expand Down
4 changes: 2 additions & 2 deletions call_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/securego/gosec"
"github.com/securego/gosec/testutils"
"github.com/securego/gosec/v2"
"github.com/securego/gosec/v2/testutils"
)

var _ = Describe("Call List", func() {
Expand Down
6 changes: 3 additions & 3 deletions cmd/gosec/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
"sort"
"strings"

"github.com/securego/gosec"
"github.com/securego/gosec/output"
"github.com/securego/gosec/rules"
"github.com/securego/gosec/v2"
"github.com/securego/gosec/v2/output"
"github.com/securego/gosec/v2/rules"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion cmd/gosec/sort_issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"sort"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type sortBySeverity []*gosec.Issue
Expand Down
2 changes: 1 addition & 1 deletion cmd/tlsconfig/header_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ package {{.}}
import (
"go/ast"
"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)
`))
2 changes: 1 addition & 1 deletion config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

var _ = Describe("Configuration", func() {
Expand Down
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
module github.com/securego/gosec
module github.com/securego/gosec/v2

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.3.2 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/kr/pty v1.1.8 // indirect
github.com/lib/pq v1.2.0 // indirect
github.com/lib/pq v1.3.0 // indirect
github.com/mozilla/tls-observatory v0.0.0-20200317151703-4fa42e1c2dee
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d
github.com/onsi/ginkgo v1.12.0
github.com/onsi/gomega v1.9.0
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.4.0 // indirect
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/tools v0.0.0-20200331202046-9d5940d49312
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
Expand Down
107 changes: 8 additions & 99 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/securego/gosec"
"github.com/securego/gosec/testutils"
"github.com/securego/gosec/v2"
"github.com/securego/gosec/v2/testutils"
)

var _ = Describe("Helpers", func() {
Expand Down
4 changes: 2 additions & 2 deletions import_tracker_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package gosec_test

import (
"github.com/securego/gosec"
"github.com/securego/gosec/testutils"
"github.com/securego/gosec/v2"
"github.com/securego/gosec/v2/testutils"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
Expand Down
6 changes: 3 additions & 3 deletions issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/securego/gosec"
"github.com/securego/gosec/rules"
"github.com/securego/gosec/testutils"
"github.com/securego/gosec/v2"
"github.com/securego/gosec/v2/rules"
"github.com/securego/gosec/v2/testutils"
)

var _ = Describe("Issue", func() {
Expand Down
2 changes: 1 addition & 1 deletion output/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"strings"
plainTemplate "text/template"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
"gopkg.in/yaml.v2"
)

Expand Down
2 changes: 1 addition & 1 deletion output/formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/securego/gosec"
"github.com/securego/gosec/v2"
"gopkg.in/yaml.v2"
)

Expand Down
9 changes: 4 additions & 5 deletions output/junit_xml_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
htmlLib "html"
"strconv"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type junitXMLReport struct {
Expand Down Expand Up @@ -43,11 +43,10 @@ func generatePlaintext(issue *gosec.Issue) string {
func groupDataByRules(data *reportInfo) map[string][]*gosec.Issue {
groupedData := make(map[string][]*gosec.Issue)
for _, issue := range data.Issues {
if _, ok := groupedData[issue.What]; ok {
groupedData[issue.What] = append(groupedData[issue.What], issue)
} else {
groupedData[issue.What] = []*gosec.Issue{issue}
if _, ok := groupedData[issue.What]; !ok {
groupedData[issue.What] = []*gosec.Issue{}
}
groupedData[issue.What] = append(groupedData[issue.What], issue)
}
return groupedData
}
Expand Down
2 changes: 1 addition & 1 deletion output/sonarqube_format.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package output

import "github.com/securego/gosec"
import "github.com/securego/gosec/v2"

type textRange struct {
StartLine int `json:"startLine"`
Expand Down
4 changes: 2 additions & 2 deletions resolve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/securego/gosec"
"github.com/securego/gosec/testutils"
"github.com/securego/gosec/v2"
"github.com/securego/gosec/v2/testutils"
)

var _ = Describe("Resolve ast node to concrete value", func() {
Expand Down
2 changes: 1 addition & 1 deletion rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type mockrule struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"go/ast"
"go/types"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type archive struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/bad_defer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"go/ast"
"strings"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type deferType struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"go/ast"
"regexp"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

// Looks for net.Listen("0.0.0.0") or net.Listen(":8080")
Expand Down
2 changes: 1 addition & 1 deletion rules/blacklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"go/ast"
"strings"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type blacklistedImport struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/decompression-bomb.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"
"go/ast"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type decompressionBombCheck struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"go/ast"
"go/types"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type noErrorCheck struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/fileperms.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"go/ast"
"strconv"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type filePermissions struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/hardcoded_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"strconv"

zxcvbn "github.com/nbutton23/zxcvbn-go"
"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type credentials struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/integer_overflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"
"go/ast"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type integerOverflowCheck struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package rules
import (
"go/ast"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type pprofCheck struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/rand.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package rules
import (
"go/ast"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type weakRand struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/readfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"go/ast"
"go/types"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type readfile struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/rsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"
"go/ast"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type weakKeyStrength struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/rulelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package rules

import "github.com/securego/gosec"
import "github.com/securego/gosec/v2"

// RuleDefinition contains the description of a rule and a mechanism to
// create it.
Expand Down
6 changes: 3 additions & 3 deletions rules/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"github.com/securego/gosec"
"github.com/securego/gosec/rules"
"github.com/securego/gosec/testutils"
"github.com/securego/gosec/v2"
"github.com/securego/gosec/v2/rules"
"github.com/securego/gosec/v2/testutils"
)

var _ = Describe("gosec rules", func() {
Expand Down
2 changes: 1 addition & 1 deletion rules/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"go/ast"
"regexp"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type sqlStatement struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package rules
import (
"go/ast"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type sshHostKey struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/ssrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"go/ast"
"go/types"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type ssrf struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/subproc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"go/ast"
"go/types"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type subprocess struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/tempfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"go/ast"
"regexp"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type badTempFile struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package rules
import (
"go/ast"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type templateCheck struct {
Expand Down
2 changes: 1 addition & 1 deletion rules/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"go/ast"

"github.com/securego/gosec"
"github.com/securego/gosec/v2"
)

type insecureConfigTLS struct {
Expand Down
Loading

0 comments on commit c6e10af

Please sign in to comment.