From: selvi.j Date: Thu, 27 Apr 2023 06:53:45 +0000 (+0000) Subject: Coverity-CWE 330: Use of Insufficiently Random Values X-Git-Tag: release-v14.0-start~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F95%2F13295%2F2;p=osm%2FN2VC.git Coverity-CWE 330: Use of Insufficiently Random Values Added fix for CWE 330: Use of Insufficiently Random Value (Cryptographically weak PRNG) Change-Id: I927c9d22ca42b01f6ec1fe9fc41e4b962167b72f Signed-off-by: selvi.j --- diff --git a/n2vc/k8s_helm_base_conn.py b/n2vc/k8s_helm_base_conn.py index 2a588b4..a897e0e 100644 --- a/n2vc/k8s_helm_base_conn.py +++ b/n2vc/k8s_helm_base_conn.py @@ -1962,7 +1962,7 @@ class K8sHelmBaseConnector(K8sConnector): self._init_paths_env(cluster_name=cluster_id, create_if_not_exist=True) def get_random_number(): - r = random.randrange(start=1, stop=99999999) + r = random.SystemRandom().randint(1, 99999999) s = str(r) while len(s) < 10: s = "0" + s @@ -2028,7 +2028,7 @@ class K8sHelmBaseConnector(K8sConnector): name += "-" def get_random_number(): - r = random.randrange(start=1, stop=99999999) + r = random.SystemRandom().randint(1, 99999999) s = str(r) s = s.rjust(10, "0") return s