You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: java/ql/src/Security/CWE/CWE-020/UntrustedDataToExternalAPI.qhelp
+7-9Lines changed: 7 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,11 @@
4
4
<qhelp>
5
5
<overview>
6
6
<p>Using unsanitized untrusted data in an external API can cause a variety of security issues. This query reports
7
-
all uses of external APIs with untrusted data for review. This query has a deliberately low true positive rate,
8
-
and is designed to help security reviews for the application, as well as helping identify external APIs that
9
-
should be modeled as either taint steps, or sinks for specific problems.</p>
7
+
external APIs that use untrusted data. The results are not filtered so that you can audit all examples. The query provides data for security reviews of the application and you can also use it to identify external APIs that should be modeled as either taint steps, or sinks for specific problems.</p>
10
8
11
9
<p>An external API is defined as a method call to a method that is not defined in the source code, not overridden
12
10
in the source code, and is not modeled as a taint step in the default taint library. External APIs may be from the
13
-
Java standard library, thirdparty dependencies or from internal dependencies. The query will report uses of
11
+
Java standard library, third-party dependencies or from internal dependencies. The query reports uses of
14
12
untrusted data in either the qualifier or as one of the arguments of external APIs.</p>
15
13
16
14
</overview>
@@ -20,10 +18,10 @@ untrusted data in either the qualifier or as one of the arguments of external AP
20
18
21
19
<ul>
22
20
<li>If the result highlights a known sink, confirm that the result is reported by the relevant query, or
23
-
that the result is a false positive due to sanitization.</li>
21
+
that the result is a false positive because this data is sanitized.</li>
24
22
<li>If the result highlights an unknown sink for a problem, then add modeling for the sink to the relevant query,
25
23
and confirm that the result is either found, or is safe due to appropriate sanitization.</li>
26
-
<li>If the result represents a call to an external API which transfers taint, add the appropriate modeling, and
24
+
<li>If the result represents a call to an external API that transfers taint, add the appropriate modeling, and
27
25
re-run the query to determine what new results have appeared due to this additional modeling.</li>
28
26
</ul>
29
27
@@ -39,19 +37,19 @@ class to exclude known safe external APIs from future analysis.</p>
39
37
<samplesrc="ExternalAPISinkExample.java" />
40
38
41
39
<p>This is an XSS sink. The XSS query should therefore be reviewed to confirm that this sink is appropriately modeled,
42
-
and if it is, to confirm that the query reports this particular result, or that the result is false positive due to
40
+
and if it is, to confirm that the query reports this particular result, or that the result is a false positive due to
43
41
some existing sanitization.</p>
44
42
45
43
<p>In this second example, again a request parameter is read from <code>HttpServletRequest</code>.</p>
46
44
47
45
<samplesrc="ExternalAPITaintStepExample.java" />
48
46
49
47
<p>If the query reported the call to <code>StringBuilder.append</code> on line 7, this would suggest that this external API is
50
-
not currently modeled as a taint step in the taint tracking library. The next step would be to model this as taint step, then
48
+
not currently modeled as a taint step in the taint tracking library. The next step would be to model this as a taint step, then
51
49
re-run the query to determine what additional results might be found. In this example, it seems likely that the result of the
52
50
<code>StringBuilder</code> will be executed as an SQL query, potentially leading to an SQL injection vulnerability.</p>
53
51
54
-
<p>Note that both examples are correctly handled with the standard taint tracking library and XSS query.</p>
52
+
<p>Note that both examples are correctly handled by the standard taint tracking library and XSS query.</p>
0 commit comments