mirror of
https://github.com/securego/gosec.git
synced 2025-03-19 21:08:30 +02:00
28 lines
388 B
Go
28 lines
388 B
Go
|
package testutils
|
||
|
|
||
|
import "github.com/securego/gosec/v2"
|
||
|
|
||
|
var (
|
||
|
// SampleCodeG403 - weak key strength
|
||
|
SampleCodeG403 = []CodeSample{
|
||
|
{[]string{`
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"crypto/rand"
|
||
|
"crypto/rsa"
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
//Generate Private Key
|
||
|
pvk, err := rsa.GenerateKey(rand.Reader, 1024)
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
}
|
||
|
fmt.Println(pvk)
|
||
|
}
|
||
|
`}, 1, gosec.NewConfig()},
|
||
|
}
|
||
|
)
|