Skip to content

Commit d4d2e37

Browse files
Update rule metadata to prepare v3.3 (#897)
1 parent 72d2482 commit d4d2e37

Some content is hidden

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

49 files changed

+236
-199
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"constantCost": "1min"
88
},
99
"tags": [
10-
"style"
10+
"convention"
1111
],
1212
"defaultSeverity": "Major",
1313
"ruleSpecification": "RSPEC-122",

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ <h2>Compliant Solution</h2>
5858
print(e)
5959
</pre>
6060
<h2>See</h2>
61-
<p> * Python Documentation - <a href="https://docs.python.org/3/reference/compound_stmts.html#the-try-statement">The <code>try</code>
62-
statement</a></p>
61+
<ul>
62+
<li> Python Documentation - <a href="https://docs.python.org/3/reference/compound_stmts.html#the-try-statement">The <code>try</code> statement</a>
63+
</li>
64+
</ul>
6365

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ <h2>Compliant Solution</h2>
8484
</pre>
8585
<h2>See</h2>
8686
<ul>
87-
<li> PEP 352 <del></del> <a href="https://www.python.org/dev/peps/pep-0352/#exception-hierarchy-changes">Required Superclass for Exceptions</a>
88-
</li>
87+
<li> PEP 352 - <a href="https://www.python.org/dev/peps/pep-0352/#exception-hierarchy-changes">Required Superclass for Exceptions</a> </li>
8988
<li> Python Documentation - <a href="https://docs.python.org/3/library/exceptions.html#BaseException">Built-in exceptions</a> </li>
9089
<li> <a href="http://cwe.mitre.org/data/definitions/397.html">MITRE, CWE-397</a> - Declaration of Throws for Generic Exception </li>
9190
<li> <a href="https://wiki.sei.cmu.edu/confluence/x/_DdGBQ">CERT, ERR07-J.</a> - Do not throw RuntimeException, Exception, or Throwable </li>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<p>Some tools such as Git work better when files end with an empty line. This rule simply generates an issue if it is missing.</p>
22
<p>For example, a Git diff looks like this if the empty line is missing at the end of the file:</p>
3-
<p>&lt;pre&gt;</p>
4-
<p>+class Test:</p>
5-
<p>+ pass</p>
6-
<p> \ No newline at end of file</p>
7-
<p>&lt;/pre&gt;</p>
3+
<pre>
4+
+class Test:
5+
+ pass
6+
\ No newline at end of file
7+
</pre>
88

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ <h2>Noncompliant Code Example</h2>
5555
raise ValueError()
5656
finally:
5757
continue # Noncompliant
58-
5958
</pre>
6059
<h2>Compliant Solution</h2>
6160
<pre>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ <h2>Compliant Solution</h2>
5151
</pre>
5252
<h2>See</h2>
5353
<ul>
54-
<li> <a href="https://docs.python.org/3.8/tutorial/classes.html#private-variables">Python documentation <del></del> Private Variables</a> </li>
55-
<li> <a href="https://www.python.org/dev/peps/pep-0008/#designing-for-inheritance">PEP8 <del></del> Designing for Inheritance</a> </li>
54+
<li> <a href="https://docs.python.org/3.8/tutorial/classes.html#private-variables">Python documentation Private Variables</a> </li>
55+
<li> <a href="https://www.python.org/dev/peps/pep-0008/#designing-for-inheritance">PEP8 Designing for Inheritance</a> </li>
5656
</ul>
5757

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ <h2>Noncompliant Code Example</h2>
1212
class MyClass:
1313
def mymethod1(self, foo="Noncompliant"):
1414
pass
15-
1615
</pre>
1716
<h2>Compliant Solution</h2>
1817
<pre>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<li> <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9802">CVE-2017-9802</a> </li>
55
</ul>
66
<p>Some APIs enable the execution of dynamic code by providing it as strings at runtime. These APIs might be useful in some very specific
7-
meta-programming use-cases. However most of the time their use is frowned upon as they also increase the risk of <a
8-
href="https://www.owasp.org/index.php/Code_Injection">Injected Code</a>. Such attacks can either run on the server or in the client (exemple: XSS
7+
meta-programming use-cases. However most of the time their use is frowned upon because they also increase the risk of maliciously <a
8+
href="https://www.owasp.org/index.php/Code_Injection">Injected Code</a>. Such attacks can either run on the server or in the client (example: XSS
99
attack) and have a huge impact on an application's security.</p>
1010
<p>This rule marks for review each occurrence of such dynamic code execution. This rule does not detect code injections. It only highlights the use of
1111
APIs which should be used sparingly and very carefully.</p>

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,20 @@
77
"constantCost": "30min"
88
},
99
"tags": [
10-
10+
"cwe",
11+
"owasp-a1"
1112
],
1213
"defaultSeverity": "Critical",
1314
"ruleSpecification": "RSPEC-1523",
1415
"sqKey": "S1523",
15-
"scope": "Main"
16+
"scope": "Main",
17+
"securityStandards": {
18+
"CWE": [
19+
95,
20+
470
21+
],
22+
"OWASP": [
23+
"A1"
24+
]
25+
}
1626
}

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
<p>In cryptography, "salt" is extra piece of data which is included in a hashing algorithm. It makes dictionary attacks more difficult. Using a
2-
cryptographic hash function without an unpredictable salt increases the likelihood that an attacker will be able to successfully guess a hashed value
3-
such as a password with a dictionary attack.</p>
4-
<p>This rule raises an issue when a hashing function which has been specifically designed for hashing sensitive data, such as PBKDF2, is used with a
5-
non-random, reused or too short salt value. It does not raise an issue on base hashing algorithms such as sha1 or md5 as these are often used for
6-
other purposes.</p>
1+
<p>In cryptography, a "salt" is an extra piece of data which is included when hashing a password. This makes <code>rainbow-table attacks</code> more
2+
difficult. Using a cryptographic hash function without an unpredictable salt increases the likelihood that an attacker could successfully find the
3+
hash value in databases of precomputed hashes (called <code>rainbow-tables</code>).</p>
4+
<p>This rule raises an issue when a hashing function which has been specifically designed for hashing passwords, such as <code>PBKDF2</code>, is used
5+
with a non-random, reused or too short salt value. It does not raise an issue on base hashing algorithms such as <code>sha1</code> or <code>md5</code>
6+
as they should not be used to hash passwords.</p>
77
<h2>Recommended Secure Coding Practices</h2>
88
<ul>
9-
<li> Use hashing functions generating their own salt or generate a long random salt of at least 32 bytes. </li>
10-
<li> The salt is at least as long as the resulting hash value. </li>
11-
<li> Provide the salt to a safe hashing function such as PBKDF2. </li>
12-
<li> Save both the salt and the hashed value in the relevant database record; during future validation operations, the salt and hash can then be
13-
retrieved from the database. The hash is recalculated with the stored salt and the value being validated, and the result compared to the stored
14-
hash. </li>
9+
<li> Use hashing functions generating their own secure salt or generate a secure random value of at least 16 bytes. </li>
10+
<li> The salt should be unique by user password. </li>
1511
</ul>
1612
<h2>Noncompliant Code Example</h2>
1713
<p>hashlib</p>

0 commit comments

Comments
 (0)