mirror of
https://github.com/securego/gosec.git
synced 2025-11-25 22:22:17 +02:00
Adding a config block to the analyzer, parsed from JSON
A CLI option can now be given to tell GAS it should parse data from a JSON file. Fatal errors are given if the file is not readable or is not valid JSON.
This commit is contained in:
@@ -21,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSQLInjectionViaConcatenation(t *testing.T) {
|
||||
analyzer := gas.NewAnalyzer(false, nil)
|
||||
analyzer := gas.NewAnalyzer(false, nil, nil)
|
||||
analyzer.AddRule(NewSqlStrConcat())
|
||||
|
||||
source := `
|
||||
@@ -48,7 +48,7 @@ func TestSQLInjectionViaConcatenation(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSQLInjectionViaIntepolation(t *testing.T) {
|
||||
analyzer := gas.NewAnalyzer(false, nil)
|
||||
analyzer := gas.NewAnalyzer(false, nil, nil)
|
||||
analyzer.AddRule(NewSqlStrFormat())
|
||||
|
||||
source := `
|
||||
@@ -77,7 +77,7 @@ func TestSQLInjectionViaIntepolation(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSQLInjectionFalsePositiveA(t *testing.T) {
|
||||
analyzer := gas.NewAnalyzer(false, nil)
|
||||
analyzer := gas.NewAnalyzer(false, nil, nil)
|
||||
analyzer.AddRule(NewSqlStrConcat())
|
||||
analyzer.AddRule(NewSqlStrFormat())
|
||||
|
||||
@@ -112,7 +112,7 @@ func TestSQLInjectionFalsePositiveA(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSQLInjectionFalsePositiveB(t *testing.T) {
|
||||
analyzer := gas.NewAnalyzer(false, nil)
|
||||
analyzer := gas.NewAnalyzer(false, nil, nil)
|
||||
analyzer.AddRule(NewSqlStrConcat())
|
||||
analyzer.AddRule(NewSqlStrFormat())
|
||||
|
||||
@@ -147,7 +147,7 @@ func TestSQLInjectionFalsePositiveB(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSQLInjectionFalsePositiveC(t *testing.T) {
|
||||
analyzer := gas.NewAnalyzer(false, nil)
|
||||
analyzer := gas.NewAnalyzer(false, nil, nil)
|
||||
analyzer.AddRule(NewSqlStrConcat())
|
||||
analyzer.AddRule(NewSqlStrFormat())
|
||||
|
||||
@@ -182,7 +182,7 @@ func TestSQLInjectionFalsePositiveC(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSQLInjectionFalsePositiveD(t *testing.T) {
|
||||
analyzer := gas.NewAnalyzer(false, nil)
|
||||
analyzer := gas.NewAnalyzer(false, nil, nil)
|
||||
analyzer.AddRule(NewSqlStrConcat())
|
||||
analyzer.AddRule(NewSqlStrFormat())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user