Skip to content

Commit d913668

Browse files
committed
move hasPathWithoutUnmatchedReturn to Configuration.qll
1 parent b4e35f5 commit d913668

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,3 +2068,14 @@ class VarAccessBarrier extends DataFlow::Node {
20682068
)
20692069
}
20702070
}
2071+
2072+
/**
2073+
* Holds if there is a path without unmatched return steps from `source` to `sink`.
2074+
*/
2075+
predicate hasPathWithoutUnmatchedReturn(SourcePathNode source, SinkPathNode sink) {
2076+
exists(MidPathNode mid |
2077+
source.getASuccessor*() = mid and
2078+
sink = mid.getASuccessor() and
2079+
mid.getPathSummary().hasReturn() = false
2080+
)
2081+
}

javascript/ql/src/semmle/javascript/security/dataflow/UnsafeHtmlConstruction.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module UnsafeHtmlConstruction {
3838
// override to require that there is a path without unmatched return steps
3939
override predicate hasFlowPath(DataFlow::SourcePathNode source, DataFlow::SinkPathNode sink) {
4040
super.hasFlowPath(source, sink) and
41-
hasPathWithoutUnmatchedReturn(source, sink)
41+
DataFlow::hasPathWithoutUnmatchedReturn(source, sink)
4242
}
4343

4444
override predicate isAdditionalTaintStep(DataFlow::Node pred, DataFlow::Node succ) {

javascript/ql/src/semmle/javascript/security/dataflow/UnsafeHtmlConstructionCustomizations.qll

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,4 @@ module UnsafeHtmlConstruction {
174174

175175
override string describe() { result = "Markdown rendering" }
176176
}
177-
178-
/**
179-
* Holds if there is a path without unmatched return steps from `source` to `sink`.
180-
*/
181-
predicate hasPathWithoutUnmatchedReturn(
182-
DataFlow::SourcePathNode source, DataFlow::SinkPathNode sink
183-
) {
184-
exists(DataFlow::MidPathNode mid |
185-
source.getASuccessor*() = mid and
186-
sink = mid.getASuccessor() and
187-
mid.getPathSummary().hasReturn() = false
188-
)
189-
}
190177
}

javascript/ql/src/semmle/javascript/security/dataflow/UnsafeShellCommandConstruction.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import javascript
1414
*/
1515
module UnsafeShellCommandConstruction {
1616
import UnsafeShellCommandConstructionCustomizations::UnsafeShellCommandConstruction
17-
import UnsafeHtmlConstructionCustomizations
1817

1918
/**
2019
* A taint-tracking configuration for reasoning about shell command constructed from library input vulnerabilities.
@@ -36,7 +35,7 @@ module UnsafeShellCommandConstruction {
3635
// override to require that there is a path without unmatched return steps
3736
override predicate hasFlowPath(DataFlow::SourcePathNode source, DataFlow::SinkPathNode sink) {
3837
super.hasFlowPath(source, sink) and
39-
UnsafeHtmlConstruction::requireMatchedReturn(source, sink)
38+
DataFlow::hasPathWithoutUnmatchedReturn(source, sink)
4039
}
4140

4241
override predicate isAdditionalTaintStep(DataFlow::Node pred, DataFlow::Node succ) {

0 commit comments

Comments
 (0)