Coverity-CWE 330: Use of Insufficiently Random Values (137944 Cryptographically weak... 94/13294/2
authork4.rahul <rahul.k4@tataelxsi.co.in>
Thu, 27 Apr 2023 06:38:48 +0000 (12:08 +0530)
committercubag <gcuba@whitestack.com>
Mon, 22 May 2023 20:49:11 +0000 (22:49 +0200)
replaced SystemRandom().randint() instead of randint()

Change-Id: I02dd1387b795c856d0cd05d0366b7bb410016a8b
Signed-off-by: k4.rahul <rahul.k4@tataelxsi.co.in>
osm_lcm/ns.py

index 305b70b..28979b2 100644 (file)
@@ -124,7 +124,7 @@ from copy import copy, deepcopy
 from time import time
 from uuid import uuid4
 
-from random import randint
+from random import SystemRandom
 
 __author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
 
@@ -7557,7 +7557,7 @@ class NsLcm(LcmBase):
                 not isinstance(job.get("job_name"), str)
                 or vnfr_id not in job["job_name"]
             ):
-                job["job_name"] = vnfr_id + "_" + str(randint(1, 10000))
+                job["job_name"] = vnfr_id + "_" + str(SystemRandom().randint(1, 10000))
             job["nsr_id"] = nsr_id
             job["vnfr_id"] = vnfr_id
         return job_list