Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint: replace math/rand.Read with crypto/rand.Read #118

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ on:
pull_request:

permissions:
# Required: allow read access to the content for analysis.
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
pull-requests: read
# Optional: allow write access to checks to allow the action to annotate code in the PR.
checks: write

jobs:
golangci:
Expand All @@ -21,10 +24,10 @@ jobs:
matrix:
go: ['1.19', '1.20']
steps:
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Format
run: go fmt
Expand All @@ -33,7 +36,7 @@ jobs:
run: go vet

- name: lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
#with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
#version: v1.29
Expand Down
3 changes: 2 additions & 1 deletion v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package proxyproto
import (
"bufio"
"bytes"
iorand "crypto/rand"
"encoding/binary"
"math/rand"
"reflect"
Expand Down Expand Up @@ -51,7 +52,7 @@ var (
fixtureUnixV2 = append(lengthUnixBytes, fixtureUnixAddress...)
fixtureTLV = func() []byte {
tlv := make([]byte, 2+rand.Intn(1<<12)) // Not enough to overflow, at least size two
rand.Read(tlv)
_, _ = iorand.Read(tlv)
return tlv
}()
fixtureIPv4V2TLV = fixtureWithTLV(lengthV4Bytes, fixtureIPv4Address, fixtureTLV)
Expand Down
Loading