laforge submitted this change.

View Change

Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified
param_source: use secrets.SystemRandom as secure random nr source

secrets.SystemRandom is defined as the most secure random source
available on the given operating system.

Change-Id: I8049cd1292674b3ced82b0926569128535af6efe
Jenkins: skip-card-test
---
M pySim/esim/saip/param_source.py
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pySim/esim/saip/param_source.py b/pySim/esim/saip/param_source.py
index d3c98a6..7caf848 100644
--- a/pySim/esim/saip/param_source.py
+++ b/pySim/esim/saip/param_source.py
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

-import random
+import secrets
import re
from osmocom.utils import b2h

@@ -124,7 +124,7 @@
return "%0*d" % (self.num_digits, val) # pylint: disable=consider-using-f-string

class RandomSourceMixin:
- random_impl = random.SystemRandom()
+ random_impl = secrets.SystemRandom()

class RandomDigitSource(DecimalRangeSource, RandomSourceMixin):
"""return a different sequence of random decimal digits each"""

To view, visit change 40830. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I8049cd1292674b3ced82b0926569128535af6efe
Gerrit-Change-Number: 40830
Gerrit-PatchSet: 10
Gerrit-Owner: neels <nhofmeyr@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>