Skip to content

Commit 6fbf487

Browse files
author
Max Schaefer
committed
Merge remote-tracking branch 'upstream/rc/1.20' into mergeback-2019-03-19
2 parents a31794f + 17e8b64 commit 6fbf487

File tree

41 files changed

+538
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+538
-191
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ We welcome contributions to our standard library and standard checks. Do you hav
1313

1414
## License
1515

16-
The LGTM queries are licensed under [Apache License 2.0](LICENSE) by [Semmle](https://semmle.com).
16+
The QL queries in this repository are licensed under [Apache License 2.0](LICENSE) by [Semmle](https://semmle.com).
Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
# Improvements to C# analysis
22

3-
## General improvements
4-
5-
## New queries
6-
7-
| **Query** | **Tags** | **Purpose** |
8-
|-----------------------------|-----------|--------------------------------------------------------------------|
9-
103
## Changes to existing queries
114

12-
| *@name of query (Query ID)* | *Impact on results* | *How/why the query has changed* |
5+
| **Query** | **Expected impact** | **Change** |
136
|------------------------------|------------------------|-----------------------------------|
14-
| Off-by-one comparison against container length (`cs/index-out-of-bounds`) | Fewer false positives | Results have been removed when there are additional guards on the index. |
15-
| Dereferenced variable is always null (`cs/dereferenced-value-is-always-null`) | Improved results | The query has been rewritten from scratch, and the analysis is now based on static single assignment (SSA) forms. The query is now enabled by default in LGTM. |
16-
| Dereferenced variable may be null (`cs/dereferenced-value-may-be-null`) | Improved results | The query has been rewritten from scratch, and the analysis is now based on static single assignment (SSA) forms. The query is now enabled by default in LGTM. |
17-
| SQL query built from user-controlled sources (`cs/sql-injection`), Improper control of generation of code (`cs/code-injection`), Uncontrolled format string (`cs/uncontrolled-format-string`), Clear text storage of sensitive information (`cs/cleartext-storage-of-sensitive-information`), Exposure of private information (`cs/exposure-of-sensitive-information`) | More results | Data sources have been added from user controls in `System.Windows.Forms`. |
18-
| Use of default ToString() (`cs/call-to-object-tostring`) | Fewer false positives | Results have been removed for `char` arrays passed to `StringBuilder.Append()`, which were incorrectly marked as using `ToString`. |
19-
| Use of default ToString() (`cs/call-to-object-tostring`) | Fewer results | Results have been removed when the object is an interface or an abstract class. |
20-
| Unused format argument (`cs/format-argument-unused`) | Fewer false positives | Results have been removed where the format string is empty. This is often used as a default value and is not an interesting result. |
21-
| Double-checked lock is not thread-safe (`cs/unsafe-double-checked-lock`) | Fewer false positives, more true positives | Results have been removed where the underlying field was not updated in the `lock` statement, or where the field is a `struct`. Results have been added where there are other statements inside the `lock` statement. |
7+
| Clear text storage of sensitive information (`cs/cleartext-storage-of-sensitive-information`) | More results | Now includes data sources for user controls in `System.Windows.Forms`. |
8+
| Dereferenced variable is always null (`cs/dereferenced-value-is-always-null`) | Improved results | The query has been rewritten from scratch, and the analysis is now based on static single assignment (SSA) forms. Results are now shown by default in LGTM. |
9+
| Dereferenced variable may be null (`cs/dereferenced-value-may-be-null`) | Improved results | The query has been rewritten from scratch, and the analysis is now based on static single assignment (SSA) forms. Results are now shown by default in LGTM. |
10+
| Double-checked lock is not thread-safe (`cs/unsafe-double-checked-lock`) | Fewer false positive and more true positive results | No longer highlights code where the underlying field was not updated in the `lock` statement, or where the field is a `struct`. Results have been added where there are other statements inside the `lock` statement. |
11+
| Exposure of private information (`cs/exposure-of-sensitive-information`) | More results | Now includes data sources for user controls in `System.Windows.Forms`. |
12+
| Improper control of generation of code (`cs/code-injection`) | More results | Now includes data sources for user controls in `System.Windows.Forms`. |
13+
| Off-by-one comparison against container length (`cs/index-out-of-bounds`) | Fewer false positive results | No longer reports results when there are additional guards on the index. |
14+
| SQL query built from user-controlled sources (`cs/sql-injection`) | More results | Now includes data sources for user controls in `System.Windows.Forms`. |
15+
| Uncontrolled format string (`cs/uncontrolled-format-string`) | More results | Now includes data sources for user controls in `System.Windows.Forms`. |
16+
| Unused format argument (`cs/format-argument-unused`) | Fewer false positive results | No longer reports results where the format string is empty. This is often used as a default value and is not an interesting result. |
17+
| Use of default ToString() (`cs/call-to-object-tostring`) | Fewer false positive results | No longer reports results for `char` arrays passed to `StringBuilder.Append()`, which were incorrectly marked as using `ToString`. |
18+
| Use of default ToString() (`cs/call-to-object-tostring`) | Fewer results | No longer reports results when the object is an interface or an abstract class. |
2219
| Using a package with a known vulnerability (`cs/use-of-vulnerable-package`) | More results | This query detects packages vulnerable to CVE-2019-0657. |
2320

2421
## Changes to code extraction
@@ -29,14 +26,13 @@
2926
## Changes to QL libraries
3027

3128
* The class `TrivialProperty` now includes library properties determined to be trivial using CIL analysis. This may increase the number of results for all queries that use data flow.
32-
* Taint-tracking steps have been added for the `Json.NET` package. This will improve results for queries that use taint-tracking.
29+
* Taint-tracking steps have been added for the `Json.NET` package. This will improve results for queries that use taint tracking.
3330
* Support has been added for EntityFrameworkCore, including
3431
- Stored data flow sources
3532
- Sinks for SQL expressions
36-
- Data flow through fields that are mapped to the database.
33+
- Data flow through fields that are mapped to the database
3734
* Support has been added for NHibernate-Core, including
3835
- Stored data flow sources
3936
- Sinks for SQL expressions
40-
- Data flow through fields that are mapped to the database.
37+
- Data flow through fields that are mapped to the database
4138

42-
## Changes to the autobuilder

change-notes/1.20/analysis-java.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Improvements to Java analysis
22

3-
## General improvements
4-
5-
63
## New queries
74

85
| **Query** | **Tags** | **Purpose** |
@@ -15,7 +12,6 @@
1512
| **Query** | **Expected impact** | **Change** |
1613
|----------------------------|------------------------|------------------------------------------------------------------|
1714
| Arbitrary file write during archive extraction ("Zip Slip") (`java/zipslip`) | Fewer false positive results | Results involving a sanitization step that converts a destination `Path` to a `File` are no longer reported. |
18-
| Double-checked locking is not thread-safe (`java/unsafe-double-checked-locking`) | Fewer false positive results and more true positive results | Results that use safe publication through a `final` field are no longer reported. Results that initialize immutable types like `String` incorrectly are now reported. |
1915
| Result of multiplication cast to wider type (`java/integer-multiplication-cast-to-long`) | Fewer results | Results involving conversions to `float` or `double` are no longer reported, as they were almost exclusively false positives. |
2016

2117
## Changes to QL libraries
@@ -29,7 +25,7 @@
2925
collections, maps, and iterators. This affects all security queries, which
3026
can report more results based on such paths.
3127
* The `FlowSources` and `TaintTracking` libraries are extended to cover additional remote user
32-
input and taint steps from the Apache Thrift, Apache Struts, Guice and Protobuf frameworks.
28+
input and taint steps from the following frameworks: Guice, Protobuf, Thrift and Struts.
3329
This affects all security queries, which may yield additional results on projects
3430
that use these frameworks.
3531

change-notes/1.20/analysis-javascript.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## General improvements
44

5-
* Support for many frameworks and libraries has been improved, in particular including the following:
5+
* Support for many frameworks and libraries has been improved, in particular for:
66
- [a-sync-waterfall](https://www.npmjs.com/package/a-sync-waterfall)
77
- [Electron](https://electronjs.org)
88
- [Express](https://npmjs.org/express)
@@ -12,7 +12,7 @@
1212
- [socket.io](http://socket.io)
1313
- [Vue](https://vuejs.org/)
1414

15-
* File classification has been improved to recognize additional generated files, for example files from [HTML Tidy](html-tidy.org).
15+
* File classification now recognizes additional generated files, for example, files from [HTML Tidy](html-tidy.org).
1616

1717
* The taint tracking library now recognizes flow through persistent storage, class fields, and callbacks in certain cases. Handling of regular expressions has also been improved. This may give more results for the security queries.
1818

@@ -24,7 +24,7 @@
2424

2525
| **Query** | **Tags** | **Purpose** |
2626
|-----------------------------------------------|------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
27-
| Arbitrary file write during archive extraction ("Zip Slip") (`js/zipslip`) | security, external/cwe/cwe-022 | Identifies extraction routines that allow arbitrary file overwrite vulnerabilities. Results are hidden on LGTM by default. |
27+
| Arbitrary file write during archive extraction ("Zip Slip") (`js/zipslip`) | security, external/cwe/cwe-022 | Identifies extraction routines that allow arbitrary file overwrite vulnerabilities, indicating a possible violation of [CWE-022](https://cwe.mitre.org/data/definitions/22.html). Results are shown on LGTM by default. |
2828
| Arrow method on Vue instance (`js/vue/arrow-method-on-vue-instance`) | reliability, frameworks/vue | Highlights arrow functions that are used as methods on Vue instances. Results are shown on LGTM by default.|
2929
| Cross-window communication with unrestricted target origin (`js/cross-window-information-leak`) | security, external/cwe/201, external/cwe/359 | Highlights code that sends potentially sensitive information to another window without restricting the receiver window's origin, indicating a possible violation of [CWE-201](https://cwe.mitre.org/data/definitions/201.html). Results are shown on LGTM by default. |
3030
| Double escaping or unescaping (`js/double-escaping`) | correctness, security, external/cwe/cwe-116 | Highlights potential double escaping or unescaping of special characters, indicating a possible violation of [CWE-116](https://cwe.mitre.org/data/definitions/116.html). Results are shown on LGTM by default. |
@@ -39,24 +39,24 @@
3939

4040
| **Query** | **Expected impact** | **Change** |
4141
|--------------------------------------------|------------------------------|------------------------------------------------------------------------------|
42-
| Ambiguous HTML id attribute | Fewer false-positive results | This rule now treats templates more conservatively. Its precision has been revised to 'high'. |
43-
| Assignment to exports variable | Fewer results | This rule no longer flags code that is also flagged by the rule "Useless assignment to local variable". |
44-
| Client-side cross-site scripting | More true-positive results, fewer false-positive results. | This rule now recognizes WinJS functions that are vulnerable to HTML injection. It no longer flags certain safe uses of jQuery, and recognizes custom sanitizers. |
45-
| Hard-coded credentials | Fewer false-positive results | This rule no longer flag the empty string as a hardcoded username. |
46-
| Insecure randomness | More results | This rule now flags insecure uses of `crypto.pseudoRandomBytes`. |
47-
| Reflected cross-site scripting | Fewer false-positive results. | This rule now recognizes custom sanitizers. |
48-
| Stored cross-site scripting | Fewer false-positive results. | This rule now recognizes custom sanitizers. |
49-
| Unbound event handler receiver (`js/unbound-event-handler-receiver`) | Fewer false positive results | Additional ways that class methods can be bound are recognized. |
50-
| Uncontrolled data used in network request | More results | This rule now recognizes host values that are vulnerable to injection. |
51-
| Unused parameter | Fewer false-positive results | This rule no longer flags parameters with leading underscore. |
52-
| Unused variable, import, function or class | Fewer false-positive results | This rule now flags fewer variables that are implictly used by JSX elements, no longer flags variables with leading underscore, and no longer flags variables in dead code. |
53-
| Uncontrolled data used in path expression | Fewer false-positive results | This rule now recognizes the Express `root` option, which prevents path traversal. |
54-
| Unneeded defensive code | More true-positive results, fewer false-positive results. | This rule now recognizes additional defensive code patterns. |
42+
| Ambiguous HTML id attribute | Fewer false positive results | This query now treats templates more conservatively. Its precision has been revised to 'high'. |
43+
| Assignment to exports variable | Fewer results | This query no longer flags code that is also flagged by the query "Useless assignment to local variable". |
44+
| Client-side cross-site scripting | More true positive and fewer false positive results. | This query now recognizes WinJS functions that are vulnerable to HTML injection. It no longer flags certain safe uses of jQuery, and recognizes custom sanitizers. |
45+
| Hard-coded credentials | Fewer false positive results | This query no longer flags the empty string as a hardcoded username. |
46+
| Insecure randomness | More results | This query now flags insecure uses of `crypto.pseudoRandomBytes`. |
47+
| Reflected cross-site scripting | Fewer false positive results. | This query now recognizes custom sanitizers. |
48+
| Stored cross-site scripting | Fewer false positive results. | This query now recognizes custom sanitizers. |
49+
| Unbound event handler receiver (`js/unbound-event-handler-receiver`) | Fewer false positive results | Additional ways that class methods can be bound are now recognized. |
50+
| Uncontrolled data used in network request | More results | This query now recognizes host values that are vulnerable to injection. |
51+
| Uncontrolled data used in path expression | Fewer false positive results | This query now recognizes the Express `root` option, which prevents path traversal. |
52+
| Unneeded defensive code | More true positive and fewer false positive results | This query now recognizes additional defensive code patterns. |
53+
| Unsafe dynamic method access | Fewer false positive results | This query no longer flags concatenated strings as unsafe method names. |
54+
| Unused parameter | Fewer false positive results | This query no longer flags parameters with leading underscore. |
55+
| Unused variable, import, function or class | Fewer false positive results | This query now flags fewer variables that are implictly used by JSX elements. It no longer flags variables with a leading underscore and variables in dead code. |
56+
| Unvalidated dynamic method call | More true positive results | This query now flags concatenated strings as unvalidated method names in more cases. |
57+
| Useless assignment to property. | Fewer false positive results | This query now treats assignments with complex right-hand sides correctly. |
5558
| Useless conditional | Fewer results | Additional defensive coding patterns are now ignored. |
56-
| Useless assignment to property. | Fewer false-positive results | This rule now treats assignments with complex right-hand sides correctly. |
57-
| Unsafe dynamic method access | Fewer false-positive results | This rule no longer flags concatenated strings as unsafe method names. |
58-
| Unvalidated dynamic method call | More true-positive results | This rule now flags concatenated strings as unvalidated method names in more cases. |
59-
| Useless conditional | More true-positive results | This rule now flags additional uses of function call values. |
59+
| Useless conditional | More true positive results | This query now flags additional uses of function call values. |
6060

6161
## Changes to QL libraries
6262

change-notes/1.20/analysis-python.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Removes false positives seen when using Python 3.6, but not when using earlier v
1111
The API has been improved to declutter the global namespace and improve discoverability and readability.
1212
* New predicates `ModuleObject::named(name)` and `ModuleObject.attr(name)` have been added, allowing more readable access to common objects. For example, `(any ModuleObject m | m.getName() = "sys").getAttribute("exit")` can be replaced with `ModuleObject::named("sys").attr("exit")`
1313
* The API for accessing builtin functions has been improved. Predicates of the form `theXXXFunction()`, such as `theLenFunction()`, have been deprecated in favour of `Object::builtin(name)`.
14+
* A configuration based API has been added for writing data flow and taint tracking queries. This is provided as a convenience for query authors who have written data flow or taint tracking queries for other languages, so they can use a similar format of query across multiple languages.
1415

1516
## New queries
1617

@@ -30,6 +31,7 @@ The API has been improved to declutter the global namespace and improve discover
3031
| Comparison using is when operands support \_\_eq\_\_ (`py/comparison-using-is`) | Fewer false positive results | Results where one of the objects being compared is an enum member are no longer reported. |
3132
| Modification of parameter with default (`py/modification-of-default-value`) | More true positive results | Instances where the mutable default value is mutated inside other functions are now also reported. |
3233
| Mutation of descriptor in \_\_get\_\_ or \_\_set\_\_ method (`py/mutable-descriptor`) | Fewer false positive results | Results where the mutation does not occur when calling one of the `__get__`, `__set__` or `__delete__` methods are no longer reported. |
34+
| Redundant comparison (`py/redundant-comparison`) | Fewer false positive results | Results in chained comparisons are no longer reported. |
3335
| Unused import (`py/unused-import`) | Fewer false positive results | Results where the imported module is used in a `doctest` string are no longer reported. |
3436
| Unused import (`py/unused-import`) | Fewer false positive results | Results where the imported module is used in a type-hint comment are no longer reported. |
3537

change-notes/1.20/support/framework-support.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Frameworks and libraries
22
########################
33

4-
The QL libraries and queries in this version have been explicitly checked against the libraries and frameworks listed below.
4+
The QL libraries and queries in version |version| have been explicitly checked against the libraries and frameworks listed below.
55

66
.. pull-quote::
77

0 commit comments

Comments
 (0)