Skip to content

Commit

Permalink
gosec: justify SHA1 usage with #nosec annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
oxzi committed Oct 8, 2024
1 parent f5619fd commit 28b06b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/icingadb-migrate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"context"
"crypto/sha1"
"crypto/sha1" // #nosec G505 -- used as a non-cryptographic hash function to hash IDs
"database/sql"
_ "embed"
"encoding/hex"
Expand Down
4 changes: 2 additions & 2 deletions cmd/icingadb-migrate/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"context"
"crypto/sha1"
"crypto/sha1" // #nosec G505 -- used as a non-cryptographic hash function to hash IDs
"github.com/icinga/icinga-go-library/database"
"github.com/icinga/icinga-go-library/objectpacker"
"github.com/icinga/icinga-go-library/types"
Expand Down Expand Up @@ -54,7 +54,7 @@ var objectTypes = map[uint8]string{1: "host", 2: "service"}

// hashAny combines objectpacker.PackAny and SHA1 hashing.
func hashAny(in interface{}) []byte {
hash := sha1.New()
hash := sha1.New() // #nosec G401 -- used as a non-cryptographic hash function to hash IDs
if err := objectpacker.PackAny(in, hash); err != nil {
panic(err)
}
Expand Down

0 comments on commit 28b06b7

Please sign in to comment.