Skip to content

Commit

Permalink
Trying to add the nosec comment on the line its used as mentioned in …
Browse files Browse the repository at this point in the history
…the docs to verify if that works.
  • Loading branch information
dianadevasia committed Mar 12, 2024
1 parent f495a8f commit 5837077
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions toxics/slicer.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func (t *SlicerToxic) chunk(start int, end int) []int {
}

mid := start + (end-start)/2
// #nosec G404 -- was ignored before too

if t.SizeVariation > 0 {
mid += rand.Intn(t.SizeVariation*2) - t.SizeVariation
mid += rand.Intn(t.SizeVariation*2) - t.SizeVariation // #nosec G404 -- was ignored before too
}
left := t.chunk(start, mid)
right := t.chunk(mid, end)
Expand Down
3 changes: 1 addition & 2 deletions toxics/toxic.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ func NewToxicStub(input <-chan *stream.StreamChunk, output chan<- *stream.Stream
func (s *ToxicStub) Run(toxic *ToxicWrapper) {
s.running = make(chan struct{})
defer close(s.running)
// #nosec G404 -- was ignored before too
if rand.Float32() < toxic.Toxicity {
if rand.Float32() < toxic.Toxicity { // #nosec G404 -- was ignored before too

Check failure on line 84 in toxics/toxic.go

View workflow job for this annotation

GitHub Actions / linting

G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)
toxic.Pipe(s)
} else {
new(NoopToxic).Pipe(s)
Expand Down

0 comments on commit 5837077

Please sign in to comment.