Skip to content

Commit 10aecb6

Browse files
guillaume-dequennesonartech
authored andcommitted
Update rules metadata
GitOrigin-RevId: d0a93905e5780705b8d9c72eb0e6b21d432dea4a
1 parent 65ebfe4 commit 10aecb6

11 files changed

Lines changed: 71 additions & 18 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"linearFactor": "1min"
1616
},
1717
"tags": [
18+
"architecture",
1819
"brain-overload"
1920
],
2021
"defaultSeverity": "Critical",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"constantCost": "1h"
1414
},
1515
"tags": [
16+
"architecture",
1617
"brain-overload"
1718
],
1819
"defaultSeverity": "Major",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ <h2>Exceptions</h2>
4343
<li> Loopback addresses 127.0.0.0/8 in CIDR notation (from 127.0.0.0 to 127.255.255.255) </li>
4444
<li> Broadcast address 255.255.255.255 </li>
4545
<li> Non-routable address 0.0.0.0 </li>
46-
<li> Strings of the form <code>2.5.&lt;number&gt;.&lt;number&gt;</code> as they <a href="http://www.oid-info.com/introduction.htm">often match
47-
Object Identifiers</a> (OID) </li>
46+
<li> Strings of the form <code>2.5.&lt;number&gt;.&lt;number&gt;</code> as they <a href="https://en.wikipedia.org/wiki/Object_identifier">often
47+
match Object Identifiers</a> (OID) </li>
4848
<li> Addresses in the ranges 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24, reserved for documentation purposes by <a
4949
href="https://datatracker.ietf.org/doc/html/rfc5737">RFC 5737</a> </li>
5050
<li> Addresses in the range 2001:db8::/32, reserved for documentation purposes by <a href="https://datatracker.ietf.org/doc/html/rfc3849">RFC

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"constantCost": "20min"
1414
},
1515
"tags": [
16+
"architecture",
1617
"brain-overload"
1718
],
1819
"defaultSeverity": "Major",

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

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,49 @@ <h2>Recommended Secure Coding Practices</h2>
1414
<li> Set the <code>secure</code> flag to <em>true</em> for session-cookies. </li>
1515
</ul>
1616
<h2>Sensitive Code Example</h2>
17-
<p>Flask</p>
18-
<pre>
17+
<p>Using Flask:</p>
18+
<pre data-diff-id="11" data-diff-type="noncompliant">
1919
from flask import Response
2020

2121
@app.route('/')
2222
def index():
2323
response = Response()
24-
response.set_cookie('key', 'value') # Sensitive
24+
response.set_cookie('key', 'value') # Sensitive
2525
return response
2626
</pre>
27+
<p>Using FastAPI:</p>
28+
<pre data-diff-id="21" data-diff-type="noncompliant">
29+
from fastapi import FastAPI, Response
30+
31+
app = FastAPI()
32+
33+
@app.get('/')
34+
async def index(response: Response):
35+
response.set_cookie('key', 'value') # Sensitive
36+
return {"message": "Hello world!"}
37+
</pre>
2738
<h2>Compliant Solution</h2>
28-
<p>Flask</p>
29-
<pre>
39+
<p>Using Flask:</p>
40+
<pre data-diff-id="11" data-diff-type="compliant">
3041
from flask import Response
3142

3243
@app.route('/')
3344
def index():
3445
response = Response()
35-
response.set_cookie('key', 'value', secure=True) # Compliant
46+
response.set_cookie('key', 'value', secure=True)
3647
return response
3748
</pre>
49+
<p>Using FastAPI:</p>
50+
<pre data-diff-id="21" data-diff-type="compliant">
51+
from fastapi import FastAPI, Response
52+
53+
app = FastAPI()
54+
55+
@app.get('/')
56+
async def index(response: Response):
57+
response.set_cookie('key', 'value', secure=True)
58+
return {"message": "Hello world!"}
59+
</pre>
3860
<h2>See</h2>
3961
<ul>
4062
<li> OWASP - <a href="https://owasp.org/Top10/A04_2021-Insecure_Design/">Top 10 2021 Category A4 - Insecure Design</a> </li>

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

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,49 @@ <h2>Recommended Secure Coding Practices</h2>
1616
sensitive-security cookies. </li>
1717
</ul>
1818
<h2>Sensitive Code Example</h2>
19-
<p>Flask:</p>
20-
<pre>
19+
<p>Using Flask:</p>
20+
<pre data-diff-id="11" data-diff-type="noncompliant">
2121
from flask import Response
2222

2323
@app.route('/')
2424
def index():
2525
response = Response()
26-
response.set_cookie('key', 'value') # Sensitive
26+
response.set_cookie('key', 'value') # Sensitive
2727
return response
2828
</pre>
29+
<p>Using FastAPI:</p>
30+
<pre data-diff-id="21" data-diff-type="noncompliant">
31+
from fastapi import FastAPI, Response
32+
33+
app = FastAPI()
34+
35+
@app.get('/')
36+
async def index(response: Response):
37+
response.set_cookie('key', 'value') # Sensitive
38+
return {"message": "Hello world!"}
39+
</pre>
2940
<h2>Compliant Solution</h2>
30-
<p>Flask:</p>
31-
<pre>
41+
<p>Using Flask:</p>
42+
<pre data-diff-id="11" data-diff-type="compliant">
3243
from flask import Response
3344

3445
@app.route('/')
3546
def index():
3647
response = Response()
37-
response.set_cookie('key', 'value', httponly=True) # Compliant
48+
response.set_cookie('key', 'value', httponly=True)
3849
return response
3950
</pre>
51+
<p>Using FastAPI:</p>
52+
<pre data-diff-id="21" data-diff-type="compliant">
53+
from fastapi import FastAPI, Response
54+
55+
app = FastAPI()
56+
57+
@app.get('/')
58+
async def index(response: Response):
59+
response.set_cookie('key', 'value', httponly=True)
60+
return {"message": "Hello world!"}
61+
</pre>
4062
<h2>See</h2>
4163
<ul>
4264
<li> OWASP - <a href="https://owasp.org/Top10/A05_2021-Security_Misconfiguration/">Top 10 2021 Category A5 - Security Misconfiguration</a> </li>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"linearFactor": "1min"
1616
},
1717
"tags": [
18+
"architecture",
1819
"brain-overload"
1920
],
2021
"defaultSeverity": "Critical",

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ <h4>Compliant solution</h4>
2626
</pre>
2727
<h2>Resources</h2>
2828
<h3>Documentation</h3>
29-
<p><a href="https://docs.djangoproject.com/en/4.1/ref/models/instances/#django.db.models.Model.<em>str</em>">Django Model.<em>str</em>()</a></p>
29+
<p><a
30+
href="https://docs.djangoproject.com/en/4.1/ref/models/instances/#django.db.models.Model">https://docs.djangoproject.com/en/4.1/ref/models/instances/#django.db.models.Model</a>.<em>str</em>[Django
31+
Model.<em>str</em>()]</p>
3032

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ <h4>Compliant solution</h4>
3131
<h2>Resources</h2>
3232
<h3>Documentation</h3>
3333
<ul>
34-
<li> Python Documentation - <a href="https://docs.python.org/3/reference/datamodel.html#object.<em>hash</em>">object.<em>hash</em></a> </li>
34+
<li> Python Documentation - <a
35+
href="https://docs.python.org/3/reference/datamodel.html#object">https://docs.python.org/3/reference/datamodel.html#object</a>.<em>hash</em>[object.<em>hash</em>] </li>
3536
<li> Python Documentation - <a href="https://docs.python.org/3/library/functions.html#hash">the hash built-in function</a> </li>
3637
</ul>
3738

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,7 @@ <h4>Compliant solution</h4>
3434
</pre>
3535
<h2>Resources</h2>
3636
<h3>Documentation</h3>
37-
<p>Python Documentation - <a href="https://docs.python.org/3/library/operator.html#operator.<em>index</em>"><em>index</em> method</a></p>
37+
<p>Python Documentation - <a
38+
href="https://docs.python.org/3/library/operator.html#operator">https://docs.python.org/3/library/operator.html#operator</a>.<em>index</em>[<em>index</em>
39+
method]</p>
3840

0 commit comments

Comments
 (0)