From 58370774bc874f97aadf0d753c06aab9d0f7b30f Mon Sep 17 00:00:00 2001 From: Diana Devasia Date: Tue, 12 Mar 2024 10:07:40 -0400 Subject: [PATCH] Trying to add the nosec comment on the line its used as mentioned in the docs to verify if that works. --- toxics/slicer.go | 4 ++-- toxics/toxic.go | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/toxics/slicer.go b/toxics/slicer.go index 8b54ecc6..1ba2a27d 100644 --- a/toxics/slicer.go +++ b/toxics/slicer.go @@ -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) diff --git a/toxics/toxic.go b/toxics/toxic.go index 9f90b7bd..36fc660b 100644 --- a/toxics/toxic.go +++ b/toxics/toxic.go @@ -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 toxic.Pipe(s) } else { new(NoopToxic).Pipe(s)