Skip to content

Commit 06eef93

Browse files
committed
Docs review suggestions
1 parent ce20c4a commit 06eef93

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

java/ql/src/Security/CWE/CWE-330/InsecureRandomness.qhelp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@
1616

1717
</overview>
1818
<recommendation>
19-
<p>
20-
Use a cryptographically secure pseudo-random number generator if the output is to be used in a
21-
security-sensitive context. As a general rule, a value should be considered "security-sensitive"
22-
if predicting it would allow the attacker to perform an action that they would otherwise be unable
23-
to perform. For example, if an attacker could predict the random password generated for a new user,
24-
they would be able to log in as that new user.
25-
</p>
26-
2719
<p>
28-
For Java, <code>java.util.Random</code> is not cryptographically secure. Use <code>java.security.SecureRandom</code> instead.
20+
The <code>java.util.Random</code> random number generator is not cryptographically secure. Use a secure random number generator such as <code>java.security.SecureRandom</code> instead.
2921
</p>
22+
<p>
23+
Use a cryptographically secure pseudo-random number generator if the output is to be used in a
24+
security-sensitive context. As a general rule, a value should be considered "security-sensitive"
25+
if predicting it would allow the attacker to perform an action that they would otherwise be unable
26+
to perform. For example, if an attacker could predict the random password generated for a new user,
27+
they would be able to log in as that new user.
28+
</p>
3029
</recommendation>
3130

3231
<example>
@@ -44,7 +43,7 @@
4443
<sample src="examples/InsecureRandomnessCookie.java" />
4544

4645
<p>
47-
In the second case, we generate a fresh cookie by appending a random integer to the end of a static
46+
In the second (GOOD) case, we generate a fresh cookie by appending a random integer to the end of a static
4847
string. The random number generator used (<code>SecureRandom</code>) is cryptographically secure,
4948
so it is not possible for an attacker to predict the generated cookie.
5049
</p>

0 commit comments

Comments
 (0)