Skip to content

Commit cf6a026

Browse files
Update rule metadata to prepare v3.21 (#1315)
1 parent 87a8d30 commit cf6a026

File tree

9 files changed

+49
-42
lines changed

9 files changed

+49
-42
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,13 @@ <h2>Compliant Solution</h2>
4545
<h2>See</h2>
4646
<ul>
4747
<li> <a href="https://owasp.org/Top10/A02_2021-Cryptographic_Failures/">OWASP Top 10 2021 Category A2</a> - Cryptographic Failures </li>
48-
<li> <a href="https://owasp.org/www-project-top-ten/2017/A6_2017-Security_Misconfiguration">OWASP Top 10 2017 Category A6</a> - Security
49-
Misconfiguration </li>
48+
<li> <a href="https://www.owasp.org/index.php/Top_10-2017_A3-Sensitive_Data_Exposure">OWASP Top 10 2017 Category A3</a> - Sensitive Data Exposure
49+
</li>
5050
<li> <a href="https://mobile-security.gitbook.io/masvs/security-requirements/0x08-v3-cryptography_verification_requirements">Mobile AppSec
5151
Verification Standard</a> - Cryptography Requirements </li>
5252
<li> <a href="https://owasp.org/www-project-mobile-top-10/2016-risks/m5-insufficient-cryptography">OWASP Mobile Top 10 2016 Category M5</a> -
5353
Insufficient Cryptography </li>
5454
<li> <a href="https://cwe.mitre.org/data/definitions/329">MITRE, CWE-329</a> - Not Using an Unpredictable IV with CBC Mode </li>
55-
<li> <a href="https://cwe.mitre.org/data/definitions/330">MITRE, CWE-330</a> - Use of Insufficiently Random Values </li>
56-
<li> <a href="https://cwe.mitre.org/data/definitions/340">MITRE, CWE-340</a> - Generation of Predictable Numbers or Identifiers </li>
57-
<li> <a href="https://cwe.mitre.org/data/definitions/1204">MITRE, CWE-1204</a> - Generation of Weak Initialization Vector (IV) </li>
5855
<li> <a href="https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf">NIST, SP-800-38A</a> - Recommendation for Block Cipher
5956
Modes of Operation </li>
6057
</ul>

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"tags": [
1010
"cwe",
11-
"owasp-a6",
11+
"owasp-a3",
1212
"owasp-m5"
1313
],
1414
"defaultSeverity": "Critical",
@@ -17,13 +17,10 @@
1717
"scope": "Main",
1818
"securityStandards": {
1919
"CWE": [
20-
329,
21-
330,
22-
340,
23-
1204
20+
329
2421
],
2522
"OWASP": [
26-
"A6"
23+
"A3"
2724
],
2825
"OWASP Mobile": [
2926
"M5"

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<p>It is recommended to enforce TLS 1.2 as the minimum protocol version and to disallow older versions like TLS 1.0. Failure to do so could open the
44
door to downgrade attacks: a malicious actor who is able to intercept the connection could modify the requested protocol version and downgrade it to a
55
less secure version.</p>
6+
<p>In most cases, using the default system configuration is not compliant. Indeed, an application might get deployed on a wide range of systems with
7+
different configurations. While using a system’s default value might be safe on modern up-to-date systems, this might not be the case on older
8+
systems. It is therefore recommended to explicitly set a safe configuration in every case.</p>
69
<h2>Noncompliant Code Example</h2>
710
<pre>
811
from OpenSSL import SSL
@@ -41,12 +44,14 @@ <h2>Compliant Solution</h2>
4144
<pre>
4245
from OpenSSL import SSL
4346

44-
SSL.Context(SSL.TLSv1_2_METHOD)
47+
context = SSL.Context(SSL.TLS_SERVER_METHOD)
48+
context.set_min_proto_version(SSL.TLS1_3_VERSION)
4549
</pre>
4650
<pre>
4751
import ssl
4852

49-
ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
53+
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
54+
context.minimum_version = ssl.TLSVersion.TLSv1_3
5055
</pre>
5156
<p>For <a href="https://docs.aws.amazon.com/cdk/api/v1/python/aws_cdk.aws_apigateway/DomainName.html">aws_cdk.aws_apigateway.DomainName</a>:</p>
5257
<pre>

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
<p>Clear-text protocols such as <code>ftp</code>, <code>telnet</code> or non-secure <code>http</code> lack encryption of transported data, as well as
2-
the capability to build an authenticated connection. It means that an attacker able to sniff traffic from the network can read, modify or corrupt the
1+
<p>Clear-text protocols such as <code>ftp</code>, <code>telnet</code>, or <code>http</code> lack encryption of transported data, as well as the
2+
capability to build an authenticated connection. It means that an attacker able to sniff traffic from the network can read, modify, or corrupt the
33
transported content. These protocols are not secure as they expose applications to an extensive range of risks:</p>
44
<ul>
5-
<li> Sensitive data exposure </li>
6-
<li> Traffic redirected to a malicious endpoint </li>
7-
<li> Malware infected software update or installer </li>
8-
<li> Execution of client side code </li>
9-
<li> Corruption of critical information </li>
5+
<li> sensitive data exposure </li>
6+
<li> traffic redirected to a malicious endpoint </li>
7+
<li> malware-infected software update or installer </li>
8+
<li> execution of client-side code </li>
9+
<li> corruption of critical information </li>
1010
</ul>
1111
<p>Even in the context of isolated networks like offline environments or segmented cloud environments, the insider threat exists. Thus, attacks
1212
involving communications being sniffed or tampered with can still happen.</p>
1313
<p>For example, attackers could successfully compromise prior security layers by:</p>
1414
<ul>
15-
<li> Bypassing isolation mechanisms </li>
16-
<li> Compromising a component of the network </li>
17-
<li> Getting the credentials of an internal IAM account (either from a service account or an actual person) </li>
15+
<li> bypassing isolation mechanisms </li>
16+
<li> compromising a component of the network </li>
17+
<li> getting the credentials of an internal IAM account (either from a service account or an actual person) </li>
1818
</ul>
1919
<p>In such cases, encrypting communications would decrease the chances of attackers to successfully leak data or steal credentials from other network
2020
components. By layering various security practices (segmentation and encryption, for example), the application will follow the
@@ -30,27 +30,27 @@
3030
<h2>Ask Yourself Whether</h2>
3131
<ul>
3232
<li> Application data needs to be protected against falsifications or leaks when transiting over the network. </li>
33-
<li> Application data transits over a network that is considered untrusted. </li>
33+
<li> Application data transits over an untrusted network. </li>
3434
<li> Compliance rules require the service to encrypt data in transit. </li>
3535
<li> Your application renders web pages with a relaxed mixed content policy. </li>
36-
<li> OS level protections against clear-text traffic are deactivated. </li>
36+
<li> OS-level protections against clear-text traffic are deactivated. </li>
3737
</ul>
3838
<p>There is a risk if you answered yes to any of those questions.</p>
3939
<h2>Recommended Secure Coding Practices</h2>
4040
<ul>
4141
<li> Make application data transit over a secure, authenticated and encrypted protocol like TLS or SSH. Here are a few alternatives to the most
4242
common clear-text protocols:
4343
<ul>
44-
<li> Use<code>ssh</code> as an alternative to <code>telnet</code> </li>
45-
<li> Use <code>sftp</code>, <code>scp</code> or <code>ftps</code> instead of <code>ftp</code> </li>
46-
<li> Use <code>https</code> instead of <code>http</code> </li>
47-
<li> Use <code>SMTP</code> over <code>SSL/TLS</code> or <code>SMTP</code> with <code>STARTTLS</code> instead of clear-text SMTP </li>
44+
<li> Use <code>ssh</code> as an alternative to <code>telnet</code>. </li>
45+
<li> Use <code>sftp</code>, <code>scp</code>, or <code>ftps</code> instead of <code>ftp</code>. </li>
46+
<li> Use <code>https</code> instead of <code>http</code>. </li>
47+
<li> Use <code>SMTP</code> over <code>SSL/TLS</code> or <code>SMTP</code> with <code>STARTTLS</code> instead of clear-text SMTP. </li>
4848
</ul> </li>
49-
<li> Enable encryption of cloud components communications whenever it’s possible. </li>
49+
<li> Enable encryption of cloud components communications whenever it is possible. </li>
5050
<li> Configure your application to block mixed content when rendering web pages. </li>
51-
<li> If available, enforce OS level deactivation of all clear-text traffic </li>
51+
<li> If available, enforce OS-level deactivation of all clear-text traffic. </li>
5252
</ul>
53-
<p>It is recommended to secure all transport channels (even local network) as it can take a single non secure connection to compromise an entire
53+
<p>It is recommended to secure all transport channels, even on local networks, as it can take a single non-secure connection to compromise an entire
5454
application or system.</p>
5555
<h2>Sensitive Code Example</h2>
5656
<pre>
@@ -629,7 +629,7 @@ <h2>Compliant Solution</h2>
629629
<h2>Exceptions</h2>
630630
<p>No issue is reported for the following cases because they are not considered sensitive:</p>
631631
<ul>
632-
<li> Insecure protocol scheme followed by loopback addresses like 127.0.0.1 or <code>localhost</code> </li>
632+
<li> Insecure protocol scheme followed by loopback addresses like 127.0.0.1 or <code>localhost</code>. </li>
633633
</ul>
634634
<h2>See</h2>
635635
<ul>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p>Encryption operations should use a secure mode and padding scheme so that confidentiality and integrity can be guaranteed.</p>
1+
<p>Encryption algorithms should use secure modes and padding schemes where appropriate to guarantee data confidentiality and integrity.</p>
22
<ul>
33
<li> For block cipher encryption algorithms (like AES):
44
<ul>

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
<p>Amazon Relational Database Service (RDS) allows to easily host and manage a relational database in the cloud. RDS databases can be encrypted,
2-
ensuring the security of data-at-rest. In the case that adversaries gain physical access to the storage medium they are not able to access the
3-
data.</p>
1+
<p>Using unencrypted RDS DB resources exposes data to unauthorized access to the underlying storage.<br> This includes database data, logs, automatic
2+
backups, read replicas, snapshots, and cluster metadata.</p>
3+
<p>This situation can occur in a variety of scenarios, such as:</p>
4+
<ul>
5+
<li> a malicious insider working at the cloud provider gains physical access to the storage device and exfiltrates data. </li>
6+
<li> unknown attackers penetrate the cloud provider’s logical infrastructure and systems for extortion. </li>
7+
</ul>
8+
<p>AWS-managed encryption at rest reduces this risk with a simple switch.</p>
49
<h2>Ask Yourself Whether</h2>
510
<ul>
611
<li> The database contains sensitive data that could cause harm when leaked. </li>
712
<li> There are compliance requirements for the service to store data encrypted. </li>
813
</ul>
914
<p>There is a risk if you answered yes to any of those questions.</p>
1015
<h2>Recommended Secure Coding Practices</h2>
11-
<p>It’s recommended to encrypt databases that contain sensitive information. Encryption and decryption are handled transparently by RDS, so no further
12-
modifications to the application are necessary.</p>
16+
<p>It is recommended to enable encryption at rest on any RDS DB resource, regardless of the engine.<br> In any case, no further maintenance is
17+
required as encryption at rest is fully managed by AWS.</p>
1318
<h2>Sensitive Code Example</h2>
1419
<p>For <a href="https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseCluster.html">aws_cdk.aws_rds.DatabaseCluster</a> and <a
1520
href="https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseInstance.html">aws_cdk.aws_rds.DatabaseInstance</a>:</p>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"title": "Using unencrypted RDS databases is security-sensitive",
2+
"title": "Using unencrypted RDS DB resources is security-sensitive",
33
"type": "SECURITY_HOTSPOT",
44
"status": "ready",
55
"remediation": {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ <h2>Compliant Solution</h2>
4343
)
4444
</pre>
4545
<h2>Exceptions</h2>
46-
<p>No issue is reported when on Key policies in AWS KMS.</p>
46+
<ul>
47+
<li> Should not be raised on key policies (when AWS KMS actions are used.) </li>
48+
<li> Should not be raised on policies not using any resources (if and only if all actions in the policy never require resources.) </li>
49+
</ul>
4750
<h2>See</h2>
4851
<ul>
4952
<li> <a href="https://owasp.org/Top10/A01_2021-Broken_Access_Control/">OWASP Top 10 2021 Category A1</a> - Broken Access Control </li>

sonarpedia.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"languages": [
44
"PY"
55
],
6-
"latest-update": "2022-11-03T10:54:41.092693Z",
6+
"latest-update": "2022-12-08T09:58:09.170573Z",
77
"options": {
88
"no-language-in-filenames": true,
99
"preserve-filenames": true

0 commit comments

Comments
 (0)