Coverity(phase2)-CWE 330: Use of Insufficiently Random Values 79/14279/6
authorAdurti <adurti.v@tataelxsi.co.in>
Thu, 28 Mar 2024 11:14:53 +0000 (11:14 +0000)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 12 Dec 2024 15:47:05 +0000 (16:47 +0100)
Added fix for CWE 330: Use of Insufficiently Random Value (Cryptographically weak PRNG)

Change-Id: Iddd9dc85a5be84371c8d6afb47d4571f67af3468
Signed-off-by: Adurti <adurti.v@tataelxsi.co.in>
attic/run_test.py

index b7768ba..2c247c5 100755 (executable)
@@ -24,7 +24,7 @@ import yaml
 # import json
 # import tarfile
 from time import sleep
-from random import randint
+import random
 import os
 from sys import stderr
 from uuid import uuid4
@@ -2353,7 +2353,7 @@ class TestDeploy:
                 headers = headers_yaml
             else:
                 headers = headers_zip_yaml
-            if randint(0, 1) == 0:
+            if random.SystemRandom().randint(0, 1) == 0:
                 # vnfd CREATE AND UPLOAD in one step:
                 engine.test(
                     "Onboard VNFD in one step",
@@ -2431,7 +2431,7 @@ class TestDeploy:
         else:
             headers = headers_zip_yaml
 
-        if randint(0, 1) == 0:
+        if random.SystemRandom().randint(0, 1) == 0:
             # nsd CREATE AND UPLOAD in one step:
             engine.test(
                 "Onboard NSD in one step",