Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardening suggestions for probabilityguesser-tk / test #4

Open
wants to merge 1 commit into
base: test
Choose a base branch
from

Conversation

pixeebot[bot]
Copy link

@pixeebot pixeebot bot commented Mar 29, 2024

I've reviewed the recently opened PR (3 - Add files via upload) and have identified some area(s) that could benefit from additional hardening measures.

These changes should help prevent potential security vulnerabilities and improve overall code quality.

Thank you for your consideration!

docs | feedback
Powered by: pixeebot

@pixeebot pixeebot bot requested a review from vivipu March 29, 2024 05:33
@@ -17,29 +17,29 @@ def click():
output.insert(END, calculateScore(guess, probability))

def coinToss():
rng = random.randint(1, 20)
rng = secrets.SystemRandom().randint(1, 20)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace random.{func} with more secure secrets library functions.

if (rng % 4 == 0):
fair = True
else:
fair = False
if not fair:
rng = random.randint(1, 20)
rng = secrets.SystemRandom().randint(1, 20)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace random.{func} with more secure secrets library functions.

if (rng % 2 == 0):
range_lower = True
else:
range_lower = False
if not range_lower:
probability = random.randint(60, 80)
probability = secrets.SystemRandom().randint(60, 80)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace random.{func} with more secure secrets library functions.

else:
probability = random.randint(20, 40)
probability = secrets.SystemRandom().randint(20, 40)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace random.{func} with more secure secrets library functions.

else:
probability = 50

heads_dist = numpy.array(0)
heads = 0
for i in range(1,1000):
for j in range(1,30):
comparison = random.randint(1, 100)
comparison = secrets.SystemRandom().randint(1, 100)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace random.{func} with more secure secrets library functions.

@@ -52,7 +52,7 @@ def coinToss():


#seed rng
random.seed()
secrets.SystemRandom().seed()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace random.{func} with more secure secrets library functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants