Skip to content

Commit 245be44

Browse files
author
Alvaro Muñoz
authored
Merge branch 'main' into javascript_xss_improvements
2 parents 41fea77 + c6b62c9 commit 245be44

File tree

2,102 files changed

+45054
-64739
lines changed

Some content is hidden

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

2,102 files changed

+45054
-64739
lines changed

.github/workflows/qhelp-pr-preview.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on:
2727
- main
2828
- "rc/*"
2929
paths:
30-
- "ruby/**/*.qhelp"
30+
- "**/*.qhelp"
3131

3232
jobs:
3333
qhelp:
@@ -52,7 +52,7 @@ jobs:
5252
id: changes
5353
run: |
5454
(git diff -z --name-only --diff-filter=ACMRT HEAD~1 HEAD | grep -z '.qhelp$' | grep -z -v '.inc.qhelp';
55-
git diff -z --name-only --diff-filter=ACMRT HEAD~1 HEAD | grep -z '.inc.qhelp$' | xargs --null -rn1 basename | xargs --null -rn1 git grep -z -l) |
55+
git diff -z --name-only --diff-filter=ACMRT HEAD~1 HEAD | grep -z '.inc.qhelp$' | xargs --null -rn1 basename -z | xargs --null -rn1 git grep -z -l) |
5656
grep -z '.qhelp$' | grep -z -v '^-' | sort -z -u > "${RUNNER_TEMP}/paths.txt"
5757
5858
- name: QHelp preview
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Swift: Build and test Xcode autobuilder"
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "swift/xcode-autobuilder/**"
7+
- "misc/bazel/**"
8+
- "*.bazel*"
9+
- .github/workflows/swift-autobuilder.yml
10+
branches:
11+
- main
12+
13+
jobs:
14+
autobuilder:
15+
runs-on: macos-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: bazelbuild/setup-bazelisk@v2
19+
- uses: actions/setup-python@v3
20+
- name: Build the Xcode autobuilder
21+
run: |
22+
bazel build //swift/xcode-autobuilder
23+
- name: Test the Xcode autobuilder
24+
run: |
25+
bazel test //swift/xcode-autobuilder/tests

config/identical-files.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl4.qll",
3434
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl.qll",
3535
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl2.qll",
36-
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForLibraries.qll",
36+
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForRegExp.qll",
3737
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForHttpClientLibraries.qll",
38+
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForPathname.qll",
3839
"swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImpl.qll"
3940
],
4041
"DataFlow Java/C++/C#/Python Common": [
@@ -69,7 +70,6 @@
6970
"python/ql/lib/semmle/python/dataflow/new/internal/tainttracking3/TaintTrackingImpl.qll",
7071
"python/ql/lib/semmle/python/dataflow/new/internal/tainttracking4/TaintTrackingImpl.qll",
7172
"ruby/ql/lib/codeql/ruby/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
72-
"ruby/ql/lib/codeql/ruby/dataflow/internal/tainttrackingforlibraries/TaintTrackingImpl.qll",
7373
"swift/ql/lib/codeql/swift/dataflow/internal/tainttracking1/TaintTrackingImpl.qll"
7474
],
7575
"DataFlow Java/C++/C#/Python Consistency checks": [

cpp/ql/lib/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.1
2+
3+
No user-facing changes.
4+
15
## 0.4.0
26

37
### Deprecated APIs
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.4.1
2+
3+
No user-facing changes.

cpp/ql/lib/codeql-pack.release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 0.4.0
2+
lastReleaseVersion: 0.4.1

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ module ProductFlow {
133133
this.isAdditionalFlowStep2(node1, node2)
134134
}
135135

136+
/**
137+
* Holds if data flow into `node` is prohibited in the first projection of the product
138+
* dataflow graph.
139+
*/
140+
predicate isBarrierIn1(DataFlow::Node node) { none() }
141+
142+
/**
143+
* Holds if data flow into `node` is prohibited in the second projection of the product
144+
* dataflow graph.
145+
*/
146+
predicate isBarrierIn2(DataFlow::Node node) { none() }
147+
136148
predicate hasFlowPath(
137149
DataFlow::PathNode source1, DataFlow2::PathNode source2, DataFlow::PathNode sink1,
138150
DataFlow2::PathNode sink2
@@ -169,6 +181,10 @@ module ProductFlow {
169181
) {
170182
exists(Configuration conf | conf.isAdditionalFlowStep1(node1, state1, node2, state2))
171183
}
184+
185+
override predicate isBarrierIn(DataFlow::Node node) {
186+
exists(Configuration conf | conf.isBarrierIn1(node))
187+
}
172188
}
173189

174190
class Conf2 extends DataFlow2::Configuration {
@@ -202,9 +218,14 @@ module ProductFlow {
202218
) {
203219
exists(Configuration conf | conf.isAdditionalFlowStep2(node1, state1, node2, state2))
204220
}
221+
222+
override predicate isBarrierIn(DataFlow::Node node) {
223+
exists(Configuration conf | conf.isBarrierIn2(node))
224+
}
205225
}
206226
}
207227

228+
pragma[nomagic]
208229
private predicate reachableInterprocEntry(
209230
Configuration conf, DataFlow::PathNode source1, DataFlow2::PathNode source2,
210231
DataFlow::PathNode node1, DataFlow2::PathNode node2

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
163163
/**
164164
* Holds if data may flow from some source to `sink` for this configuration.
165165
*/
166-
predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
166+
predicate hasFlowTo(Node sink) {
167+
sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
168+
}
167169

168170
/**
169171
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
836838
* by `revFlow`.
837839
*/
838840
pragma[nomagic]
839-
predicate revFlowIsReadAndStored(Content c, Configuration conf) {
841+
additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
840842
revFlowConsCand(c, conf) and
841843
revFlowStore(c, _, _, conf)
842844
}
843845

844846
pragma[nomagic]
845-
predicate viableReturnPosOutNodeCandFwd1(
847+
additional predicate viableReturnPosOutNodeCandFwd1(
846848
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
847849
) {
848850
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
858860
}
859861

860862
pragma[nomagic]
861-
predicate viableParamArgNodeCandFwd1(
863+
additional predicate viableParamArgNodeCandFwd1(
862864
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
863865
) {
864866
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
905907
)
906908
}
907909

908-
predicate revFlowState(FlowState state, Configuration config) {
910+
additional predicate revFlowState(FlowState state, Configuration config) {
909911
exists(NodeEx node |
910912
sinkNode(node, state, config) and
911913
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
997999
)
9981000
}
9991001

1000-
predicate stats(
1002+
additional predicate stats(
10011003
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
10021004
) {
10031005
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage<StageSig PrevStage> {
12581260
* argument.
12591261
*/
12601262
pragma[nomagic]
1261-
predicate fwdFlow(
1263+
additional predicate fwdFlow(
12621264
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
12631265
) {
12641266
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage<StageSig PrevStage> {
14821484
* the access path of the returned value.
14831485
*/
14841486
pragma[nomagic]
1485-
predicate revFlow(
1487+
additional predicate revFlow(
14861488
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
14871489
) {
14881490
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage<StageSig PrevStage> {
16601662
)
16611663
}
16621664

1663-
predicate revFlow(NodeEx node, FlowState state, Configuration config) {
1665+
additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
16641666
revFlow(node, state, _, _, _, config)
16651667
}
16661668

@@ -1673,11 +1675,13 @@ private module MkStage<StageSig PrevStage> {
16731675

16741676
// use an alias as a workaround for bad functionality-induced joins
16751677
pragma[nomagic]
1676-
predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
1678+
additional predicate revFlowAlias(NodeEx node, Configuration config) {
1679+
revFlow(node, _, _, _, _, config)
1680+
}
16771681

16781682
// use an alias as a workaround for bad functionality-induced joins
16791683
pragma[nomagic]
1680-
predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
1684+
additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
16811685
revFlow(node, state, ap, config)
16821686
}
16831687

@@ -1698,7 +1702,7 @@ private module MkStage<StageSig PrevStage> {
16981702
)
16991703
}
17001704

1701-
predicate consCand(TypedContent tc, Ap ap, Configuration config) {
1705+
additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
17021706
revConsCand(tc, ap, config) and
17031707
validAp(ap, config)
17041708
}
@@ -1740,7 +1744,7 @@ private module MkStage<StageSig PrevStage> {
17401744
)
17411745
}
17421746

1743-
predicate stats(
1747+
additional predicate stats(
17441748
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
17451749
) {
17461750
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
29252929
result = this.getASuccessorImpl()
29262930
}
29272931

2928-
final PathNodeImpl getANonHiddenSuccessor() {
2929-
result = this.getASuccessorImpl().getASuccessorIfHidden*() and
2930-
not this.isHidden() and
2932+
pragma[nomagic]
2933+
private PathNodeImpl getANonHiddenSuccessor0() {
2934+
result = this.getASuccessorIfHidden*() and
29312935
not result.isHidden()
29322936
}
29332937

2938+
final PathNodeImpl getANonHiddenSuccessor() {
2939+
result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
2940+
not this.isHidden()
2941+
}
2942+
29342943
abstract NodeEx getNodeEx();
29352944

29362945
predicate isHidden() {

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ abstract class Configuration extends string {
163163
/**
164164
* Holds if data may flow from some source to `sink` for this configuration.
165165
*/
166-
predicate hasFlowTo(Node sink) { this.hasFlow(_, sink) }
166+
predicate hasFlowTo(Node sink) {
167+
sink = any(PathNodeSink n | this = n.getConfiguration()).getNodeEx().asNode()
168+
}
167169

168170
/**
169171
* Holds if data may flow from some source to `sink` for this configuration.
@@ -836,13 +838,13 @@ private module Stage1 implements StageSig {
836838
* by `revFlow`.
837839
*/
838840
pragma[nomagic]
839-
predicate revFlowIsReadAndStored(Content c, Configuration conf) {
841+
additional predicate revFlowIsReadAndStored(Content c, Configuration conf) {
840842
revFlowConsCand(c, conf) and
841843
revFlowStore(c, _, _, conf)
842844
}
843845

844846
pragma[nomagic]
845-
predicate viableReturnPosOutNodeCandFwd1(
847+
additional predicate viableReturnPosOutNodeCandFwd1(
846848
DataFlowCall call, ReturnPosition pos, NodeEx out, Configuration config
847849
) {
848850
fwdFlowReturnPosition(pos, _, config) and
@@ -858,7 +860,7 @@ private module Stage1 implements StageSig {
858860
}
859861

860862
pragma[nomagic]
861-
predicate viableParamArgNodeCandFwd1(
863+
additional predicate viableParamArgNodeCandFwd1(
862864
DataFlowCall call, ParamNodeEx p, ArgNodeEx arg, Configuration config
863865
) {
864866
viableParamArgEx(call, p, arg) and
@@ -905,7 +907,7 @@ private module Stage1 implements StageSig {
905907
)
906908
}
907909

908-
predicate revFlowState(FlowState state, Configuration config) {
910+
additional predicate revFlowState(FlowState state, Configuration config) {
909911
exists(NodeEx node |
910912
sinkNode(node, state, config) and
911913
revFlow(node, _, pragma[only_bind_into](config)) and
@@ -997,7 +999,7 @@ private module Stage1 implements StageSig {
997999
)
9981000
}
9991001

1000-
predicate stats(
1002+
additional predicate stats(
10011003
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
10021004
) {
10031005
fwd = true and
@@ -1258,7 +1260,7 @@ private module MkStage<StageSig PrevStage> {
12581260
* argument.
12591261
*/
12601262
pragma[nomagic]
1261-
predicate fwdFlow(
1263+
additional predicate fwdFlow(
12621264
NodeEx node, FlowState state, Cc cc, ApOption argAp, Ap ap, Configuration config
12631265
) {
12641266
fwdFlow0(node, state, cc, argAp, ap, config) and
@@ -1482,7 +1484,7 @@ private module MkStage<StageSig PrevStage> {
14821484
* the access path of the returned value.
14831485
*/
14841486
pragma[nomagic]
1485-
predicate revFlow(
1487+
additional predicate revFlow(
14861488
NodeEx node, FlowState state, boolean toReturn, ApOption returnAp, Ap ap, Configuration config
14871489
) {
14881490
revFlow0(node, state, toReturn, returnAp, ap, config) and
@@ -1660,7 +1662,7 @@ private module MkStage<StageSig PrevStage> {
16601662
)
16611663
}
16621664

1663-
predicate revFlow(NodeEx node, FlowState state, Configuration config) {
1665+
additional predicate revFlow(NodeEx node, FlowState state, Configuration config) {
16641666
revFlow(node, state, _, _, _, config)
16651667
}
16661668

@@ -1673,11 +1675,13 @@ private module MkStage<StageSig PrevStage> {
16731675

16741676
// use an alias as a workaround for bad functionality-induced joins
16751677
pragma[nomagic]
1676-
predicate revFlowAlias(NodeEx node, Configuration config) { revFlow(node, _, _, _, _, config) }
1678+
additional predicate revFlowAlias(NodeEx node, Configuration config) {
1679+
revFlow(node, _, _, _, _, config)
1680+
}
16771681

16781682
// use an alias as a workaround for bad functionality-induced joins
16791683
pragma[nomagic]
1680-
predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
1684+
additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap, Configuration config) {
16811685
revFlow(node, state, ap, config)
16821686
}
16831687

@@ -1698,7 +1702,7 @@ private module MkStage<StageSig PrevStage> {
16981702
)
16991703
}
17001704

1701-
predicate consCand(TypedContent tc, Ap ap, Configuration config) {
1705+
additional predicate consCand(TypedContent tc, Ap ap, Configuration config) {
17021706
revConsCand(tc, ap, config) and
17031707
validAp(ap, config)
17041708
}
@@ -1740,7 +1744,7 @@ private module MkStage<StageSig PrevStage> {
17401744
)
17411745
}
17421746

1743-
predicate stats(
1747+
additional predicate stats(
17441748
boolean fwd, int nodes, int fields, int conscand, int states, int tuples, Configuration config
17451749
) {
17461750
fwd = true and
@@ -2925,12 +2929,17 @@ abstract private class PathNodeImpl extends PathNode {
29252929
result = this.getASuccessorImpl()
29262930
}
29272931

2928-
final PathNodeImpl getANonHiddenSuccessor() {
2929-
result = this.getASuccessorImpl().getASuccessorIfHidden*() and
2930-
not this.isHidden() and
2932+
pragma[nomagic]
2933+
private PathNodeImpl getANonHiddenSuccessor0() {
2934+
result = this.getASuccessorIfHidden*() and
29312935
not result.isHidden()
29322936
}
29332937

2938+
final PathNodeImpl getANonHiddenSuccessor() {
2939+
result = this.getASuccessorImpl().getANonHiddenSuccessor0() and
2940+
not this.isHidden()
2941+
}
2942+
29342943
abstract NodeEx getNodeEx();
29352944

29362945
predicate isHidden() {

0 commit comments

Comments
 (0)