Skip to content

Commit 77f8e8e

Browse files
committed
JS: Use FlowState::fromFlowLabel instead of Label::toFlowState
This works better for other queries where we don't already have a module named Label
1 parent 38c9023 commit 77f8e8e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

javascript/ql/lib/semmle/javascript/security/dataflow/TaintedPathCustomizations.qll

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module TaintedPath {
5353

5454
/** DEPRECATED. Use `blocksExpr` instead. */
5555
deprecated predicate sanitizes(boolean outcome, Expr e, DataFlow::FlowLabel label) {
56-
this.blocksExpr(outcome, e, Label::toFlowState(label))
56+
this.blocksExpr(outcome, e, FlowState::fromFlowLabel(label))
5757
}
5858
}
5959

@@ -178,11 +178,12 @@ module TaintedPath {
178178

179179
deprecated override Label::SplitPath toFlowLabel() { any() }
180180
}
181+
182+
/** Convert the given flow label to the corresponding flow state. */
183+
deprecated FlowState fromFlowLabel(DataFlow::FlowLabel label) { result.toFlowLabel() = label }
181184
}
182185

183186
deprecated module Label {
184-
FlowState toFlowState(DataFlow::FlowLabel label) { result.toFlowLabel() = label }
185-
186187
class Normalization = FlowState::Normalization;
187188

188189
class Relativeness = FlowState::Relativeness;
@@ -872,7 +873,8 @@ module TaintedPath {
872873
DataFlow::Node src, DataFlow::Node dst, DataFlow::FlowLabel srclabel,
873874
DataFlow::FlowLabel dstlabel
874875
) {
875-
isAdditionalFlowStep(src, Label::toFlowState(srclabel), dst, Label::toFlowState(dstlabel))
876+
isAdditionalFlowStep(src, FlowState::fromFlowLabel(srclabel), dst,
877+
FlowState::fromFlowLabel(dstlabel))
876878
}
877879

878880
/**

javascript/ql/lib/semmle/javascript/security/dataflow/ZipSlipQuery.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ deprecated class Configuration extends DataFlow::Configuration {
7474
DataFlow::Node src, DataFlow::Node dst, DataFlow::FlowLabel srclabel,
7575
DataFlow::FlowLabel dstlabel
7676
) {
77-
ZipSlipConfig::isAdditionalFlowStep(src, TaintedPath::Label::toFlowState(srclabel), dst,
78-
TaintedPath::Label::toFlowState(dstlabel))
77+
ZipSlipConfig::isAdditionalFlowStep(src, TaintedPath::FlowState::fromFlowLabel(srclabel), dst,
78+
TaintedPath::FlowState::fromFlowLabel(dstlabel))
7979
}
8080
}

0 commit comments

Comments
 (0)