Skip to content

Commit

Permalink
fixup! fixup! fix: correctly identify infixed concats as potential SQ…
Browse files Browse the repository at this point in the history
…L injections
  • Loading branch information
audunmo committed Jul 21, 2023
1 parent 4518383 commit 01b40ef
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions testutils/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,8 @@ func main(){
panic(err)
}
defer rows.Close()
}`}, 1, gosec.NewConfig()}, {[]string{`
}`}, 1, gosec.NewConfig()},
{[]string{`
// case insensitive match
package main
Expand All @@ -1654,7 +1655,8 @@ func main(){
panic(err)
}
defer rows.Close()
}`}, 1, gosec.NewConfig()}, {[]string{`
}`}, 1, gosec.NewConfig()},
{[]string{`
// context match
package main
Expand All @@ -1674,7 +1676,8 @@ func main(){
panic(err)
}
defer rows.Close()
}`}, 1, gosec.NewConfig()}, {[]string{`
}`}, 1, gosec.NewConfig()},
{[]string{`
// DB transaction check
package main
Expand Down Expand Up @@ -1702,7 +1705,8 @@ func main(){
if err := tx.Commit(); err != nil {
panic(err)
}
}`}, 1, gosec.NewConfig()}, {[]string{`
}`}, 1, gosec.NewConfig()},
{[]string{`
// multiple string concatenation
package main
Expand All @@ -1721,7 +1725,8 @@ func main(){
panic(err)
}
defer rows.Close()
}`}, 1, gosec.NewConfig()}, {[]string{`
}`}, 1, gosec.NewConfig()},
{[]string{`
// false positive
package main
Expand All @@ -1740,7 +1745,8 @@ func main(){
panic(err)
}
defer rows.Close()
}`}, 0, gosec.NewConfig()}, {[]string{`
}`}, 0, gosec.NewConfig()},
{[]string{`
package main
import (
Expand All @@ -1762,7 +1768,8 @@ func main(){
}
defer rows.Close()
}
`}, 0, gosec.NewConfig()}, {[]string{`
`}, 0, gosec.NewConfig()},
{[]string{`
package main
const gender = "M"
Expand All @@ -1788,7 +1795,8 @@ func main(){
}
defer rows.Close()
}
`}, 0, gosec.NewConfig()}, {[]string{`
`}, 0, gosec.NewConfig()},
{[]string{`
// ExecContext match
package main
Expand All @@ -1809,7 +1817,8 @@ func main() {
panic(err)
}
fmt.Println(result)
}`}, 1, gosec.NewConfig()}, {[]string{`
}`}, 1, gosec.NewConfig()},
{[]string{`
// Exec match
package main
Expand All @@ -1829,7 +1838,8 @@ func main() {
panic(err)
}
fmt.Println(result)
}`}, 1, gosec.NewConfig()}, {[]string{`
}`}, 1, gosec.NewConfig()},
{[]string{`
package main
import (
Expand Down

0 comments on commit 01b40ef

Please sign in to comment.