Skip to content

Commit 4e4d5b9

Browse files
SONARPY-2368 Update rules metadata (#2178)
1 parent 8b64d88 commit 4e4d5b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+85
-75
lines changed

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/BackticksUsage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "CODE_SMELL",
44
"code": {
55
"impacts": {
6-
"MAINTAINABILITY": "HIGH"
6+
"MAINTAINABILITY": "BLOCKER"
77
},
88
"attribute": "CONVENTIONAL"
99
},

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/ExecStatementUsage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "CODE_SMELL",
44
"code": {
55
"impacts": {
6-
"MAINTAINABILITY": "HIGH"
6+
"MAINTAINABILITY": "BLOCKER"
77
},
88
"attribute": "CONVENTIONAL"
99
},

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S1451.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "CODE_SMELL",
44
"code": {
55
"impacts": {
6-
"MAINTAINABILITY": "HIGH"
6+
"MAINTAINABILITY": "BLOCKER"
77
},
88
"attribute": "LAWFUL"
99
},

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S1845.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "CODE_SMELL",
44
"code": {
55
"impacts": {
6-
"MAINTAINABILITY": "HIGH"
6+
"MAINTAINABILITY": "BLOCKER"
77
},
88
"attribute": "IDENTIFIABLE"
99
},

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S2068.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "SECURITY_HOTSPOT",
44
"code": {
55
"impacts": {
6-
"SECURITY": "HIGH"
6+
"SECURITY": "BLOCKER"
77
},
88
"attribute": "TRUSTWORTHY"
99
},

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S2190.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "BUG",
44
"code": {
55
"impacts": {
6-
"RELIABILITY": "HIGH"
6+
"RELIABILITY": "BLOCKER"
77
},
88
"attribute": "LOGICAL"
99
},

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S2245.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
1-
<p>Using pseudorandom number generators (PRNGs) is security-sensitive. For example, it has led in the past to the following vulnerabilities:</p>
1+
<p>PRNGs are algorithms that produce sequences of numbers that only approximate true randomness. While they are suitable for applications like
2+
simulations or modeling, they are not appropriate for security-sensitive contexts because their outputs can be predictable if the internal state is
3+
known.</p>
4+
<p>In contrast, cryptographically secure pseudorandom number generators (CSPRNGs) are designed to be secure against prediction attacks. CSPRNGs use
5+
cryptographic algorithms to ensure that the generated sequences are not only random but also unpredictable, even if part of the sequence or the
6+
internal state becomes known. This unpredictability is crucial for security-related tasks such as generating encryption keys, tokens, or any other
7+
values that must remain confidential and resistant to guessing attacks.</p>
8+
<p>For example, the use of non-cryptographic PRNGs has led to vulnerabilities such as:</p>
29
<ul>
310
<li> <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-6386">CVE-2013-6386</a> </li>
411
<li> <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-3419">CVE-2006-3419</a> </li>
512
<li> <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-4102">CVE-2008-4102</a> </li>
613
</ul>
714
<p>When software generates predictable values in a context requiring unpredictability, it may be possible for an attacker to guess the next value that
8-
will be generated, and use this guess to impersonate another user or access sensitive information.</p>
15+
will be generated, and use this guess to impersonate another user or access sensitive information. Therefore, it is critical to use CSPRNGs in any
16+
security-sensitive application to ensure the robustness and security of the system.</p>
917
<h2>Ask Yourself Whether</h2>
1018
<ul>
1119
<li> the code using the generated value requires it to be unpredictable. It is the case for all encryption mechanisms or when a secret value, such
1220
as a password, is hashed. </li>
13-
<li> the function you use generates a value which can be predicted (pseudo-random). </li>
21+
<li> the function you use is a non-cryptographic PRNG. </li>
1422
<li> the generated value is used multiple times. </li>
1523
<li> an attacker can access the generated value. </li>
1624
</ul>
@@ -38,10 +46,12 @@ <h2>Sensitive Code Example</h2>
3846
</pre>
3947
<h2>See</h2>
4048
<ul>
49+
<li> OWASP - <a href="https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html#secure-random-number-generation">Secure
50+
Random Number Generation Cheat Sheet</a> </li>
4151
<li> OWASP - <a href="https://owasp.org/Top10/A02_2021-Cryptographic_Failures/">Top 10 2021 Category A2 - Cryptographic Failures</a> </li>
4252
<li> OWASP - <a href="https://owasp.org/www-project-top-ten/2017/A3_2017-Sensitive_Data_Exposure">Top 10 2017 Category A3 - Sensitive Data
4353
Exposure</a> </li>
44-
<li> <a href="https://mas.owasp.org/checklists/MASVS-CRYPTO/">Mobile AppSec Verification Standard - Cryptography Requirements</a> </li>
54+
<li> OWASP - <a href="https://mas.owasp.org/checklists/MASVS-CRYPTO/">Mobile AppSec Verification Standard - Cryptography Requirements</a> </li>
4555
<li> OWASP - <a href="https://owasp.org/www-project-mobile-top-10/2016-risks/m5-insufficient-cryptography">Mobile Top 10 2016 Category M5 -
4656
Insufficient Cryptography</a> </li>
4757
<li> CWE - <a href="https://cwe.mitre.org/data/definitions/338">CWE-338 - Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)</a>

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S2275.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "BUG",
44
"code": {
55
"impacts": {
6-
"RELIABILITY": "HIGH"
6+
"RELIABILITY": "BLOCKER"
77
},
88
"attribute": "LOGICAL"
99
},

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S2711.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "BUG",
44
"code": {
55
"impacts": {
6-
"RELIABILITY": "HIGH"
6+
"RELIABILITY": "BLOCKER"
77
},
88
"attribute": "LOGICAL"
99
},

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S2712.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "BUG",
44
"code": {
55
"impacts": {
6-
"RELIABILITY": "HIGH"
6+
"RELIABILITY": "BLOCKER"
77
},
88
"attribute": "LOGICAL"
99
},

0 commit comments

Comments
 (0)