Skip to content

Hardening suggestions for Python / master#4

Open
pixeebot[bot] wants to merge 2 commits into
masterfrom
pixeebot/master
Open

Hardening suggestions for Python / master#4
pixeebot[bot] wants to merge 2 commits into
masterfrom
pixeebot/master

Conversation

@pixeebot
Copy link
Copy Markdown

@pixeebot pixeebot Bot commented Jan 29, 2024

I've reviewed the recently opened PR (3 - Example) 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 brusoth09 January 29, 2024 22:01

def fisher_yates_shuffle(data: list) -> list:
for _ in range(len(list)):
a = random.randint(0, len(list) - 1)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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

def fisher_yates_shuffle(data: list) -> list:
for _ in range(len(list)):
a = random.randint(0, len(list) - 1)
b = random.randint(0, len(list) - 1)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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

"Both the weights and values vectors must be either lists or tuples"
)

num_items = len(wt)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Replaces multiple expressions involving if operator with 'walrus' operator.

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.

1 participant