Skip to content

Commit 47e35c5

Browse files
committed
Merge branch 'main' of github.com:github/codeql into MagicMethods
2 parents de1c75c + b1946c6 commit 47e35c5

File tree

350 files changed

+20369
-3049
lines changed

Some content is hidden

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

350 files changed

+20369
-3049
lines changed

change-notes/1.25/analysis-python.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ The following changes in version 1.25 affect Python analysis in all applications
2020
## Changes to libraries
2121

2222
* Importing `semmle.python.web.HttpRequest` will no longer import `UntrustedStringKind` transitively. `UntrustedStringKind` is the most commonly used non-abstract subclass of `ExternalStringKind`. If not imported (by one mean or another), taint-tracking queries that concern `ExternalStringKind` will not produce any results. Please ensure such queries contain an explicit import (`import semmle.python.security.strings.Untrusted`).
23+
* Added support for tainted f-strings.

change-notes/1.26/analysis-cpp.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ The following changes in version 1.26 affect C/C++ analysis in all applications.
1414
| **Query** | **Expected impact** | **Change** |
1515
|----------------------------|------------------------|------------------------------------------------------------------|
1616
| Inconsistent direction of for loop (`cpp/inconsistent-loop-direction`) | Fewer false positive results | The query now accounts for intentional wrapping of an unsigned loop counter. |
17+
| Overflow in uncontrolled allocation size (`cpp/uncontrolled-allocation-size`) | | The precision of this query has been decreased from "high" to "medium". As a result, the query is still run but results are no longer displayed on LGTM by default. |
1718
| Comparison result is always the same (`cpp/constant-comparison`) | More correct results | Bounds on expressions involving multiplication can now be determined in more cases. |
1819

1920
## Changes to libraries
2021

21-
* The models library now models more taint flows through `std::string`.
22+
* The models library now models some taint flows through `std::array`, `std::vector`, `std::deque`, `std::list` and `std::forward_list`.
23+
* The models library now models many more taint flows through `std::string`.
2224
* The `SimpleRangeAnalysis` library now supports multiplications of the form
23-
`e1 * e2` when `e1` and `e2` are unsigned.
25+
`e1 * e2` and `x *= e2` when `e1` and `e2` are unsigned or constant.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Improvements to C# analysis
2+
3+
The following changes in version 1.26 affect C# analysis in all applications.
4+
5+
## New queries
6+
7+
| **Query** | **Tags** | **Purpose** |
8+
|-----------------------------|-----------|--------------------------------------------------------------------|
9+
10+
11+
## Changes to existing queries
12+
13+
| **Query** | **Expected impact** | **Change** |
14+
|------------------------------|------------------------|-----------------------------------|
15+
16+
17+
## Removal of old queries
18+
19+
## Changes to code extraction
20+
21+
* Partial method bodies are extracted. Previously, partial method bodies were skipped completely.
22+
23+
## Changes to libraries
24+
25+
## Changes to autobuilder
26+
27+
## Changes to tooling support
28+
29+
* The Abstract Syntax Tree of C# files can be printed in Visual Studio Code.

change-notes/1.26/analysis-javascript.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
- [pretty-format](https://www.npmjs.com/package/pretty-format)
1515
- [stringify-object](https://www.npmjs.com/package/stringify-object)
1616

17+
* Analyzing files with the ".cjs" extension is now supported.
18+
1719
## New queries
1820

1921
| **Query** | **Tags** | **Purpose** |
@@ -24,7 +26,7 @@
2426

2527
| **Query** | **Expected impact** | **Change** |
2628
|--------------------------------|------------------------------|---------------------------------------------------------------------------|
29+
| Incomplete URL substring sanitization (`js/incomplete-url-substring-sanitization`) | More results | This query now recognizes additional URLs when the substring check is an inclusion check. |
2730

2831

2932
## Changes to libraries
30-

cpp/ql/src/Security/CWE/CWE-190/TaintedAllocationSize.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* user can result in integer overflow.
55
* @kind path-problem
66
* @problem.severity error
7-
* @precision high
7+
* @precision medium
88
* @id cpp/uncontrolled-allocation-size
99
* @tags reliability
1010
* security
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* EXPERIMENTAL: The API of this module may change without notice.
3+
*
4+
* Provides a class for modeling `Expr`s with a restricted range.
5+
*/
6+
7+
import cpp
8+
import semmle.code.cpp.rangeanalysis.SimpleRangeAnalysis
9+
10+
/**
11+
* EXPERIMENTAL: The API of this class may change without notice.
12+
*
13+
* An expression for which a range can be deduced. Extend this class to add
14+
* functionality to the range analysis library.
15+
*/
16+
abstract class SimpleRangeAnalysisExpr extends Expr {
17+
/**
18+
* Gets the lower bound of the expression.
19+
*
20+
* Implementations of this predicate should use
21+
* `getFullyConvertedLowerBounds` and `getFullyConvertedUpperBounds` for
22+
* recursive calls to get the bounds of their children.
23+
*/
24+
abstract float getLowerBounds();
25+
26+
/**
27+
* Gets the upper bound of the expression.
28+
*
29+
* Implementations of this predicate should use
30+
* `getFullyConvertedLowerBounds` and `getFullyConvertedUpperBounds` for
31+
* recursive calls to get the bounds of their children.
32+
*/
33+
abstract float getUpperBounds();
34+
35+
/**
36+
* Holds if the range this expression depends on the definition `srcDef` for
37+
* StackVariable `srcVar`.
38+
*
39+
* Because this predicate cannot be recursive, most implementations should
40+
* override `dependsOnChild` instead.
41+
*/
42+
predicate dependsOnDef(RangeSsaDefinition srcDef, StackVariable srcVar) { none() }
43+
44+
/**
45+
* Holds if this expression depends on the range of its unconverted
46+
* subexpression `child`. This information is used to inform the range
47+
* analysis about cyclic dependencies. Without this information, range
48+
* analysis might work for simple cases but will go into infinite loops on
49+
* complex code.
50+
*
51+
* For example, when modeling a function call whose return value depends on
52+
* all of its arguments, implement this predicate as
53+
* `child = this.getAnArgument()`.
54+
*/
55+
abstract predicate dependsOnChild(Expr child);
56+
}
57+
58+
import SimpleRangeAnalysisInternal
59+
60+
/**
61+
* This class exists to prevent the QL front end from emitting compile errors
62+
* inside `SimpleRangeAnalysis.qll` about certain conjuncts being empty
63+
* because the overrides of `SimpleRangeAnalysisExpr` that happen to be in
64+
* scope do not make use of every feature it offers.
65+
*/
66+
private class Empty extends SimpleRangeAnalysisExpr {
67+
Empty() {
68+
// This predicate is complicated enough that the QL type checker doesn't
69+
// see it as empty but simple enough that the optimizer should.
70+
this = this and none()
71+
}
72+
73+
override float getLowerBounds() { none() }
74+
75+
override float getUpperBounds() { none() }
76+
77+
override predicate dependsOnChild(Expr child) { none() }
78+
}

0 commit comments

Comments
 (0)