Restructure to focus on lib rather than cli

This commit is contained in:
Grant Murphy 2017-04-26 08:08:46 -07:00
parent 8df48f9769
commit cacf21f3c0
48 changed files with 52 additions and 49 deletions

View file

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
// Package core holds the central scanning logic used by GAS // Package core holds the central scanning logic used by GAS
package core package gas
import ( import (
"go/ast" "go/ast"

View file

@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package core package gas
import ( import (
"go/ast" "go/ast"

View file

@ -1,4 +1,4 @@
package core package gas
import ( import (
"go/ast" "go/ast"

View file

@ -27,7 +27,7 @@ import (
"sort" "sort"
"strings" "strings"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
"github.com/GoASTScanner/gas/output" "github.com/GoASTScanner/gas/output"
"golang.org/x/tools/go/loader" "golang.org/x/tools/go/loader"
) )

View file

@ -17,7 +17,7 @@ package main
import ( import (
"go/ast" "go/ast"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
"github.com/GoASTScanner/gas/rules" "github.com/GoASTScanner/gas/rules"
) )

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package core package gas
import ( import (
"fmt" "fmt"

View file

@ -1,4 +1,4 @@
package core package gas
import ( import (
"go/ast" "go/ast"

View file

@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package core package gas
import ( import (
"encoding/json" "encoding/json"

View file

@ -22,7 +22,7 @@ import (
"strconv" "strconv"
plainTemplate "text/template" plainTemplate "text/template"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
// The output format for reported issues // The output format for reported issues

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package core package gas
import "go/ast" import "go/ast"

View file

@ -15,7 +15,7 @@
package rules package rules
import ( import (
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
"go/ast" "go/ast"
) )

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestBigExp(t *testing.T) { func TestBigExp(t *testing.T) {

View file

@ -18,7 +18,7 @@ import (
"go/ast" "go/ast"
"regexp" "regexp"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
// Looks for net.Listen("0.0.0.0") or net.Listen(":8080") // Looks for net.Listen("0.0.0.0") or net.Listen(":8080")

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestBind0000(t *testing.T) { func TestBind0000(t *testing.T) {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"go/ast" "go/ast"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
type BlacklistImport struct { type BlacklistImport struct {

View file

@ -13,8 +13,9 @@
package rules package rules
import ( import (
gas "github.com/GoASTScanner/gas/core"
"testing" "testing"
"github.com/GoASTScanner/gas"
) )
const initOnlyImportSrc = ` const initOnlyImportSrc = `

View file

@ -15,9 +15,10 @@
package rules package rules
import ( import (
gas "github.com/GoASTScanner/gas/core"
"go/ast" "go/ast"
"go/types" "go/types"
"github.com/GoASTScanner/gas"
) )
type NoErrorCheck struct { type NoErrorCheck struct {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestErrorsMulti(t *testing.T) { func TestErrorsMulti(t *testing.T) {

View file

@ -19,7 +19,7 @@ import (
"go/ast" "go/ast"
"strconv" "strconv"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
type FilePermissions struct { type FilePermissions struct {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestChmod(t *testing.T) { func TestChmod(t *testing.T) {

View file

@ -15,13 +15,13 @@
package rules package rules
import ( import (
gas "github.com/GoASTScanner/gas/core"
"go/ast" "go/ast"
"go/token" "go/token"
"regexp" "regexp"
"github.com/nbutton23/zxcvbn-go"
"strconv" "strconv"
"github.com/GoASTScanner/gas"
"github.com/nbutton23/zxcvbn-go"
) )
type Credentials struct { type Credentials struct {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestHardcoded(t *testing.T) { func TestHardcoded(t *testing.T) {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestHttpoxy(t *testing.T) { func TestHttpoxy(t *testing.T) {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestNosec(t *testing.T) { func TestNosec(t *testing.T) {
@ -48,7 +48,7 @@ func TestNosecBlock(t *testing.T) {
issues := gasTestRunner( issues := gasTestRunner(
`package main `package main
import ( import (
"os" "os"
"os/exec" "os/exec"
) )

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"go/ast" "go/ast"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
type WeakRand struct { type WeakRand struct {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestRandOk(t *testing.T) { func TestRandOk(t *testing.T) {
@ -27,7 +27,7 @@ func TestRandOk(t *testing.T) {
issues := gasTestRunner( issues := gasTestRunner(
` `
package main package main
import "crypto/rand" import "crypto/rand"
@ -66,7 +66,7 @@ func TestRandRenamed(t *testing.T) {
issues := gasTestRunner( issues := gasTestRunner(
` `
package main package main
import ( import (
"crypto/rand" "crypto/rand"

View file

@ -19,7 +19,7 @@ import (
"go/ast" "go/ast"
"regexp" "regexp"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
type WeakKeyStrength struct { type WeakKeyStrength struct {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestRSAKeys(t *testing.T) { func TestRSAKeys(t *testing.T) {

View file

@ -18,7 +18,7 @@ import (
"go/ast" "go/ast"
"regexp" "regexp"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
type SqlStatement struct { type SqlStatement struct {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestSQLInjectionViaConcatenation(t *testing.T) { func TestSQLInjectionViaConcatenation(t *testing.T) {

View file

@ -19,7 +19,7 @@ import (
"regexp" "regexp"
"strings" "strings"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
type Subprocess struct { type Subprocess struct {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestSubprocess(t *testing.T) { func TestSubprocess(t *testing.T) {

View file

@ -18,7 +18,7 @@ import (
"go/ast" "go/ast"
"regexp" "regexp"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
type BadTempFile struct { type BadTempFile struct {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestTempfiles(t *testing.T) { func TestTempfiles(t *testing.T) {

View file

@ -18,7 +18,7 @@ import (
"go/ast" "go/ast"
"regexp" "regexp"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
type TemplateCheck struct { type TemplateCheck struct {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestTemplateCheckSafe(t *testing.T) { func TestTemplateCheckSafe(t *testing.T) {

View file

@ -20,7 +20,7 @@ import (
"reflect" "reflect"
"regexp" "regexp"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
type InsecureConfigTLS struct { type InsecureConfigTLS struct {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestInsecureSkipVerify(t *testing.T) { func TestInsecureSkipVerify(t *testing.T) {

View file

@ -15,8 +15,9 @@
package rules package rules
import ( import (
gas "github.com/GoASTScanner/gas/core"
"go/ast" "go/ast"
"github.com/GoASTScanner/gas"
) )
type UsingUnsafe struct { type UsingUnsafe struct {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestUnsafe(t *testing.T) { func TestUnsafe(t *testing.T) {

View file

@ -18,7 +18,7 @@ import (
"strings" "strings"
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func gasTestRunner(source string, analyzer gas.Analyzer) []*gas.Issue { func gasTestRunner(source string, analyzer gas.Analyzer) []*gas.Issue {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"go/ast" "go/ast"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
type UsesWeakCryptography struct { type UsesWeakCryptography struct {

View file

@ -17,7 +17,7 @@ package rules
import ( import (
"testing" "testing"
gas "github.com/GoASTScanner/gas/core" "github.com/GoASTScanner/gas"
) )
func TestMD5(t *testing.T) { func TestMD5(t *testing.T) {

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package core package gas
import ( import (
"fmt" "fmt"