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

updating random number generation to use more secure window.crypto class #688

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

polatengin
Copy link
Collaborator

No description provided.

@polatengin polatengin self-assigned this Feb 22, 2024
@@ -43,7 +44,7 @@
createdDate: new Date(),
createdByProfileImage: 'testProfileImageSource',
userIdRef: "user-ref-uuid",
timerSecs: Math.floor(Math.random() * 60),
timerSecs: window.crypto.getRandomValues(new Uint32Array(1))[0] % 10,

Check failure

Code scanning / CodeQL

Creating biased random numbers from a cryptographically secure source High

Using modulo on a
cryptographically secure random number
produces biased results.
@@ -193,7 +194,7 @@
isMainItem: false
},
userIdRef: "user-ref-uuid",
timerSecs: Math.floor(Math.random() * 60),
timerSecs: window.crypto.getRandomValues(new Uint32Array(1))[0] % 10,

Check failure

Code scanning / CodeQL

Creating biased random numbers from a cryptographically secure source High

Using modulo on a
cryptographically secure random number
produces biased results.
@@ -219,7 +220,7 @@
createdByProfileImage: 'testProfileImageSource',
groupedItemProps: testGroupedItemPropsTwo,
userIdRef: "user-ref-uuid",
timerSecs: Math.floor(Math.random() * 60),
timerSecs: window.crypto.getRandomValues(new Uint32Array(1))[0] % 10,

Check failure

Code scanning / CodeQL

Creating biased random numbers from a cryptographically secure source High

Using modulo on a
cryptographically secure random number
produces biased results.
@@ -26,7 +26,8 @@
export const testColumnUuidOne = "mocked-column-uuid-one";
export const testColumnUuidTwo = "mocked-column-uuid-two";
export const testColumnTwoTitle = 'Test Feedback Column Two';
export const testUpvotes = Math.floor(Math.random() * 10);
export const testUpvotes = window.crypto.getRandomValues(new Uint32Array(1))[0] % 10;

Check failure

Code scanning / CodeQL

Creating biased random numbers from a cryptographically secure source High

Using modulo on a
cryptographically secure random number
produces biased results.
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