Skip to content

Commit 4a77f2b

Browse files
committed
Merge remote-tracking branch 'upstream/master' into ir-crement-load
Update test output to fix semantic merge conflict.
2 parents 9a45c55 + d7e8ea7 commit 4a77f2b

File tree

268 files changed

+7686
-963
lines changed

Some content is hidden

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

268 files changed

+7686
-963
lines changed

change-notes/1.24/analysis-cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ The following changes in version 1.24 affect C/C++ analysis in all applications.
4040
* The taint tracking library (`semmle.code.cpp.dataflow.TaintTracking`) has had
4141
the following improvements:
4242
* The library now models data flow through `strdup` and similar functions.
43-
43+
* The library now models data flow through formatting functions such as `sprintf`.

change-notes/1.24/analysis-java.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,25 @@ The following changes in version 1.24 affect Java analysis in all applications.
1010

1111
| **Query** | **Tags** | **Purpose** |
1212
|-----------------------------|-----------|--------------------------------------------------------------------|
13+
| Disabled Spring CSRF protection (`java/spring-disabled-csrf-protection`) | security, external/cwe/cwe-352 | Finds disabled Cross-Site Request Forgery (CSRF) protection in Spring. |
1314
| Failure to use HTTPS or SFTP URL in Maven artifact upload/download (`java/maven/non-https-url`) | security, external/cwe/cwe-300, external/cwe/cwe-319, external/cwe/cwe-494, external/cwe/cwe-829 | Finds use of insecure protocols during Maven dependency resolution. Results are shown on LGTM by default. |
15+
| Left shift by more than the type width (`java/lshift-larger-than-type-width`) | correctness | Finds left shifts of ints by 32 bits or more and left shifts of longs by 64 bits or more. Results are shown on LGTM by default. |
16+
| Suspicious date format (`java/suspicious-date-format`) | correctness | Finds date format patterns that use placeholders that are likely to be incorrect. |
1417

1518
## Changes to existing queries
1619

1720
| **Query** | **Expected impact** | **Change** |
1821
|------------------------------|------------------------|-----------------------------------|
1922
| Dereferenced variable may be null (`java/dereferenced-value-may-be-null`) | Fewer false positives | Final fields with a non-null initializer are no longer reported. |
20-
| Expression always evaluates to the same value (`java/evaluation-to-constant`) | Fewer false positives | Expressions of the form `0 * x` are usually intended and no longer reported. |
23+
| Expression always evaluates to the same value (`java/evaluation-to-constant`) | Fewer false positives | Expressions of the form `0 * x` are usually intended and no longer reported. Also left shift of ints by 32 bits and longs by 64 bits are no longer reported as they are not constant, these results are instead reported by the new query `java/lshift-larger-than-type-width`. |
2124
| Useless null check (`java/useless-null-check`) | More true positives | Useless checks on final fields with a non-null initializer are now reported. |
2225

2326
## Changes to libraries
2427

28+
* Identification of test classes has been improved. Previously, one of the
29+
match conditions would classify any class with a name containing the string
30+
"Test" as a test class, but now this matching has been replaced with one that
31+
looks for the occurrence of actual unit-test annotations. This affects the
32+
general file classification mechanism and thus suppression of alerts, and
33+
also any security queries using taint tracking, as test classes act as
34+
default barriers stopping taint flow.

change-notes/1.24/analysis-javascript.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
- [Electron](https://electronjs.org/)
1717
- [Node.js](https://nodejs.org/)
1818
- [Socket.IO](https://socket.io/)
19+
- [ws](https://github.com/websockets/ws)
20+
- [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API)
1921

2022
## New queries
2123

@@ -36,6 +38,7 @@
3638
| Unbound event handler receiver (`js/unbound-event-handler-receiver`) | Fewer false positive results | This query now recognizes additional ways event handler receivers can be bound. |
3739
| Expression has no effect (`js/useless-expression`) | Fewer false positive results | The query now recognizes block-level flow type annotations and ignores the first statement of a try block. |
3840
| Use of call stack introspection in strict mode (`js/strict-mode-call-stack-introspection`) | Fewer false positive results | The query no longer flags expression statements. |
41+
| Missing CSRF middleware (`js/missing-token-validation`) | Fewer false positive results | The query reports fewer duplicates and only flags handlers that explicitly access cookie data. |
3942

4043
## Changes to libraries
4144

config/identical-files.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@
8282
"cpp/ql/src/semmle/code/cpp/ir/implementation/IRType.qll",
8383
"csharp/ql/src/semmle/code/csharp/ir/implementation/IRType.qll"
8484
],
85+
"IR IRConfiguration": [
86+
"cpp/ql/src/semmle/code/cpp/ir/implementation/IRConfiguration.qll",
87+
"csharp/ql/src/semmle/code/csharp/ir/implementation/IRConfiguration.qll"
88+
],
89+
"IR UseSoundEscapeAnalysis": [
90+
"cpp/ql/src/semmle/code/cpp/ir/implementation/UseSoundEscapeAnalysis.qll",
91+
"csharp/ql/src/semmle/code/csharp/ir/implementation/UseSoundEscapeAnalysis.qll"
92+
],
8593
"IR Operand Tag": [
8694
"cpp/ql/src/semmle/code/cpp/ir/implementation/internal/OperandTag.qll",
8795
"csharp/ql/src/semmle/code/csharp/ir/implementation/internal/OperandTag.qll"

cpp/ql/src/Critical/DescriptorNeverClosed.qhelp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
<overview>
88
<p>
9-
This rule finds calls to <code>open</code> or <code>socket</code> where there is no corresponding <code>close</code> call in the program analyzed.
9+
This rule finds calls to <code>socket</code> where there is no corresponding <code>close</code> call in the program analyzed.
1010
Leaving descriptors open will cause a resource leak that will persist even after the program terminates.
1111
</p>
1212

1313
<include src="aliasAnalysisWarning.qhelp" />
1414
</overview>
1515

1616
<recommendation>
17-
<p>Ensure that all file or socket descriptors allocated by the program are freed before it terminates.</p>
17+
<p>Ensure that all socket descriptors allocated by the program are freed before it terminates.</p>
1818
</recommendation>
1919

2020
<example>

cpp/ql/src/Critical/DescriptorNeverClosed.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @name Open descriptor never closed
3-
* @description Functions that always return before closing the socket or file they opened leak resources.
3+
* @description Functions that always return before closing the socket they opened leak resources.
44
* @kind problem
55
* @id cpp/descriptor-never-closed
66
* @problem.severity warning

cpp/ql/src/semmle/code/cpp/Parameter.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,8 @@ class Parameter extends LocalScopeVariable, @parameter {
163163
* An `int` that is a parameter index for some function. This is needed for binding in certain cases.
164164
*/
165165
class ParameterIndex extends int {
166-
ParameterIndex() { exists(Parameter p | this = p.getIndex()) }
166+
ParameterIndex() {
167+
exists(Parameter p | this = p.getIndex()) or
168+
exists(Call c | exists(c.getArgument(this))) // permit indexing varargs
169+
}
167170
}

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,6 @@ abstract class Configuration extends string {
139139
partialFlow(source, node, this) and
140140
dist = node.getSourceDistance()
141141
}
142-
143-
/** DEPRECATED: use `hasFlow` instead. */
144-
deprecated predicate hasFlowForward(Node source, Node sink) { hasFlow(source, sink) }
145-
146-
/** DEPRECATED: use `hasFlow` instead. */
147-
deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) }
148142
}
149143

150144
/**

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,6 @@ abstract class Configuration extends string {
139139
partialFlow(source, node, this) and
140140
dist = node.getSourceDistance()
141141
}
142-
143-
/** DEPRECATED: use `hasFlow` instead. */
144-
deprecated predicate hasFlowForward(Node source, Node sink) { hasFlow(source, sink) }
145-
146-
/** DEPRECATED: use `hasFlow` instead. */
147-
deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) }
148142
}
149143

150144
/**

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,6 @@ abstract class Configuration extends string {
139139
partialFlow(source, node, this) and
140140
dist = node.getSourceDistance()
141141
}
142-
143-
/** DEPRECATED: use `hasFlow` instead. */
144-
deprecated predicate hasFlowForward(Node source, Node sink) { hasFlow(source, sink) }
145-
146-
/** DEPRECATED: use `hasFlow` instead. */
147-
deprecated predicate hasFlowBackward(Node source, Node sink) { hasFlow(source, sink) }
148142
}
149143

150144
/**

0 commit comments

Comments
 (0)