Fixed the vulnerability - Use of cryptographically weak pseudo-random number generator
Change-Id: I028798f1740dd9eb68398da6ea610f1000848417
Signed-off-by: jegan <jegan.s@tataelxsi.co.in>
import logging
import re
import secrets
-
from osm_nbi.authconn import (
Authconn,
AuthException,
from http import HTTPStatus
from uuid import uuid4
from copy import deepcopy
-from random import choice as random_choice
import smtplib
from email.message import EmailMessage
from email.mime.text import MIMEText
)
def generate_otp(self):
- otp = "".join(random_choice("0123456789") for i in range(0, 4))
+ otp = "".join(str(secrets.randbelow(10)) for i in range(0, 4))
return otp
def send_email(self, indata):