Skip to content

Commit 124c4cb

Browse files
committed
Merge branch 'master' of github.com:github/codeql into OptionalSanitizer
2 parents e5afdc5 + 5deeda0 commit 124c4cb

File tree

234 files changed

+1776
-869
lines changed

Some content is hidden

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

234 files changed

+1776
-869
lines changed

change-notes/1.25/analysis-cpp.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The following changes in version 1.25 affect C/C++ analysis in all applications.
1616

1717
## Changes to libraries
1818

19+
* The library `VCS.qll` and all queries that imported it have been removed.
1920
* The data-flow library has been improved, which affects most security queries by potentially
2021
adding more results. Flow through functions now takes nested field reads/writes into account.
2122
For example, the library is able to track flow from `taint()` to `sink()` via the method
@@ -39,3 +40,5 @@ The following changes in version 1.25 affect C/C++ analysis in all applications.
3940
}
4041
};
4142
```
43+
* The security pack taint tracking library (`semmle.code.cpp.security.TaintTracking`) now considers that equality checks may block the flow of taint. This results in fewer false positive results from queries that use this library.
44+

change-notes/1.25/analysis-javascript.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
## General improvements
44

55
* Support for the following frameworks and libraries has been improved:
6+
- [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
67
- [bluebird](http://bluebirdjs.com/)
78
- [express](https://www.npmjs.com/package/express)
9+
- [fastify](https://www.npmjs.com/package/fastify)
810
- [fstream](https://www.npmjs.com/package/fstream)
911
- [jGrowl](https://github.com/stanlemon/jGrowl)
1012
- [jQuery](https://jquery.com/)
@@ -13,12 +15,11 @@
1315
- [mssql](https://www.npmjs.com/package/mssql)
1416
- [mysql](https://www.npmjs.com/package/mysql)
1517
- [pg](https://www.npmjs.com/package/pg)
16-
- [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
1718
- [sequelize](https://www.npmjs.com/package/sequelize)
1819
- [spanner](https://www.npmjs.com/package/spanner)
1920
- [sqlite](https://www.npmjs.com/package/sqlite)
20-
- [ssh2](https://www.npmjs.com/package/ssh2)
2121
- [ssh2-streams](https://www.npmjs.com/package/ssh2-streams)
22+
- [ssh2](https://www.npmjs.com/package/ssh2)
2223

2324
* TypeScript 3.9 is now supported.
2425

@@ -35,42 +36,43 @@
3536

3637
| **Query** | **Expected impact** | **Change** |
3738
|--------------------------------|------------------------------|---------------------------------------------------------------------------|
38-
| Misspelled variable name (`js/misspelled-variable-name`) | Message changed | The message for this query now correctly identifies the misspelled variable in additional cases. |
39-
| Uncontrolled data used in path expression (`js/path-injection`) | More results | This query now recognizes additional file system calls. |
40-
| Uncontrolled command line (`js/command-line-injection`) | More results | This query now recognizes additional command execution calls. |
41-
| Client-side URL redirect (`js/client-side-unvalidated-url-redirection`) | Less results | This query now recognizes additional safe patterns of doing URL redirects. |
42-
| Client-side cross-site scripting (`js/xss`) | Less results | This query now recognizes additional safe strings based on URLs. |
39+
| Client-side cross-site scripting (`js/xss`) | Less results | This query no longer flags optionally sanitized values. |
40+
| Client-side URL redirect (`js/client-side-unvalidated-url-redirection`) | Fewer results | This query now recognizes additional safe patterns of doing URL redirects. |
41+
| Client-side cross-site scripting (`js/xss`) | Fewer results | This query now recognizes additional safe strings based on URLs. |
42+
| Code injection (`js/code-injection`) | More results | More potential vulnerabilities involving NoSQL code operators are now recognized. |
43+
| Expression has no effect (`js/useless-expression`) | Fewer results | This query no longer flags an expression when that expression is the only content of the containing file. |
4344
| Incomplete URL scheme check (`js/incomplete-url-scheme-check`) | More results | This query now recognizes additional url scheme checks. |
45+
| Misspelled variable name (`js/misspelled-variable-name`) | Message changed | The message for this query now correctly identifies the misspelled variable in additional cases. |
4446
| Prototype pollution in utility function (`js/prototype-pollution-utility`) | More results | This query now recognizes additional utility functions as vulnerable to prototype polution. |
45-
| Expression has no effect (`js/useless-expression`) | Less results | This query no longer flags an expression when that expression is the only content of the containing file. |
46-
| Unknown directive (`js/unknown-directive`) | Less results | This query no longer flags directives generated by the Babel compiler. |
47-
| Code injection (`js/code-injection`) | More results | More potential vulnerabilities involving NoSQL code operators are now recognized. |
47+
| Prototype pollution in utility function (`js/prototype-pollution-utility`) | More results | This query now recognizes more coding patterns that are vulnerable to prototype pollution. |
48+
| Uncontrolled command line (`js/command-line-injection`) | More results | This query now recognizes additional command execution calls. |
49+
| Uncontrolled data used in path expression (`js/path-injection`) | More results | This query now recognizes additional file system calls. |
50+
| Unknown directive (`js/unknown-directive`) | Fewer results | This query no longer flags directives generated by the Babel compiler. |
51+
| Unused property (`js/unused-property`) | Fewer results | This query no longer flags properties of objects that are operands of `yield` expressions. |
4852
| Zip Slip (`js/zipslip`) | More results | This query now recognizes additional vulnerabilities. |
49-
| Unused property (`js/unused-property`) | Less results | This query no longer flags properties of objects that are operands of `yield` expressions. |
50-
| Client-side cross-site scripting (`js/xss`) | Less results | This query no longer flags optionally sanitized values. |
5153

5254
The following low-precision queries are no longer run by default on LGTM (their results already were not displayed):
5355

5456
- `js/angular/dead-event-listener`
5557
- `js/angular/unused-dependency`
56-
- `js/conflicting-html-attribute`
57-
- `js/useless-assignment-to-global`
58-
- `js/too-many-parameters`
59-
- `js/unused-property`
6058
- `js/bitwise-sign-check`
6159
- `js/comparison-of-identical-expressions`
62-
- `js/misspelled-identifier`
60+
- `js/conflicting-html-attribute`
61+
- `js/ignored-setter-parameter`
6362
- `js/jsdoc/malformed-param-tag`
64-
- `js/jsdoc/unknown-parameter`
6563
- `js/jsdoc/missing-parameter`
66-
- `js/omitted-array-element`
67-
- `js/ignored-setter-parameter`
64+
- `js/jsdoc/unknown-parameter`
6865
- `js/json-in-javascript-file`
66+
- `js/misspelled-identifier`
67+
- `js/nested-loops-with-same-variable`
6968
- `js/node/cyclic-import`
7069
- `js/node/unused-npm-dependency`
71-
- `js/single-run-loop`
72-
- `js/nested-loops-with-same-variable`
70+
- `js/omitted-array-element`
7371
- `js/return-outside-function`
72+
- `js/single-run-loop`
73+
- `js/too-many-parameters`
74+
- `js/unused-property`
75+
- `js/useless-assignment-to-global`
7476

7577
## Changes to libraries
7678

@@ -80,3 +82,4 @@ The following low-precision queries are no longer run by default on LGTM (their
8082
- `Parameter.flow()` now gets the correct data flow node for a parameter. Previously this had a result, but the node was disconnected from the data flow graph.
8183
- `ParameterNode.asExpr()` and `.getAstNode()` now gets the parameter's AST node, whereas previously it had no result.
8284
- `Expr.flow()` now has a more meaningful result for destructuring patterns. Previously this node was disconnected from the data flow graph. Now it represents the values being destructured by the pattern.
85+
* The global data-flow and taint-tracking libraries now model indirect parameter accesses through the `arguments` object in some cases, which may lead to additional results from some of the security queries, particularly "Prototype pollution in utility function".

cpp/ql/src/Likely Bugs/Underspecified Functions/TooFewArguments.qll

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,50 @@
66

77
import cpp
88

9-
// True if function was ()-declared, but not (void)-declared or K&R-defined
9+
/**
10+
* Holds if `fde` has a parameter declaration that's clear on the minimum
11+
* number of parameters. This is essentially true for everything except
12+
* `()`-declarations.
13+
*/
14+
private predicate hasDefiniteNumberOfParameters(FunctionDeclarationEntry fde) {
15+
fde.hasVoidParamList()
16+
or
17+
fde.getNumberOfParameters() > 0
18+
or
19+
fde.isDefinition()
20+
}
21+
22+
/* Holds if function was ()-declared, but not (void)-declared or K&R-defined. */
1023
private predicate hasZeroParamDecl(Function f) {
1124
exists(FunctionDeclarationEntry fde | fde = f.getADeclarationEntry() |
12-
not fde.hasVoidParamList() and fde.getNumberOfParameters() = 0 and not fde.isDefinition()
25+
not hasDefiniteNumberOfParameters(fde)
1326
)
1427
}
1528

16-
// True if this file (or header) was compiled as a C file
29+
/* Holds if this file (or header) was compiled as a C file. */
1730
private predicate isCompiledAsC(File f) {
1831
f.compiledAsC()
1932
or
2033
exists(File src | isCompiledAsC(src) | src.getAnIncludedFile() = f)
2134
}
2235

36+
/** Holds if `fc` is a call to `f` with too few arguments. */
2337
predicate tooFewArguments(FunctionCall fc, Function f) {
2438
f = fc.getTarget() and
2539
not f.isVarargs() and
2640
not f instanceof BuiltInFunction and
41+
// This query should only have results on C (not C++) functions that have a
42+
// `()` parameter list somewhere. If it has results on other functions, then
43+
// it's probably because the extractor only saw a partial compilation.
2744
hasZeroParamDecl(f) and
2845
isCompiledAsC(f.getFile()) and
29-
// There is an explicit declaration of the function whose parameter count is larger
30-
// than the number of call arguments
31-
exists(FunctionDeclarationEntry fde | fde = f.getADeclarationEntry() |
46+
// Produce an alert when all declarations that are authoritative on the
47+
// parameter count specify a parameter count larger than the number of call
48+
// arguments.
49+
forex(FunctionDeclarationEntry fde |
50+
fde = f.getADeclarationEntry() and
51+
hasDefiniteNumberOfParameters(fde)
52+
|
3253
fde.getNumberOfParameters() > fc.getNumberOfArguments()
3354
)
3455
}

cpp/ql/src/Metrics/History/HChurn.ql

Lines changed: 0 additions & 27 deletions
This file was deleted.

cpp/ql/src/Metrics/History/HLinesAdded.ql

Lines changed: 0 additions & 27 deletions
This file was deleted.

cpp/ql/src/Metrics/History/HLinesDeleted.ql

Lines changed: 0 additions & 27 deletions
This file was deleted.

cpp/ql/src/Metrics/History/HNumberOfAuthors.ql

Lines changed: 0 additions & 18 deletions
This file was deleted.

cpp/ql/src/Metrics/History/HNumberOfChanges.ql

Lines changed: 0 additions & 19 deletions
This file was deleted.

cpp/ql/src/Metrics/History/HNumberOfCoCommits.ql

Lines changed: 0 additions & 21 deletions
This file was deleted.

cpp/ql/src/Metrics/History/HNumberOfReCommits.ql

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)