Skip to content

Commit d859e35

Browse files
Update rule metadata (#1132)
1 parent 287ac6b commit d859e35

File tree

12 files changed

+28
-49
lines changed

12 files changed

+28
-49
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h2>Recommended Secure Coding Practices</h2>
2929
<h2>Sensitive Code Example</h2>
3030
<p>Server-side encryption is not used:</p>
3131
<pre>
32-
bucket = s3.Bucket(self,"MyUnencryptedBucket",
32+
bucket = s3.Bucket(self,"bucket",
3333
encryption=s3.BucketEncryption.UNENCRYPTED # Sensitive
3434
)
3535
</pre>
@@ -38,14 +38,14 @@ <h2>Sensitive Code Example</h2>
3838
<h2>Compliant Solution</h2>
3939
<p>Server-side encryption with Amazon S3-Managed Keys is used:</p>
4040
<pre>
41-
bucket = s3.Bucket(self,"MyEncryptedBucket",
42-
encryption=s3.BucketEncryption.S3_MANAGED # Compliant
41+
bucket = s3.Bucket(self,"bucket",
42+
encryption=s3.BucketEncryption.S3_MANAGED
4343
)
4444

4545
# Alternatively with a KMS key managed by the user.
4646

47-
bucket = s3.Bucket(self,"MyEncryptedBucket",
48-
encryptionKey=access_key # Compliant
47+
bucket = s3.Bucket(self,"bucket",
48+
encryptionKey=access_key
4949
)
5050
</pre>
5151
<h2>See</h2>
@@ -59,7 +59,6 @@ <h2>See</h2>
5959
Misconfiguration </li>
6060
<li> <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/serv-side-encryption.html">AWS documentation</a> - Protecting data using
6161
server-side encryption </li>
62-
<li> <a href="https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketEncryption.html">CDK documentation</a> - BucketEncryption class
63-
</li>
62+
<li> <a href="https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketEncryption.html">AWS CDK version 2</a> - BucketEncryption </li>
6463
</ul>
6564

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ <h2>Recommended Secure Coding Practices</h2>
1010
<p>It’s recommended to enable S3 versioning and thus to have the possibility to retrieve and restore different versions of an object.</p>
1111
<h2>Sensitive Code Example</h2>
1212
<pre>
13-
bucket = s3.Bucket(self, "MyUnversionedBucket",
13+
bucket = s3.Bucket(self, "bucket",
1414
versioned=False # Sensitive
1515
)
1616
</pre>
1717
<p>The default value of <code>versioned</code> is <code>False</code> so the absence of this parameter is also sensitive.</p>
1818
<h2>Compliant Solution</h2>
1919
<pre>
20-
bucket = s3.Bucket(self, "MyVersionedBucket",
21-
versioned=True # Compliant
20+
bucket = s3.Bucket(self, "bucket",
21+
versioned=True
2222
)
2323
</pre>
2424
<h2>See</h2>
@@ -27,7 +27,7 @@ <h2>See</h2>
2727
<li> <a href="https://www.owasp.org/index.php/Top_10-2017_A6-Security_Misconfiguration">OWASP Top 10 2017 Category A6</a> - Security
2828
Misconfiguration </li>
2929
<li> <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/Versioning.html">AWS documentation</a> - Using versioning in S3 buckets </li>
30-
<li> <a href="https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html#versioned">CDK documentation</a> - Using versioning in S3
30+
<li> <a href="https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html#versioned">AWS CDK version 2</a> - Using versioning in S3
3131
buckets </li>
3232
</ul>
3333

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,11 @@ <h2>Sensitive Code Example</h2>
1919
<p>All users (ie: anyone in the world authenticated or not) have read and write permissions with the <code>PUBLIC_READ_WRITE</code> access
2020
control:</p>
2121
<pre>
22-
bucket = s3.Bucket(self,
23-
"bucket",
22+
bucket = s3.Bucket(self, "bucket",
2423
access_control=s3.BucketAccessControl.PUBLIC_READ_WRITE # Sensitive
2524
)
2625

27-
# Another example
28-
s3deploy.BucketDeployment(self,
29-
"DeployWebsite",
30-
...,
26+
s3deploy.BucketDeployment(self, "DeployWebsite",
3127
access_control=s3.BucketAccessControl.PUBLIC_READ_WRITE # Sensitive
3228
)
3329
</pre>

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

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ <h2>Recommended Secure Coding Practices</h2>
3131
<h2>Sensitive Code Example</h2>
3232
<p>By default, when not set, the <code>block_public_access</code> is fully deactivated (nothing is blocked):</p>
3333
<pre>
34-
bucket = s3.bucket(self,
34+
bucket = s3.Bucket(self,
3535
"bucket" # Sensitive
3636
)
3737
</pre>
@@ -40,7 +40,7 @@ <h2>Sensitive Code Example</h2>
4040
bucket = s3.Bucket(self,
4141
"bucket",
4242
block_public_access=s3.BlockPublicAccess(
43-
block_public_acls=False, # NonCompliant should be TRUE
43+
block_public_acls=False, # Sensitive
4444
ignore_public_acls=True,
4545
block_public_policy=True,
4646
restrict_public_buckets=True
@@ -49,38 +49,22 @@ <h2>Sensitive Code Example</h2>
4949
</pre>
5050
<p>The attribute <code>BLOCK_ACLS</code> only blocks and ignores public ACLs:</p>
5151
<pre>
52-
bucket = s3.bucket(self,
53-
"bucket",
54-
block_public_access=s3.BlockPublicAccess.BLOCK_ACLS # NonCompliant
55-
)
56-
</pre>
57-
<p>The <code>public_read_access</code> boolean property can grant the public read access to all objects in the bucket (by default False) :</p>
58-
<pre>
59-
bucket = s3.bucket(self,
60-
"bucket",
61-
public_read_access=True # NonCompliant
62-
)
63-
</pre>
64-
<p>The same setting can be achieved through the function <code>grant_public_access()</code>:</p>
65-
<pre>
66-
bucket = s3.bucket(self,
52+
bucket = s3.Bucket(self,
6753
"bucket",
68-
...
54+
block_public_access=s3.BlockPublicAccess.BLOCK_ACLS # Sensitive
6955
)
70-
71-
bucket.grant_public_access() # NonCompliant
7256
</pre>
7357
<h2>Compliant Solution</h2>
7458
<p>This <code>block_public_access</code> blocks public ACLs and policies, ignores existing public ACLs and restricts existing public policies:</p>
7559
<pre>
76-
bucket = s3.bucket(self,
77-
"blockedBucket",
60+
bucket = s3.Bucket(self,
61+
"bucket",
7862
block_public_access=s3.BlockPublicAccess.BLOCK_ALL # Compliant
7963
)
8064
</pre>
8165
<p>A similar configuration to the one above can obtained by setting all parameters of the <code>block_public_access</code></p>
8266
<pre>
83-
bucket = s3.Bucket(self, "MyBlockedBucket",
67+
bucket = s3.Bucket(self, "bucket",
8468
block_public_access=s3.BlockPublicAccess( # Compliant
8569
block_public_acls=True,
8670
ignore_public_acls=True,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"ruleSpecification": "RSPEC-6326",
1414
"sqKey": "S6326",
1515
"scope": "Main",
16-
"quickfix": "unknown"
16+
"quickfix": "targeted"
1717
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"ruleSpecification": "RSPEC-6331",
1414
"sqKey": "S6331",
1515
"scope": "Main",
16-
"quickfix": "unknown"
16+
"quickfix": "targeted"
1717
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"ruleSpecification": "RSPEC-6353",
1414
"sqKey": "S6353",
1515
"scope": "Main",
16-
"quickfix": "unknown"
16+
"quickfix": "targeted"
1717
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<p>Sub-patterns can be wrapped by parentheses to build a group. This enables to restrict alternations, back reference the group or apply a quantifier
2-
to the sub-pattern.</p>
1+
<p>Sub-patterns can be wrapped by parentheses to build a group. This enables to restrict alternations, back reference the group or apply quantifier to
2+
the sub-pattern.</p>
33
<p>If this group should not be part of the match result or if no reference to this group is required, a non-capturing group can be created by adding
44
<code>:?</code> behind the opening parenthesis.</p>
55
<p>However, if this non-capturing group does not have a quantifier, or does not wrap an alternation, then imaging this group is redundant.</p>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"ruleSpecification": "RSPEC-6395",
1414
"sqKey": "S6395",
1515
"scope": "All",
16-
"quickfix": "unknown"
16+
"quickfix": "targeted"
1717
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"ruleSpecification": "RSPEC-6396",
1414
"sqKey": "S6396",
1515
"scope": "All",
16-
"quickfix": "unknown"
16+
"quickfix": "targeted"
1717
}

0 commit comments

Comments
 (0)