mirror of
https://github.com/securego/gosec.git
synced 2024-12-24 11:35:52 +00:00
Restructure to focus on lib rather than cli
This commit is contained in:
parent
8df48f9769
commit
cacf21f3c0
48 changed files with 52 additions and 49 deletions
|
@ -13,7 +13,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
// Package core holds the central scanning logic used by GAS
|
||||
package core
|
||||
package gas
|
||||
|
||||
import (
|
||||
"go/ast"
|
|
@ -11,7 +11,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package core
|
||||
package gas
|
||||
|
||||
import (
|
||||
"go/ast"
|
|
@ -1,4 +1,4 @@
|
|||
package core
|
||||
package gas
|
||||
|
||||
import (
|
||||
"go/ast"
|
|
@ -27,7 +27,7 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
"github.com/GoASTScanner/gas/output"
|
||||
"golang.org/x/tools/go/loader"
|
||||
)
|
|
@ -17,7 +17,7 @@ package main
|
|||
import (
|
||||
"go/ast"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
"github.com/GoASTScanner/gas/rules"
|
||||
)
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package core
|
||||
package gas
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -1,4 +1,4 @@
|
|||
package core
|
||||
package gas
|
||||
|
||||
import (
|
||||
"go/ast"
|
|
@ -11,7 +11,7 @@
|
|||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
package core
|
||||
package gas
|
||||
|
||||
import (
|
||||
"encoding/json"
|
|
@ -22,7 +22,7 @@ import (
|
|||
"strconv"
|
||||
plainTemplate "text/template"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
// The output format for reported issues
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package core
|
||||
package gas
|
||||
|
||||
import "go/ast"
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
package rules
|
||||
|
||||
import (
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
"go/ast"
|
||||
)
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestBigExp(t *testing.T) {
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"go/ast"
|
||||
"regexp"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
// Looks for net.Listen("0.0.0.0") or net.Listen(":8080")
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestBind0000(t *testing.T) {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"go/ast"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
type BlacklistImport struct {
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
package rules
|
||||
|
||||
import (
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"testing"
|
||||
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
const initOnlyImportSrc = `
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
package rules
|
||||
|
||||
import (
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"go/ast"
|
||||
"go/types"
|
||||
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
type NoErrorCheck struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestErrorsMulti(t *testing.T) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"go/ast"
|
||||
"strconv"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
type FilePermissions struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestChmod(t *testing.T) {
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
package rules
|
||||
|
||||
import (
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"go/ast"
|
||||
"go/token"
|
||||
"regexp"
|
||||
|
||||
"github.com/nbutton23/zxcvbn-go"
|
||||
"strconv"
|
||||
|
||||
"github.com/GoASTScanner/gas"
|
||||
"github.com/nbutton23/zxcvbn-go"
|
||||
)
|
||||
|
||||
type Credentials struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestHardcoded(t *testing.T) {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestHttpoxy(t *testing.T) {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestNosec(t *testing.T) {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"go/ast"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
type WeakRand struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestRandOk(t *testing.T) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"go/ast"
|
||||
"regexp"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
type WeakKeyStrength struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestRSAKeys(t *testing.T) {
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"go/ast"
|
||||
"regexp"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
type SqlStatement struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestSQLInjectionViaConcatenation(t *testing.T) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
type Subprocess struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestSubprocess(t *testing.T) {
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"go/ast"
|
||||
"regexp"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
type BadTempFile struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestTempfiles(t *testing.T) {
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"go/ast"
|
||||
"regexp"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
type TemplateCheck struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestTemplateCheckSafe(t *testing.T) {
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
"reflect"
|
||||
"regexp"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
type InsecureConfigTLS struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestInsecureSkipVerify(t *testing.T) {
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
package rules
|
||||
|
||||
import (
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"go/ast"
|
||||
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
type UsingUnsafe struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestUnsafe(t *testing.T) {
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func gasTestRunner(source string, analyzer gas.Analyzer) []*gas.Issue {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"go/ast"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
type UsesWeakCryptography struct {
|
||||
|
|
|
@ -17,7 +17,7 @@ package rules
|
|||
import (
|
||||
"testing"
|
||||
|
||||
gas "github.com/GoASTScanner/gas/core"
|
||||
"github.com/GoASTScanner/gas"
|
||||
)
|
||||
|
||||
func TestMD5(t *testing.T) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package core
|
||||
package gas
|
||||
|
||||
import (
|
||||
"fmt"
|
Loading…
Reference in a new issue