mirror of
https://github.com/securego/gosec.git
synced 2025-07-07 00:35:35 +02:00
Improve the SQL strings concat rules to handle multiple string concatenation
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
committed by
Cosmin Cojocar
parent
68bce94323
commit
30e93bf865
@ -1026,6 +1026,23 @@ func main(){
|
||||
panic(err)
|
||||
}
|
||||
}`}, 1, gosec.NewConfig()}, {[]string{`
|
||||
// multiple string concatenation
|
||||
package main
|
||||
import (
|
||||
"database/sql"
|
||||
"os"
|
||||
)
|
||||
func main(){
|
||||
db, err := sql.Open("sqlite3", ":memory:")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
rows, err := db.Query("SELECT * FROM foo" + "WHERE name = " + os.Args[1])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer rows.Close()
|
||||
}`}, 1, gosec.NewConfig()}, {[]string{`
|
||||
// false positive
|
||||
package main
|
||||
import (
|
||||
|
Reference in New Issue
Block a user