Skip to content

Commit a8a8754

Browse files
author
Max Schaefer
committed
JavaScript: Restrict default sink flow labels to StandardFlowLabel.
1 parent 5727b2a commit a8a8754

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,14 @@ abstract class FlowLabel extends string {
220220
bindingset[this] FlowLabel() { any() }
221221
}
222222

223-
module FlowLabel {
224-
private class StandardFlowLabel extends FlowLabel {
225-
StandardFlowLabel() { this = "data" or this = "taint" }
226-
}
223+
/**
224+
* A standard flow label, that is, either `FlowLabel::data()` or `FlowLabel::taint()`.
225+
*/
226+
private class StandardFlowLabel extends FlowLabel {
227+
StandardFlowLabel() { this = "data" or this = "taint" }
228+
}
227229

230+
module FlowLabel {
228231
/**
229232
* Gets the standard flow label for describing values that directly originate from a flow source.
230233
*/
@@ -467,7 +470,7 @@ private predicate isSource(DataFlow::Node nd, DataFlow::Configuration cfg, FlowL
467470
*/
468471
private predicate isSink(DataFlow::Node nd, DataFlow::Configuration cfg, FlowLabel lbl) {
469472
(cfg.isSink(nd) or nd.(AdditionalSink).isSinkFor(cfg)) and
470-
lbl = any(FlowLabel f)
473+
lbl = any(StandardFlowLabel f)
471474
or
472475
cfg.isSink(nd, lbl)
473476
}

0 commit comments

Comments
 (0)