Skip to content

Commit 9ddb485

Browse files
committed
Merge branch 'main' into cleartext-perf
2 parents 6b21563 + b49487c commit 9ddb485

File tree

1,542 files changed

+78184
-28655
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,542 files changed

+78184
-28655
lines changed

.bazelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
build --repo_env=CC=clang --repo_env=CXX=clang++ --copt="-std=c++17"
1+
build --repo_env=CC=clang --repo_env=CXX=clang++ --cxxopt="-std=c++17"
22

33
try-import %workspace%/local.bazelrc

.github/workflows/swift-codegen.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
pull_request:
55
paths:
66
- "swift/**"
7+
- "misc/bazel/**"
8+
- "*.bazel*"
79
- .github/workflows/swift-codegen.yml
810
- .github/actions/fetch-codeql/action.yml
911
branches:

.github/workflows/swift-integration-tests.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
pull_request:
55
paths:
66
- "swift/**"
7+
- "misc/bazel/**"
8+
- "*.bazel*"
79
- .github/workflows/swift-integration-tests.yml
810
- .github/actions/fetch-codeql/action.yml
911
- codeql-workspace.yml
@@ -30,6 +32,14 @@ jobs:
3032
- name: Build Swift extractor
3133
run: |
3234
bazel run //swift:create-extractor-pack
35+
- name: Get Swift version
36+
id: get_swift_version
37+
run: |
38+
VERSION=$(bazel run //swift/extractor -- --version | sed -ne 's/.*version \(\S*\).*/\1/p')
39+
echo "::set-output name=version::$VERSION"
40+
- uses: swift-actions/setup-swift@v1
41+
with:
42+
swift-version: "${{steps.get_swift_version.outputs.version}}"
3343
- name: Run integration tests
3444
run: |
3545
python integration-tests/runner.py

.github/workflows/swift-qltest.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
pull_request:
55
paths:
66
- "swift/**"
7+
- "misc/bazel/**"
8+
- "*.bazel*"
79
- .github/workflows/swift-qltest.yml
810
- .github/actions/fetch-codeql/action.yml
911
- codeql-workspace.yml

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
# Bazel (excluding BUILD.bazel files)
3232
WORKSPACE.bazel @github/codeql-ci-reviewers
33+
.bazelversion @github/codeql-ci-reviewers
34+
.bazelrc @github/codeql-ci-reviewers
3335
**/*.bzl @github/codeql-ci-reviewers
3436

3537
# Documentation etc

config/identical-files.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll",
1818
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll",
1919
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll",
20+
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll",
21+
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll",
22+
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll",
23+
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll",
2024
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll",
2125
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll",
2226
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll",
@@ -37,6 +41,7 @@
3741
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll",
3842
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll",
3943
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll",
44+
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll",
4045
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplCommon.qll",
4146
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplCommon.qll",
4247
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplCommon.qll",
@@ -48,6 +53,9 @@
4853
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
4954
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
5055
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
56+
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
57+
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
58+
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
5159
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
5260
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
5361
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
@@ -68,15 +76,17 @@
6876
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll",
6977
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll",
7078
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll",
79+
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll",
7180
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplConsistency.qll",
7281
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplConsistency.qll",
7382
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll",
7483
"swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplConsistency.qll"
7584
],
76-
"DataFlow Java/C# Flow Summaries": [
85+
"DataFlow Java/C#/Ruby/Python/Swift Flow Summaries": [
7786
"java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll",
7887
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll",
7988
"ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImpl.qll",
89+
"python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImpl.qll",
8090
"swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImpl.qll"
8191
],
8292
"SsaReadPosition Java/C#": [
@@ -532,7 +542,7 @@
532542
"java/ql/lib/semmle/code/java/dataflow/internal/AccessPathSyntax.qll",
533543
"javascript/ql/lib/semmle/javascript/frameworks/data/internal/AccessPathSyntax.qll",
534544
"ruby/ql/lib/codeql/ruby/dataflow/internal/AccessPathSyntax.qll",
535-
"python/ql/lib/semmle/python/frameworks/data/internal/AccessPathSyntax.qll",
545+
"python/ql/lib/semmle/python/dataflow/new/internal/AccessPathSyntax.qll",
536546
"swift/ql/lib/codeql/swift/dataflow/internal/AccessPathSyntax.qll"
537547
],
538548
"IncompleteUrlSubstringSanitization": [
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: fix
3+
---
4+
* Fixed an issue in the taint tracking analysis where implicit reads were not allowed by default in sinks or additional taint steps that used flow states.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
category: deprecated
3+
---
4+
* Some classes/modules with upper-case acronyms in their name have been renamed to follow our style-guide.
5+
The old name still exists as a deprecated alias.

cpp/ql/lib/experimental/semmle/code/cpp/dataflow/ProductFlow.qll

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import semmle.code.cpp.ir.dataflow.DataFlow
2-
import semmle.code.cpp.ir.dataflow.DataFlow2
1+
import experimental.semmle.code.cpp.ir.dataflow.DataFlow
2+
import experimental.semmle.code.cpp.ir.dataflow.DataFlow2
33

44
module ProductFlow {
55
abstract class Configuration extends string {
@@ -11,14 +11,43 @@ module ProductFlow {
1111
*
1212
* `source1` and `source2` must belong to the same callable.
1313
*/
14-
abstract predicate isSourcePair(DataFlow::Node source1, DataFlow::Node source2);
14+
predicate isSourcePair(DataFlow::Node source1, DataFlow::Node source2) { none() }
15+
16+
/**
17+
* Holds if `(source1, source2)` is a relevant data flow source with initial states `state1`
18+
* and `state2`, respectively.
19+
*
20+
* `source1` and `source2` must belong to the same callable.
21+
*/
22+
predicate isSourcePair(
23+
DataFlow::Node source1, string state1, DataFlow::Node source2, string state2
24+
) {
25+
state1 = "" and
26+
state2 = "" and
27+
this.isSourcePair(source1, source2)
28+
}
1529

1630
/**
1731
* Holds if `(sink1, sink2)` is a relevant data flow sink.
1832
*
1933
* `sink1` and `sink2` must belong to the same callable.
2034
*/
21-
abstract predicate isSinkPair(DataFlow::Node sink1, DataFlow::Node sink2);
35+
predicate isSinkPair(DataFlow::Node sink1, DataFlow::Node sink2) { none() }
36+
37+
/**
38+
* Holds if `(sink1, sink2)` is a relevant data flow sink with final states `state1`
39+
* and `state2`, respectively.
40+
*
41+
* `sink1` and `sink2` must belong to the same callable.
42+
*/
43+
predicate isSinkPair(
44+
DataFlow::Node sink1, DataFlow::FlowState state1, DataFlow::Node sink2,
45+
DataFlow::FlowState state2
46+
) {
47+
state1 = "" and
48+
state2 = "" and
49+
this.isSinkPair(sink1, sink2)
50+
}
2251

2352
predicate hasFlowPath(
2453
DataFlow::PathNode source1, DataFlow2::PathNode source2, DataFlow::PathNode sink1,
@@ -34,28 +63,28 @@ module ProductFlow {
3463
class Conf1 extends DataFlow::Configuration {
3564
Conf1() { this = "Conf1" }
3665

37-
override predicate isSource(DataFlow::Node source) {
38-
exists(Configuration conf | conf.isSourcePair(source, _))
66+
override predicate isSource(DataFlow::Node source, string state) {
67+
exists(Configuration conf | conf.isSourcePair(source, state, _, _))
3968
}
4069

41-
override predicate isSink(DataFlow::Node sink) {
42-
exists(Configuration conf | conf.isSinkPair(sink, _))
70+
override predicate isSink(DataFlow::Node sink, string state) {
71+
exists(Configuration conf | conf.isSinkPair(sink, state, _, _))
4372
}
4473
}
4574

4675
class Conf2 extends DataFlow2::Configuration {
4776
Conf2() { this = "Conf2" }
4877

49-
override predicate isSource(DataFlow::Node source) {
78+
override predicate isSource(DataFlow::Node source, string state) {
5079
exists(Configuration conf, DataFlow::Node source1 |
51-
conf.isSourcePair(source1, source) and
80+
conf.isSourcePair(source1, _, source, state) and
5281
any(Conf1 c).hasFlow(source1, _)
5382
)
5483
}
5584

56-
override predicate isSink(DataFlow::Node sink) {
85+
override predicate isSink(DataFlow::Node sink, string state) {
5786
exists(Configuration conf, DataFlow::Node sink1 |
58-
conf.isSinkPair(sink1, sink) and any(Conf1 c).hasFlow(_, sink1)
87+
conf.isSinkPair(sink1, _, sink, state) and any(Conf1 c).hasFlow(_, sink1)
5988
)
6089
}
6190
}
@@ -65,7 +94,7 @@ module ProductFlow {
6594
Configuration conf, DataFlow::PathNode source1, DataFlow2::PathNode source2,
6695
DataFlow::PathNode node1, DataFlow2::PathNode node2
6796
) {
68-
conf.isSourcePair(node1.getNode(), node2.getNode()) and
97+
conf.isSourcePair(node1.getNode(), _, node2.getNode(), _) and
6998
node1 = source1 and
7099
node2 = source2
71100
or
@@ -128,7 +157,7 @@ module ProductFlow {
128157
) {
129158
exists(DataFlow::PathNode mid1, DataFlow2::PathNode mid2 |
130159
reachableInterprocEntry(conf, source1, source2, mid1, mid2) and
131-
conf.isSinkPair(sink1.getNode(), sink2.getNode()) and
160+
conf.isSinkPair(sink1.getNode(), _, sink2.getNode(), _) and
132161
localPathStep1*(mid1, sink1) and
133162
localPathStep2*(mid2, sink2)
134163
)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Provides a library for local (intra-procedural) and global (inter-procedural)
3+
* data flow analysis: deciding whether data can flow from a _source_ to a
4+
* _sink_. This library differs from the one in `semmle.code.cpp.dataflow` in that
5+
* this library uses the IR (Intermediate Representation) library, which provides
6+
* a more precise semantic representation of the program, whereas the other dataflow
7+
* library uses the more syntax-oriented ASTs. This library should provide more accurate
8+
* results than the AST-based library in most scenarios.
9+
*
10+
* Unless configured otherwise, _flow_ means that the exact value of
11+
* the source may reach the sink. We do not track flow across pointer
12+
* dereferences or array indexing.
13+
*
14+
* To use global (interprocedural) data flow, extend the class
15+
* `DataFlow::Configuration` as documented on that class. To use local
16+
* (intraprocedural) data flow between expressions, call
17+
* `DataFlow::localExprFlow`. For more general cases of local data flow, call
18+
* `DataFlow::localFlow` or `DataFlow::localFlowStep` with arguments of type
19+
* `DataFlow::Node`.
20+
*/
21+
22+
import cpp
23+
24+
module DataFlow {
25+
import experimental.semmle.code.cpp.ir.dataflow.internal.DataFlowImpl
26+
}

0 commit comments

Comments
 (0)