From 0f87683b3bb855a7bbc0c69b8bcf08b1df2cfaa4 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <104101892+pixeebot[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 16:23:29 +0000 Subject: [PATCH] Secure Source of Randomness --- src/codemodder/temporary.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/codemodder/temporary.py b/src/codemodder/temporary.py index 93ebf06d..e02d1c0e 100644 --- a/src/codemodder/temporary.py +++ b/src/codemodder/temporary.py @@ -1,8 +1,8 @@ -import random +import secrets -random.getrandbits(1) -random.randint(0, 9) # Sensitive -random.random() # Sensitive -random.sample(["a", "b"], 1) # Sensitive -random.choice(["a", "b"]) # Sensitive -random.choices(["a", "b"]) # Sensitive +secrets.SystemRandom().getrandbits(1) +secrets.SystemRandom().randint(0, 9) # Sensitive +secrets.SystemRandom().random() # Sensitive +secrets.SystemRandom().sample(["a", "b"], 1) # Sensitive +secrets.SystemRandom().choice(["a", "b"]) # Sensitive +secrets.SystemRandom().choices(["a", "b"]) # Sensitive