Skip to content

Commit 37aac05

Browse files
committed
Replace branch with acceptingValue
1 parent a7fdc4b commit 37aac05

File tree

8 files changed

+67
-66
lines changed

8 files changed

+67
-66
lines changed

javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* - Barriers:
1414
* `type, path, kind`
1515
* - BarrierGuards:
16-
* `type, path, branch, kind`
16+
* `type, path, acceptingValue, kind`
1717
* - Types:
1818
* `type1, type2, path`
1919
*
@@ -46,7 +46,7 @@
4646
* 3. The `input` and `output` columns specify how data enters and leaves the element selected by the
4747
* first `(type, path)` tuple. Both strings are `.`-separated access paths
4848
* of the same syntax as the `path` column.
49-
* 4. The `branch` column of barrier guard models specifies which branch of the guard is blocking flow. It can be "true" or "false".
49+
* 4. The `acceptingValue` column of barrier guard models specifies which branch of the guard is blocking flow. It can be "true" or "false".
5050
* 5. The `kind` column is a tag that can be referenced from QL to determine to
5151
* which classes the interpreted elements should be added. For example, for
5252
* sources `"remote"` indicates a default remote flow source, and for summaries
@@ -360,11 +360,11 @@ private predicate barrierModel(string type, string path, string kind, string mod
360360

361361
/** Holds if a barrier guard model exists for the given parameters. */
362362
private predicate barrierGuardModel(
363-
string type, string path, string branch, string kind, string model
363+
string type, string path, string acceptingValue, string kind, string model
364364
) {
365365
// No deprecation adapter for barrier models, they were not around back then.
366366
exists(QlBuiltins::ExtensionId madId |
367-
Extensions::barrierGuardModel(type, path, branch, kind, madId) and
367+
Extensions::barrierGuardModel(type, path, acceptingValue, kind, madId) and
368368
model = "MaD:" + madId.toString()
369369
)
370370
}
@@ -788,16 +788,16 @@ module ModelOutput {
788788
}
789789

790790
/**
791-
* Holds if a barrier model contributed `barrier` with the given `kind` for the given `branch`.
791+
* Holds if a barrier model contributed `barrier` with the given `kind` for the given `acceptingValue`.
792792
*/
793793
cached
794-
API::Node getABarrierGuardNode(string kind, boolean branch, string model) {
795-
exists(string type, string path, string branch_str |
796-
branch = true and branch_str = "true"
794+
API::Node getABarrierGuardNode(string kind, boolean acceptingValue, string model) {
795+
exists(string type, string path, string acceptingValue_str |
796+
acceptingValue = true and acceptingValue_str = "true"
797797
or
798-
branch = false and branch_str = "false"
798+
acceptingValue = false and acceptingValue_str = "false"
799799
|
800-
barrierGuardModel(type, path, branch_str, kind, model) and
800+
barrierGuardModel(type, path, acceptingValue_str, kind, model) and
801801
result = getNodeFromPath(type, path)
802802
)
803803
}
@@ -861,12 +861,12 @@ module ModelOutput {
861861
API::Node getABarrierNode(string kind) { result = getABarrierNode(kind, _) }
862862

863863
/**
864-
* Holds if an external model contributed `barrier-guard` with the given `kind` and `branch`.
864+
* Holds if an external model contributed `barrier-guard` with the given `kind` and `acceptingValue`.
865865
*
866866
* INTERNAL: Do not use.
867867
*/
868-
API::Node getABarrierGuardNode(string kind, boolean branch) {
869-
result = getABarrierGuardNode(kind, branch, _)
868+
API::Node getABarrierGuardNode(string kind, boolean acceptingValue) {
869+
result = getABarrierGuardNode(kind, acceptingValue, _)
870870
}
871871

872872
/**

javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModelsExtensions.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ extensible predicate barrierModel(
3333
* of the given `kind` and `madId` is the data extension row number.
3434
* `path` is assumed to lead to a parameter of a call (possibly `self`), and
3535
* the call is guarding the parameter.
36-
* `branch` is either `true` or `false`, indicating which branch of the guard
37-
* is protecting the parameter.
36+
* `acceptingValue` is either `true` or `false`, indicating which branch of
37+
* the guard is protecting the parameter.
3838
*/
3939
extensible predicate barrierGuardModel(
40-
string type, string path, string branch, string kind, QlBuiltins::ExtensionId madId
40+
string type, string path, string acceptingValue, string kind, QlBuiltins::ExtensionId madId
4141
);
4242

4343
/**

python/ql/lib/semmle/python/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* - Barriers:
1414
* `type, path, kind`
1515
* - BarrierGuards:
16-
* `type, path, branch, kind`
16+
* `type, path, acceptingValue, kind`
1717
* - Types:
1818
* `type1, type2, path`
1919
*
@@ -46,7 +46,7 @@
4646
* 3. The `input` and `output` columns specify how data enters and leaves the element selected by the
4747
* first `(type, path)` tuple. Both strings are `.`-separated access paths
4848
* of the same syntax as the `path` column.
49-
* 4. The `branch` column of barrier guard models specifies which branch of the guard is blocking flow. It can be "true" or "false".
49+
* 4. The `acceptingValue` column of barrier guard models specifies which branch of the guard is blocking flow. It can be "true" or "false".
5050
* 5. The `kind` column is a tag that can be referenced from QL to determine to
5151
* which classes the interpreted elements should be added. For example, for
5252
* sources `"remote"` indicates a default remote flow source, and for summaries
@@ -360,11 +360,11 @@ private predicate barrierModel(string type, string path, string kind, string mod
360360

361361
/** Holds if a barrier guard model exists for the given parameters. */
362362
private predicate barrierGuardModel(
363-
string type, string path, string branch, string kind, string model
363+
string type, string path, string acceptingValue, string kind, string model
364364
) {
365365
// No deprecation adapter for barrier models, they were not around back then.
366366
exists(QlBuiltins::ExtensionId madId |
367-
Extensions::barrierGuardModel(type, path, branch, kind, madId) and
367+
Extensions::barrierGuardModel(type, path, acceptingValue, kind, madId) and
368368
model = "MaD:" + madId.toString()
369369
)
370370
}
@@ -788,16 +788,16 @@ module ModelOutput {
788788
}
789789

790790
/**
791-
* Holds if a barrier model contributed `barrier` with the given `kind` for the given `branch`.
791+
* Holds if a barrier model contributed `barrier` with the given `kind` for the given `acceptingValue`.
792792
*/
793793
cached
794-
API::Node getABarrierGuardNode(string kind, boolean branch, string model) {
795-
exists(string type, string path, string branch_str |
796-
branch = true and branch_str = "true"
794+
API::Node getABarrierGuardNode(string kind, boolean acceptingValue, string model) {
795+
exists(string type, string path, string acceptingValue_str |
796+
acceptingValue = true and acceptingValue_str = "true"
797797
or
798-
branch = false and branch_str = "false"
798+
acceptingValue = false and acceptingValue_str = "false"
799799
|
800-
barrierGuardModel(type, path, branch_str, kind, model) and
800+
barrierGuardModel(type, path, acceptingValue_str, kind, model) and
801801
result = getNodeFromPath(type, path)
802802
)
803803
}
@@ -861,12 +861,12 @@ module ModelOutput {
861861
API::Node getABarrierNode(string kind) { result = getABarrierNode(kind, _) }
862862

863863
/**
864-
* Holds if an external model contributed `barrier-guard` with the given `kind` and `branch`.
864+
* Holds if an external model contributed `barrier-guard` with the given `kind` and `acceptingValue`.
865865
*
866866
* INTERNAL: Do not use.
867867
*/
868-
API::Node getABarrierGuardNode(string kind, boolean branch) {
869-
result = getABarrierGuardNode(kind, branch, _)
868+
API::Node getABarrierGuardNode(string kind, boolean acceptingValue) {
869+
result = getABarrierGuardNode(kind, acceptingValue, _)
870870
}
871871

872872
/**

python/ql/lib/semmle/python/frameworks/data/internal/ApiGraphModelsExtensions.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ extensible predicate barrierModel(
3333
* of the given `kind` and `madId` is the data extension row number.
3434
* `path` is assumed to lead to a parameter of a call (possibly `self`), and
3535
* the call is guarding the parameter.
36-
* `branch` is either `true` or `false`, indicating which branch of the guard
37-
* is protecting the parameter.
36+
* `acceptingValue` is either `true` or `false`, indicating which branch of
37+
* the guard is protecting the parameter.
3838
*/
3939
extensible predicate barrierGuardModel(
40-
string type, string path, string branch, string kind, QlBuiltins::ExtensionId madId
40+
string type, string path, string acceptingValue, string kind, QlBuiltins::ExtensionId madId
4141
);
4242

4343
/**

ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* - Barriers:
1414
* `type, path, kind`
1515
* - BarrierGuards:
16-
* `type, path, branch, kind`
16+
* `type, path, acceptingValue, kind`
1717
* - Types:
1818
* `type1, type2, path`
1919
*
@@ -46,7 +46,7 @@
4646
* 3. The `input` and `output` columns specify how data enters and leaves the element selected by the
4747
* first `(type, path)` tuple. Both strings are `.`-separated access paths
4848
* of the same syntax as the `path` column.
49-
* 4. The `branch` column of barrier guard models specifies which branch of the guard is blocking flow. It can be "true" or "false".
49+
* 4. The `acceptingValue` column of barrier guard models specifies which branch of the guard is blocking flow. It can be "true" or "false".
5050
* 5. The `kind` column is a tag that can be referenced from QL to determine to
5151
* which classes the interpreted elements should be added. For example, for
5252
* sources `"remote"` indicates a default remote flow source, and for summaries
@@ -360,11 +360,11 @@ private predicate barrierModel(string type, string path, string kind, string mod
360360

361361
/** Holds if a barrier guard model exists for the given parameters. */
362362
private predicate barrierGuardModel(
363-
string type, string path, string branch, string kind, string model
363+
string type, string path, string acceptingValue, string kind, string model
364364
) {
365365
// No deprecation adapter for barrier models, they were not around back then.
366366
exists(QlBuiltins::ExtensionId madId |
367-
Extensions::barrierGuardModel(type, path, branch, kind, madId) and
367+
Extensions::barrierGuardModel(type, path, acceptingValue, kind, madId) and
368368
model = "MaD:" + madId.toString()
369369
)
370370
}
@@ -788,16 +788,16 @@ module ModelOutput {
788788
}
789789

790790
/**
791-
* Holds if a barrier model contributed `barrier` with the given `kind` for the given `branch`.
791+
* Holds if a barrier model contributed `barrier` with the given `kind` for the given `acceptingValue`.
792792
*/
793793
cached
794-
API::Node getABarrierGuardNode(string kind, boolean branch, string model) {
795-
exists(string type, string path, string branch_str |
796-
branch = true and branch_str = "true"
794+
API::Node getABarrierGuardNode(string kind, boolean acceptingValue, string model) {
795+
exists(string type, string path, string acceptingValue_str |
796+
acceptingValue = true and acceptingValue_str = "true"
797797
or
798-
branch = false and branch_str = "false"
798+
acceptingValue = false and acceptingValue_str = "false"
799799
|
800-
barrierGuardModel(type, path, branch_str, kind, model) and
800+
barrierGuardModel(type, path, acceptingValue_str, kind, model) and
801801
result = getNodeFromPath(type, path)
802802
)
803803
}
@@ -861,12 +861,12 @@ module ModelOutput {
861861
API::Node getABarrierNode(string kind) { result = getABarrierNode(kind, _) }
862862

863863
/**
864-
* Holds if an external model contributed `barrier-guard` with the given `kind` and `branch`.
864+
* Holds if an external model contributed `barrier-guard` with the given `kind` and `acceptingValue`.
865865
*
866866
* INTERNAL: Do not use.
867867
*/
868-
API::Node getABarrierGuardNode(string kind, boolean branch) {
869-
result = getABarrierGuardNode(kind, branch, _)
868+
API::Node getABarrierGuardNode(string kind, boolean acceptingValue) {
869+
result = getABarrierGuardNode(kind, acceptingValue, _)
870870
}
871871

872872
/**

ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModelsExtensions.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ extensible predicate barrierModel(
3333
* of the given `kind` and `madId` is the data extension row number.
3434
* `path` is assumed to lead to a parameter of a call (possibly `self`), and
3535
* the call is guarding the parameter.
36-
* `branch` is either `true` or `false`, indicating which branch of the guard
37-
* is protecting the parameter.
36+
* `acceptingValue` is either `true` or `false`, indicating which branch of
37+
* the guard is protecting the parameter.
3838
*/
3939
extensible predicate barrierGuardModel(
40-
string type, string path, string branch, string kind, QlBuiltins::ExtensionId madId
40+
string type, string path, string acceptingValue, string kind, QlBuiltins::ExtensionId madId
4141
);
4242

4343
/**

rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* - Barriers:
1313
* `path; output; kind; provenance`
1414
* - BarrierGuards:
15-
* `path; input; branch; kind; provenance`
15+
* `path; input; acceptingValue; kind; provenance`
1616
* - Neutrals:
1717
* `path; kind; provenance`
1818
* A neutral is used to indicate that a callable is neutral with respect to flow (no summary), source (is not a source) or sink (is not a sink).
@@ -41,7 +41,7 @@
4141
* - `Field[i]`: the `i`th element of a tuple.
4242
* - `Reference`: the referenced value.
4343
* - `Future`: the value being computed asynchronously.
44-
* 3. The `branch` column of barrier guard models specifies which branch of the
44+
* 3. The `acceptingValue` column of barrier guard models specifies which branch of the
4545
* guard is blocking flow. It can be "true" or "false". In the future
4646
* "no-exception", "not-zero", "null", "not-null" may be supported.
4747
* 4. The `kind` column is a tag that can be referenced from QL to determine to
@@ -124,11 +124,12 @@ extensible predicate barrierModel(
124124
* extension row number.
125125
*
126126
* The value referred to by `input` is assumed to lead to an argument of a call
127-
* (possibly `self`), and the call is guarding the argument. `branch` is either `true`
128-
* or `false`, indicating which branch of the guard is protecting the argument.
127+
* (possibly `self`), and the call is guarding the argument.
128+
* `acceptingValue` is either `true` or `false`, indicating which branch of
129+
* the guard is protecting the parameter.
129130
*/
130131
extensible predicate barrierGuardModel(
131-
string path, string input, string branch, string kind, string provenance,
132+
string path, string input, string acceptingValue, string kind, string provenance,
132133
QlBuiltins::ExtensionId madId
133134
);
134135

@@ -163,9 +164,9 @@ predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) {
163164
model = "Barrier: " + path + "; " + output + "; " + kind
164165
)
165166
or
166-
exists(string path, string input, string branch, string kind |
167-
barrierGuardModel(path, input, branch, kind, _, madId) and
168-
model = "Barrier guard: " + path + "; " + input + "; " + branch + "; " + kind
167+
exists(string path, string input, string acceptingValue, string kind |
168+
barrierGuardModel(path, input, acceptingValue, kind, _, madId) and
169+
model = "Barrier guard: " + path + "; " + input + "; " + acceptingValue + "; " + kind
169170
)
170171
}
171172

@@ -275,10 +276,10 @@ private class FlowBarrierGuardFromModel extends FlowBarrierGuard::Range {
275276
}
276277

277278
override predicate isBarrierGuard(
278-
string input, string branch, string kind, Provenance provenance, string model
279+
string input, string acceptingValue, string kind, Provenance provenance, string model
279280
) {
280281
exists(QlBuiltins::ExtensionId madId |
281-
barrierGuardModel(path, input, branch, kind, provenance, madId) and
282+
barrierGuardModel(path, input, acceptingValue, kind, provenance, madId) and
282283
model = "MaD:" + madId.toString()
283284
)
284285
}

shared/dataflow/codeql/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,11 @@ module Make<
388388

389389
/**
390390
* Holds if this element is a flow barrier guard of kind `kind`, for data
391-
* flowing in as described by `input`, when `this` evaluates to `branch`.
391+
* flowing in as described by `input`, when `this` evaluates to `acceptingValue`.
392392
*/
393393
pragma[nomagic]
394394
abstract predicate isBarrierGuard(
395-
string input, string branch, string kind, Provenance provenance, string model
395+
string input, string acceptingValue, string kind, Provenance provenance, string model
396396
);
397397
}
398398

@@ -764,10 +764,10 @@ module Make<
764764
}
765765

766766
private predicate isRelevantBarrierGuard(
767-
BarrierGuardElement e, string input, string branch, string kind, Provenance provenance,
768-
string model
767+
BarrierGuardElement e, string input, string acceptingValue, string kind,
768+
Provenance provenance, string model
769769
) {
770-
e.isBarrierGuard(input, branch, kind, provenance, model) and
770+
e.isBarrierGuard(input, acceptingValue, kind, provenance, model) and
771771
(
772772
provenance.isManual()
773773
or
@@ -1588,11 +1588,11 @@ module Make<
15881588
* Holds if `barrierGuard` is a relevant barrier guard element with input specification `inSpec`.
15891589
*/
15901590
predicate barrierGuardSpec(
1591-
BarrierGuardElement barrierGuard, SummaryComponentStack inSpec, string branch, string kind,
1592-
string model
1591+
BarrierGuardElement barrierGuard, SummaryComponentStack inSpec, string acceptingValue,
1592+
string kind, string model
15931593
) {
15941594
exists(string input |
1595-
isRelevantBarrierGuard(barrierGuard, input, branch, kind, _, model) and
1595+
isRelevantBarrierGuard(barrierGuard, input, acceptingValue, kind, _, model) and
15961596
External::interpretSpec(input, inSpec)
15971597
)
15981598
}

0 commit comments

Comments
 (0)