Skip to content

Commit a0bd0e5

Browse files
authored
Use SHA256 instead of SHA1 in oss-fuzz to resolve gosec warning. (#1194)
1 parent 6cccf9f commit a0bd0e5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmd/build-oss-fuzz-corpus/main.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
// not use this file except in compliance with the License. You may obtain
55
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
66

7+
// Entry point for the MongoDB Go Driver integration into the Google "oss-fuzz" project
8+
// (https://github.com/google/oss-fuzz).
79
package main
810

911
import (
1012
"archive/zip"
11-
"crypto/sha1"
13+
"crypto/sha256"
1214
"encoding/json"
1315
"fmt"
1416
"io/ioutil"
@@ -80,7 +82,9 @@ func seedExtJSON(zw *zip.Writer, extJSON string, extJSONType string, desc string
8082
log.Fatalf("failed to convert JSON to bytes: %v", err)
8183
}
8284

83-
zipFile := fmt.Sprintf("%x", sha1.Sum(jbytes))
85+
// Use a SHA256 hash of the BSON bytes for the filename. This isn't an oss-fuzz requirement, it
86+
// just simplifies file naming.
87+
zipFile := fmt.Sprintf("%x", sha256.Sum256(jbytes))
8488

8589
f, err := zw.Create(zipFile)
8690
if err != nil {

0 commit comments

Comments
 (0)