From 385ab379d5ec55fc33d1077d10784bec622c6c56 Mon Sep 17 00:00:00 2001 From: Diana Devasia Date: Tue, 12 Mar 2024 10:18:36 -0400 Subject: [PATCH] Abstracting it to a variable to verify if nosec comment applies. --- toxics/toxic.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toxics/toxic.go b/toxics/toxic.go index 9f90b7bd..df4d6716 100644 --- a/toxics/toxic.go +++ b/toxics/toxic.go @@ -81,8 +81,8 @@ 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 { + randomToxicity := rand.Float32() // #nosec G404 -- was ignored before too + if randomToxicity < toxic.Toxicity { toxic.Pipe(s) } else { new(NoopToxic).Pipe(s)