mirror of
https://github.com/coredns/coredns.git
synced 2025-12-31 14:01:22 -05:00
chore(lint): enable gosec (#7792)
Enable "gosec" linter.
Exclude:
- All G115 (integer overflow) findings, to be fixed separately.
Add targeted gosec annotations for:
- non-crypto math/rand usage
- md5 used only for file change detection
- G114 ("net/http serve with no timeout settings"), to be fixed
separately.
Other findings fixed.
Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
@@ -36,7 +36,7 @@ func (c Chaos) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (
|
||||
default:
|
||||
return plugin.NextOrFailure(c.Name(), c.Next, ctx, w, r)
|
||||
case "authors.bind.":
|
||||
rnd := rand.New(rand.NewSource(time.Now().Unix()))
|
||||
rnd := rand.New(rand.NewSource(time.Now().Unix())) // #nosec G404 -- non-cryptographic randomness for shuffling authors.
|
||||
|
||||
for _, i := range rnd.Perm(len(c.Authors)) {
|
||||
m.Answer = append(m.Answer, &dns.TXT{Hdr: hdr, Txt: []string{c.Authors[i]}})
|
||||
|
||||
Reference in New Issue
Block a user