Skip to content

Commit d993c88

Browse files
committed
JS: Deprecate the FlowLabel class
1 parent 69b361a commit d993c88

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

javascript/ql/lib/semmle/javascript/dataflow/AdditionalFlowSteps.qll

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,12 @@ class LegacyFlowStep extends Unit {
147147
predicate step(DataFlow::Node pred, DataFlow::Node succ) { none() }
148148

149149
/**
150+
* DEPRECATED. The `FlowLabel` class and steps involving flow labels are no longer used by any queries.
151+
*
150152
* Holds if `pred` → `succ` should be considered a data flow edge
151153
* transforming values with label `predlbl` to have label `succlbl`.
152154
*/
153-
predicate step(
155+
deprecated predicate step(
154156
DataFlow::Node pred, DataFlow::Node succ, DataFlow::FlowLabel predlbl,
155157
DataFlow::FlowLabel succlbl
156158
) {
@@ -199,11 +201,13 @@ module LegacyFlowStep {
199201
}
200202

201203
/**
204+
* DEPRECATED. The `FlowLabel` class and steps involving flow labels are no longer used by any queries.
205+
*
202206
* Holds if `pred` → `succ` should be considered a data flow edge
203207
* transforming values with label `predlbl` to have label `succlbl`.
204208
*/
205209
cached
206-
predicate step(
210+
deprecated predicate step(
207211
DataFlow::Node pred, DataFlow::Node succ, DataFlow::FlowLabel predlbl,
208212
DataFlow::FlowLabel succlbl
209213
) {
@@ -273,10 +277,12 @@ class SharedFlowStep extends Unit {
273277
predicate step(DataFlow::Node pred, DataFlow::Node succ) { none() }
274278

275279
/**
280+
* DEPRECATED. The `FlowLabel` class and steps involving flow labels are no longer used by any queries.
281+
*
276282
* Holds if `pred` → `succ` should be considered a data flow edge
277283
* transforming values with label `predlbl` to have label `succlbl`.
278284
*/
279-
predicate step(
285+
deprecated predicate step(
280286
DataFlow::Node pred, DataFlow::Node succ, DataFlow::FlowLabel predlbl,
281287
DataFlow::FlowLabel succlbl
282288
) {
@@ -353,10 +359,12 @@ module SharedFlowStep {
353359

354360
// The following are aliases for old step predicates that have no corresponding predicate in AdditionalFlowStep
355361
/**
362+
* DEPRECATED. The `FlowLabel` class and steps involving flow labels are no longer used by any queries.
363+
*
356364
* Holds if `pred` → `succ` should be considered a data flow edge
357365
* transforming values with label `predlbl` to have label `succlbl`.
358366
*/
359-
predicate step(
367+
deprecated predicate step(
360368
DataFlow::Node pred, DataFlow::Node succ, DataFlow::FlowLabel predlbl,
361369
DataFlow::FlowLabel succlbl
362370
) {

javascript/ql/lib/semmle/javascript/dataflow/Configuration.qll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ deprecated private predicate isBarrierGuardInternal(
295295
}
296296

297297
/**
298+
* DEPRECATED. Use a query-specific `FlowState` class instead.
299+
* See [guide on using flow state](https://codeql.github.com/docs/codeql-language-guides/using-flow-labels-for-precise-data-flow-analysis) for more details.
300+
*
298301
* A label describing the kind of information tracked by a flow configuration.
299302
*
300303
* There are two standard labels "data" and "taint".
@@ -303,7 +306,7 @@ deprecated private predicate isBarrierGuardInternal(
303306
* - "taint" additionally permits flow through transformations such as string operations,
304307
* and is the default flow source for a `TaintTracking::Configuration`.
305308
*/
306-
abstract class FlowLabel extends string {
309+
abstract deprecated class FlowLabel extends string {
307310
bindingset[this]
308311
FlowLabel() { any() }
309312

@@ -341,7 +344,7 @@ deprecated class StandardFlowLabel extends FlowLabel {
341344
StandardFlowLabel() { this = "data" or this = "taint" }
342345
}
343346

344-
module FlowLabel {
347+
deprecated module FlowLabel {
345348
/**
346349
* Gets the standard flow label for describing values that directly originate from a flow source.
347350
*/

javascript/ql/lib/semmle/javascript/dataflow/internal/BarrierGuards.qll

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,19 @@ module MakeBarrierGuard<BarrierGuardSig BaseGuard> {
3636
}
3737
}
3838

39-
private signature class LabeledBarrierGuardSig extends DataFlow::Node {
40-
/**
41-
* Holds if this node acts as a barrier for `label`, blocking further flow from `e` if `this` evaluates to `outcome`.
42-
*/
43-
predicate blocksExpr(boolean outcome, Expr e, DataFlow::FlowLabel label);
39+
deprecated private module DeprecationWrapper {
40+
signature class LabeledBarrierGuardSig extends DataFlow::Node {
41+
/**
42+
* Holds if this node acts as a barrier for `label`, blocking further flow from `e` if `this` evaluates to `outcome`.
43+
*/
44+
predicate blocksExpr(boolean outcome, Expr e, DataFlow::FlowLabel label);
45+
}
4446
}
4547

4648
/**
4749
* Converts a barrier guard class to a set of nodes to include in an implementation of `isBarrier(node, label)`.
4850
*/
49-
module MakeLabeledBarrierGuard<LabeledBarrierGuardSig BaseGuard> {
51+
deprecated module MakeLabeledBarrierGuard<DeprecationWrapper::LabeledBarrierGuardSig BaseGuard> {
5052
final private class FinalBaseGuard = BaseGuard;
5153

5254
private class Adapter extends FinalBaseGuard {

javascript/ql/lib/semmle/javascript/dataflow/internal/FlowSteps.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,9 @@ class Boolean extends boolean {
545545
/**
546546
* A summary of an inter-procedural data flow path.
547547
*/
548-
newtype TPathSummary =
548+
deprecated newtype TPathSummary =
549549
/** A summary of an inter-procedural data flow path. */
550-
MkPathSummary(Boolean hasReturn, Boolean hasCall, FlowLabel start, FlowLabel end)
550+
deprecated MkPathSummary(Boolean hasReturn, Boolean hasCall, FlowLabel start, FlowLabel end)
551551

552552
/**
553553
* A summary of an inter-procedural data flow path.
@@ -560,7 +560,7 @@ newtype TPathSummary =
560560
* We only want to build properly matched call/return sequences, so if a path has both
561561
* call steps and return steps, all return steps must precede all call steps.
562562
*/
563-
class PathSummary extends TPathSummary {
563+
deprecated class PathSummary extends TPathSummary {
564564
Boolean hasReturn;
565565
Boolean hasCall;
566566
FlowLabel start;
@@ -634,7 +634,7 @@ class PathSummary extends TPathSummary {
634634
}
635635
}
636636

637-
module PathSummary {
637+
deprecated module PathSummary {
638638
/**
639639
* Gets a summary describing a path without any calls or returns.
640640
*/

0 commit comments

Comments
 (0)