Skip to content

Commit 443c13d

Browse files
authored
Merge pull request #2 from aschackmull/java/spring-3653-2
Java: Fix qltests for #3653
2 parents 3fef5ca + b88ebd6 commit 443c13d

File tree

1,586 files changed

+82043
-45664
lines changed

Some content is hidden

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

1,586 files changed

+82043
-45664
lines changed

.github/codeql/codeql-config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: "CodeQL config"
2+
3+
queries:
4+
- uses: security-and-quality
5+
6+
paths-ignore:
7+
- '/cpp/'
8+
- '/java/'
9+
- '/python/'

.github/workflows/codeql-analysis.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Code scanning - action"
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 9 * * 1'
8+
9+
jobs:
10+
CodeQL-Build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
with:
18+
# We must fetch at least the immediate parents so that if this is
19+
# a pull request then we can checkout the head.
20+
fetch-depth: 2
21+
22+
# If this run was triggered by a pull request event, then checkout
23+
# the head of the pull request instead of the merge commit.
24+
- run: git checkout HEAD^2
25+
if: ${{ github.event_name == 'pull_request' }}
26+
27+
# Initializes the CodeQL tools for scanning.
28+
- name: Initialize CodeQL
29+
uses: github/codeql-action/init@v1
30+
# Override language selection by uncommenting this and choosing your languages
31+
with:
32+
languages: csharp
33+
config-file: ./.github/codeql/codeql-config.yml
34+
35+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
36+
# If this step fails, then you should remove it and run the build manually (see below)
37+
- name: Autobuild
38+
uses: github/codeql-action/autobuild@v1
39+
40+
# ℹ️ Command-line programs to run using the OS shell.
41+
# 📚 https://git.io/JvXDl
42+
43+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
44+
# and modify them (or add more) to build your code if your project
45+
# uses a compiled language
46+
47+
#- run: |
48+
# make bootstrap
49+
# make release
50+
51+
- name: Perform CodeQL Analysis
52+
uses: github/codeql-action/analyze@v1

change-notes/1.25/analysis-cpp.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ The following changes in version 1.25 affect C/C++ analysis in all applications.
1313

1414
| **Query** | **Expected impact** | **Change** |
1515
|----------------------------|------------------------|------------------------------------------------------------------|
16+
| Uncontrolled format string (`cpp/tainted-format-string`) | | This query is now displayed by default on LGTM. |
17+
| Uncontrolled format string (through global variable) (`cpp/tainted-format-string-through-global`) | | This query is now displayed by default on LGTM. |
1618

1719
## Changes to libraries
1820

change-notes/1.25/analysis-javascript.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,49 @@
66
- [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
77
- [bluebird](http://bluebirdjs.com/)
88
- [express](https://www.npmjs.com/package/express)
9+
- [fancy-log](https://www.npmjs.com/package/fancy-log)
910
- [fastify](https://www.npmjs.com/package/fastify)
1011
- [fstream](https://www.npmjs.com/package/fstream)
1112
- [jGrowl](https://github.com/stanlemon/jGrowl)
1213
- [jQuery](https://jquery.com/)
1314
- [marsdb](https://www.npmjs.com/package/marsdb)
15+
- [micro](https://www.npmjs.com/package/micro/)
1416
- [minimongo](https://www.npmjs.com/package/minimongo/)
1517
- [mssql](https://www.npmjs.com/package/mssql)
1618
- [mysql](https://www.npmjs.com/package/mysql)
19+
- [npmlog](https://www.npmjs.com/package/npmlog)
1720
- [pg](https://www.npmjs.com/package/pg)
1821
- [sequelize](https://www.npmjs.com/package/sequelize)
1922
- [spanner](https://www.npmjs.com/package/spanner)
2023
- [sqlite](https://www.npmjs.com/package/sqlite)
2124
- [ssh2-streams](https://www.npmjs.com/package/ssh2-streams)
2225
- [ssh2](https://www.npmjs.com/package/ssh2)
26+
- [vue](https://www.npmjs.com/package/vue)
27+
- [yargs](https://www.npmjs.com/package/yargs)
28+
- [webpack-dev-server](https://www.npmjs.com/package/webpack-dev-server)
2329

2430
* TypeScript 3.9 is now supported.
2531

32+
* TypeScript code embedded in HTML and Vue files is now extracted and analyzed.
33+
2634
* The analysis of sanitizers has improved, leading to more accurate
2735
results from the security queries.
2836

2937
## New queries
3038

3139
| **Query** | **Tags** | **Purpose** |
3240
|---------------------------------------------------------------------------------|-------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
33-
| Cross-site scripting through DOM (`js/xss-through-dom`) | security, external/cwe/cwe-079, external/cwe/cwe-116 | Highlights potential XSS vulnerabilities where existing text from the DOM is used as HTML. Results are not shown on LGTM by default. |
41+
| DOM text reinterpreted as HTML (`js/xss-through-dom`) | security, external/cwe/cwe-079, external/cwe/cwe-116 | Highlights potential XSS vulnerabilities where existing text from the DOM is used as HTML. Results are shown on LGTM by default. |
3442
| Incomplete HTML attribute sanitization (`js/incomplete-html-attribute-sanitization`) | security, external/cwe/cwe-20, external/cwe/cwe-079, external/cwe/cwe-116 | Highlights potential XSS vulnerabilities due to incomplete sanitization of HTML meta-characters. Results are shown on LGTM by default. |
3543
| Unsafe expansion of self-closing HTML tag (`js/unsafe-html-expansion`) | security, external/cwe/cwe-079, external/cwe/cwe-116 | Highlights potential XSS vulnerabilities caused by unsafe expansion of self-closing HTML tags. |
3644
| Unsafe shell command constructed from library input (`js/shell-command-constructed-from-input`) | correctness, security, external/cwe/cwe-078, external/cwe/cwe-088 | Highlights potential command injections due to a shell command being constructed from library inputs. Results are shown on LGTM by default. |
45+
| Download of sensitive file through insecure connection (`js/insecure-download`) | security, external/cwe/cwe-829 | Highlights downloads of sensitive files through an unencrypted protocol. Results are shown on LGTM by default. |
46+
| Exposure of private files (`js/exposure-of-private-files`) | security, external/cwe/cwe-200 | Highlights servers that serve private files. Results are shown on LGTM by default. |
47+
| Creating biased random numbers from a cryptographically secure source (`js/biased-cryptographic-random`) | security, external/cwe/cwe-327 | Highlights mathematical operations on cryptographically secure numbers that can create biased results. Results are shown on LGTM by default. |
48+
| Storage of sensitive information in build artifact (`js/build-artifact-leak`) | security, external/cwe/cwe-312 | Highlights storage of sensitive information in build artifacts. Results are shown on LGTM by default. |
49+
| Improper code sanitization (`js/bad-code-sanitization`) | security, external/cwe/cwe-094, external/cwe/cwe-079, external/cwe/cwe-116 | Highlights string concatenation where code is constructed without proper sanitization. Results are shown on LGTM by default. |
50+
| Disabling certificate validation (`js/disabling-certificate-validation`) | security, external/cwe-295 | Highlights locations where SSL certificate validation is disabled. Results are shown on LGTM by default. |
51+
| Incomplete multi-character sanitization (`js/incomplete-multi-character-sanitization`) | correctness, security, external/cwe/cwe-20, external/cwe/cwe-116 | Highlights sanitizers that fail to remove dangerous substrings completely. Results are shown on LGTM by default. |
3752

3853
## Changes to existing queries
3954

@@ -42,14 +57,19 @@
4257
| Client-side cross-site scripting (`js/xss`) | Fewer results | This query now recognizes additional safe patterns of constructing HTML. |
4358
| Client-side URL redirect (`js/client-side-unvalidated-url-redirection`) | Fewer results | This query now recognizes additional safe patterns of doing URL redirects. |
4459
| Code injection (`js/code-injection`) | More results | More potential vulnerabilities involving NoSQL code operators are now recognized. |
60+
| Exception text reinterpreted as HTML (`js/exception-xss`) | Rephrased and changed visibility | Rephrased name and alert message. Severity lowered from error to warning. Results are now shown on LGTM by default. |
4561
| 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. |
4662
| Hard-coded credentials (`js/hardcoded-credentials`) | More results | This query now recognizes hard-coded credentials sent via HTTP authorization headers. |
4763
| Incomplete URL scheme check (`js/incomplete-url-scheme-check`) | More results | This query now recognizes additional url scheme checks. |
64+
| Insecure randomness (`js/insecure-randomness`) | Fewer results | This query now recognizes when an insecure random value is used as a fallback when secure random values are unsupported. |
4865
| Misspelled variable name (`js/misspelled-variable-name`) | Message changed | The message for this query now correctly identifies the misspelled variable in additional cases. |
66+
| Non-linear pattern (`js/non-linear-pattern`) | Fewer duplicates and message changed | This query now generates fewer duplicate alerts and has a clearer explanation in case of type annotations used in a pattern. |
4967
| Prototype pollution in utility function (`js/prototype-pollution-utility`) | More results | This query now recognizes additional utility functions as vulnerable to prototype polution. |
5068
| Uncontrolled command line (`js/command-line-injection`) | More results | This query now recognizes additional command execution calls. |
5169
| Uncontrolled data used in path expression (`js/path-injection`) | More results | This query now recognizes additional file system calls. |
70+
| Uncontrolled data used in path expression (`js/path-injection`) | Fewer results | This query no longer flags paths that have been checked to be part of a collection. |
5271
| Unknown directive (`js/unknown-directive`) | Fewer results | This query no longer flags directives generated by the Babel compiler. |
72+
| Unneeded defensive code (`js/unneeded-defensive-code`) | Fewer false-positive results | This query now recognizes checks meant to handle the `document.all` object. |
5373
| Unused property (`js/unused-property`) | Fewer results | This query no longer flags properties of objects that are operands of `yield` expressions. |
5474
| Zip Slip (`js/zipslip`) | More results | This query now recognizes additional vulnerabilities. |
5575

@@ -85,3 +105,4 @@ The following low-precision queries are no longer run by default on LGTM (their
85105
- `ParameterNode.asExpr()` and `.getAstNode()` now gets the parameter's AST node, whereas previously it had no result.
86106
- `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.
87107
* 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".
108+
* The predicates `Type.getProperty()` and variants of `Type.getMethod()` have been deprecated due to lack of use-cases. Looking up a named property of a static type is no longer supported, favoring faster extraction times instead.

config/identical-files.json

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"DataFlow Java/C++/C#": [
2+
"DataFlow Java/C++/C#/Python": [
33
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll",
44
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll",
55
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll",
@@ -18,15 +18,18 @@
1818
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll",
1919
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll",
2020
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll",
21-
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll"
21+
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll",
22+
"python/ql/src/experimental/dataflow/internal/DataFlowImpl.qll",
23+
"python/ql/src/experimental/dataflow/internal/DataFlowImpl2.qll"
2224
],
23-
"DataFlow Java/C++/C# Common": [
25+
"DataFlow Java/C++/C#/Python Common": [
2426
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll",
2527
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll",
2628
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll",
27-
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImplCommon.qll"
29+
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImplCommon.qll",
30+
"python/ql/src/experimental/dataflow/internal/DataFlowImplCommon.qll"
2831
],
29-
"TaintTracking::Configuration Java/C++/C#": [
32+
"TaintTracking::Configuration Java/C++/C#/Python": [
3033
"cpp/ql/src/semmle/code/cpp/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
3134
"cpp/ql/src/semmle/code/cpp/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
3235
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
@@ -37,13 +40,15 @@
3740
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking4/TaintTrackingImpl.qll",
3841
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking5/TaintTrackingImpl.qll",
3942
"java/ql/src/semmle/code/java/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
40-
"java/ql/src/semmle/code/java/dataflow/internal/tainttracking2/TaintTrackingImpl.qll"
43+
"java/ql/src/semmle/code/java/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
44+
"python/ql/src/experimental/dataflow/internal/tainttracking1/TaintTrackingImpl.qll"
4145
],
42-
"DataFlow Java/C++/C# Consistency checks": [
46+
"DataFlow Java/C++/C#/Python Consistency checks": [
4347
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll",
4448
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll",
4549
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll",
46-
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImplConsistency.qll"
50+
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImplConsistency.qll",
51+
"python/ql/src/experimental/dataflow/internal/DataFlowImplConsistency.qll"
4752
],
4853
"C++ SubBasicBlocks": [
4954
"cpp/ql/src/semmle/code/cpp/controlflow/SubBasicBlocks.qll",
@@ -96,10 +101,18 @@
96101
"cpp/ql/src/semmle/code/cpp/ir/implementation/UseSoundEscapeAnalysis.qll",
97102
"csharp/ql/src/experimental/ir/implementation/UseSoundEscapeAnalysis.qll"
98103
],
104+
"IR IRFunctionBase": [
105+
"cpp/ql/src/semmle/code/cpp/ir/implementation/internal/IRFunctionBase.qll",
106+
"csharp/ql/src/experimental/ir/implementation/internal/IRFunctionBase.qll"
107+
],
99108
"IR Operand Tag": [
100109
"cpp/ql/src/semmle/code/cpp/ir/implementation/internal/OperandTag.qll",
101110
"csharp/ql/src/experimental/ir/implementation/internal/OperandTag.qll"
102111
],
112+
"IR TInstruction":[
113+
"cpp/ql/src/semmle/code/cpp/ir/implementation/internal/TInstruction.qll",
114+
"csharp/ql/src/experimental/ir/implementation/internal/TInstruction.qll"
115+
],
103116
"IR TIRVariable":[
104117
"cpp/ql/src/semmle/code/cpp/ir/implementation/internal/TIRVariable.qll",
105118
"csharp/ql/src/experimental/ir/implementation/internal/TIRVariable.qll"
@@ -177,6 +190,11 @@
177190
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/IRBlockImports.qll",
178191
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/IRBlockImports.qll"
179192
],
193+
"C++ IR IRFunctionImports": [
194+
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/IRFunctionImports.qll",
195+
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/IRFunctionImports.qll",
196+
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/IRFunctionImports.qll"
197+
],
180198
"C++ IR IRVariableImports": [
181199
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/IRVariableImports.qll",
182200
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/IRVariableImports.qll",
@@ -287,6 +305,10 @@
287305
"csharp/ql/src/experimental/ir/implementation/raw/internal/IRBlockImports.qll",
288306
"csharp/ql/src/experimental/ir/implementation/unaliased_ssa/internal/IRBlockImports.qll"
289307
],
308+
"C# IR IRFunctionImports": [
309+
"csharp/ql/src/experimental/ir/implementation/raw/internal/IRFunctionImports.qll",
310+
"csharp/ql/src/experimental/ir/implementation/unaliased_ssa/internal/IRFunctionImports.qll"
311+
],
290312
"C# IR IRVariableImports": [
291313
"csharp/ql/src/experimental/ir/implementation/raw/internal/IRVariableImports.qll",
292314
"csharp/ql/src/experimental/ir/implementation/unaliased_ssa/internal/IRVariableImports.qll"

0 commit comments

Comments
 (0)