mirror of
https://github.com/securego/gosec.git
synced 2025-06-16 23:47:51 +02:00
Update hardcoded_credentials.go fix: adaper equal expr which const value at left (#917)
* Update hardcoded_credentials.go adaper equal expr which const value at left. ``` if "Tr0ub4dour_UPL&&LOlo" == pwd ``` * Update hardcoded_credentials.go check ident not equal nil * adapter const == key hardcoded, add testcases
This commit is contained in:
@ -113,6 +113,17 @@ package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var password string
|
||||
if "f62e5bcda4fae4f82370da0c6f20697b8f8447ef" == password {
|
||||
fmt.Println("password equality")
|
||||
}
|
||||
}`}, 1, gosec.NewConfig()},
|
||||
{[]string{`
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var password string
|
||||
if password != "f62e5bcda4fae4f82370da0c6f20697b8f8447ef" {
|
||||
@ -124,6 +135,17 @@ package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var password string
|
||||
if "f62e5bcda4fae4f82370da0c6f20697b8f8447ef" != password {
|
||||
fmt.Println("password equality")
|
||||
}
|
||||
}`}, 1, gosec.NewConfig()},
|
||||
{[]string{`
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var p string
|
||||
if p != "f62e5bcda4fae4f82370da0c6f20697b8f8447ef" {
|
||||
@ -135,6 +157,17 @@ package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var p string
|
||||
if "f62e5bcda4fae4f82370da0c6f20697b8f8447ef" != p {
|
||||
fmt.Println("password equality")
|
||||
}
|
||||
}`}, 0, gosec.NewConfig()},
|
||||
{[]string{`
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
const (
|
||||
pw = "KjasdlkjapoIKLlka98098sdf012U/rL2sLdBqOHQUlt5Z6kCgKGDyCFA=="
|
||||
)
|
||||
|
Reference in New Issue
Block a user