gosec: G505, G401 - crypto/sha1 module

Disabling G505 and G401 gosec rules on specific lines on
internal/storage/storage.go to be able to use sha1 algorithm.
This commit is contained in:
Juan Abia 2021-12-01 12:20:15 +01:00 committed by Alexander Todorov
parent eb3fa3e5d4
commit b9f1ccbdf1

View file

@ -4,6 +4,8 @@ package store
import (
"crypto/rand"
// The use of SHA1 is valid here
/* #nosec G505 */
"crypto/sha1"
"encoding/hex"
"errors"
@ -90,6 +92,8 @@ func New(stateDir *string, arch distro.Arch, log *log.Logger) *Store {
}
func randomSHA1String() (string, error) {
// The use of SHA1 is accepted here
/* #nosec G401 */
hash := sha1.New()
data := make([]byte, 20)
n, err := rand.Read(data)