Skip to content

Commit 9e6aac8

Browse files
committed
JS: Deprecate CollectionFlowStep
1 parent f8f3770 commit 9e6aac8

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

javascript/ql/src/semmle/javascript/Collections.qll

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ private import semmle.javascript.dataflow.internal.PreCallGraphStep
1010
private import DataFlow::PseudoProperties
1111

1212
/**
13-
* A pseudo-property used in a data-flow/type-tracking step for collections.
13+
* DEPRECATED. Exists only to support other deprecated elements.
14+
*
15+
* Type-tracking now automatically determines the set of pseudo-properties to include
16+
* ased on which properties are contributed by `SharedTaintStep`s.
1417
*/
15-
private class PseudoProperty extends string {
18+
deprecated private class PseudoProperty extends string {
1619
PseudoProperty() {
1720
this = [arrayLikeElement(), "1"] or // the "1" is required for the `ForOfStep`.
1821
this =
@@ -24,13 +27,9 @@ private class PseudoProperty extends string {
2427
}
2528

2629
/**
27-
* An `AdditionalFlowStep` used to model a data-flow step related to standard library collections.
28-
*
29-
* The `loadStep`/`storeStep`/`loadStoreStep` methods are overloaded such that the new predicates
30-
* `load`/`store`/`loadStore` can be used in the `CollectionsTypeTracking` module.
31-
* (Thereby avoiding naming conflicts with a "cousin" `AdditionalFlowStep` implementation.)
30+
* DEPRECATED. Use `SharedFlowStep` or `SharedTaintTrackingStep` instead.
3231
*/
33-
abstract class CollectionFlowStep extends DataFlow::AdditionalFlowStep {
32+
abstract deprecated class CollectionFlowStep extends DataFlow::AdditionalFlowStep {
3433
final override predicate step(DataFlow::Node pred, DataFlow::Node succ) { none() }
3534

3635
final override predicate step(
@@ -83,27 +82,28 @@ abstract class CollectionFlowStep extends DataFlow::AdditionalFlowStep {
8382
}
8483

8584
/**
86-
* Provides predicates and clases for type-tracking collections.
85+
* DEPRECATED. These steps are now included in the default type tracking steps,
86+
* in most cases one can simply use those instead.
8787
*/
88-
module CollectionsTypeTracking {
88+
deprecated module CollectionsTypeTracking {
8989
/**
9090
* Gets the result from a single step through a collection, from `pred` to `result` summarized by `summary`.
9191
*/
9292
pragma[inline]
9393
DataFlow::SourceNode collectionStep(DataFlow::Node pred, StepSummary summary) {
94-
exists(CollectionFlowStep step, PseudoProperty field |
94+
exists(PseudoProperty field |
9595
summary = LoadStep(field) and
96-
step.load(pred, result, field) and
96+
DataFlow::SharedTypeTrackingStep::loadStep(pred, result, field) and
9797
not field = mapValueUnknownKey() // prune unknown reads in type-tracking
9898
or
9999
summary = StoreStep(field) and
100-
step.store(pred, result, field)
100+
DataFlow::SharedTypeTrackingStep::storeStep(pred, result, field)
101101
or
102102
summary = CopyStep(field) and
103-
step.loadStore(pred, result, field)
103+
DataFlow::SharedTypeTrackingStep::loadStoreStep(pred, result, field)
104104
or
105105
exists(PseudoProperty toField | summary = LoadStoreStep(field, toField) |
106-
step.loadStore(pred, result, field, toField)
106+
DataFlow::SharedTypeTrackingStep::loadStoreStep(pred, result, field, toField)
107107
)
108108
)
109109
}

0 commit comments

Comments
 (0)