Skip to content

Commit 21246dc

Browse files
committed
Python: clean up change notes and query help.
1 parent eefb45c commit 21246dc

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

change-notes/1.19/analysis-python.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ A new predicate `Stmt.getAnEntryNode()` has been added to make it easier to writ
5656

5757
| **Query** | **Tags** | **Purpose** |
5858
|-----------------------------|-----------|--------------------------------------------------------------------|
59-
| Flask app is run in debug mode (`py/flask-debug`) | security, external/cwe/cwe-215, external/cwe/cwe-489 | Finds instances where a Flask application is run in debug mode. Enabled on LGTM by default. |
60-
| Information exposure through an exception (`py/stack-trace-exposure`) | security, external/cwe/cwe-209, external/cwe/cwe-497 | Finds instances where information about an exception may be leaked to an external user. Enabled on LGTM by default. |
61-
| Jinja2 templating with autoescape=False (`py/jinja2/autoescape-false`) | security, external/cwe/cwe-079 | Finds instantiations of jinja2.Environment with `autoescape=False` which may allow XSS attacks. Not enabled on LGTM by default. |
62-
| Request without certificate validation (`py/request-without-cert-validation`) | security, external/cwe/cwe-295 | Finds requests where certificate verification has been explicitly turned off, possibly allowing man-in-the-middle attacks. Not enabled on LGTM by default. |
59+
| Flask app is run in debug mode (`py/flask-debug`) | security, external/cwe/cwe-215, external/cwe/cwe-489 | Finds instances where a Flask application is run in debug mode. Results are shown on LGTM by default. |
60+
| Information exposure through an exception (`py/stack-trace-exposure`) | security, external/cwe/cwe-209, external/cwe/cwe-497 | Finds instances where information about an exception may be leaked to an external user. Results are shown on LGTM by default. |
61+
| Jinja2 templating with autoescape=False (`py/jinja2/autoescape-false`) | security, external/cwe/cwe-079 | Finds instantiations of `jinja2.Environment` with `autoescape=False` which may allow XSS attacks. Results are hidden on LGTM by default. |
62+
| Request without certificate validation (`py/request-without-cert-validation`) | security, external/cwe/cwe-295 | Finds requests where certificate verification has been explicitly turned off, possibly allowing man-in-the-middle attacks. Results are hidden on LGTM by default. |
6363

6464
## Changes to existing queries
6565

python/ql/src/Security/CWE-079/Jinja2WithoutEscaping.qhelp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<overview>
77
<p>
88

9-
Cross-site scripting attacks can occur if untrusted input is not escaped. This applies to templates as well as code.
9+
Cross-site scripting (XSS) attacks can occur if untrusted input is not escaped. This applies to templates as well as code.
1010
The <code>jinja2</code> templates may be vulnerable to XSS if the environment has <code>autoescape</code> set to <code>False</code>.
1111
Unfortunately, <code>jinja2</code> sets <code>autoescape</code> to <code>False</code> by default.
1212
Explicitly setting <code>autoescape</code> to <code>True</code> when creating an <code>Environment</code> object will prevent this.
@@ -23,7 +23,7 @@ For example, it can be used when creating an environment <code>Environment(autoe
2323

2424
<example>
2525
<p>
26-
The following example is a minimal flask app which shows a safe and unsafe way to render the given name back to the page.
26+
The following example is a minimal Flask app which shows a safe and an unsafe way to render the given name back to the page.
2727
The first view is unsafe as <code>first_name</code> is not escaped, leaving the page vulnerable to cross-site scripting attacks.
2828
The second view is safe as <code>first_name</code> is escaped, so it is not vulnerable to cross-site scripting attacks.
2929
</p>
@@ -32,11 +32,13 @@ The second view is safe as <code>first_name</code> is escaped, so it is not vuln
3232

3333
<references>
3434
<li>
35-
http://jinja.pocoo.org/docs/2.10/api/
3635
Jinja2: <a href="http://jinja.pocoo.org/docs/2.10/api/">API</a>.
3736
</li>
3837
<li>
3938
Wikipedia: <a href="http://en.wikipedia.org/wiki/Cross-site_scripting">Cross-site scripting</a>.
4039
</li>
40+
<li>
41+
OWASP: <a href="https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet">XSS (Cross Site Scripting) Prevention Cheat Sheet</a>.
42+
</li>
4143
</references>
4244
</qhelp>

python/ql/src/Security/CWE-079/Jinja2WithoutEscaping.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @name Jinja2 templating with autoescape=False
3-
* @description Using jinja2 templates with autoescape=False can
3+
* @description Using jinja2 templates with 'autoescape=False' can
44
* cause a cross-site scripting vulnerability.
55
* @kind problem
66
* @problem.severity error

0 commit comments

Comments
 (0)