Skip to content

Commit b53759c

Browse files
committed
corrections after code review
1 parent be69c3a commit b53759c

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

javascript/ql/src/Security/CWE-079/UnsafeHtmlConstruction.qhelp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<qhelp>
55
<overview>
66
<p>
7-
Dynamically constructing HTML with inputs from library functions may
8-
inadvertently leave a client open to XSS attacks.
7+
Dynamically constructing HTML with inputs from library functions that are
8+
available to external clients may inadvertently leave a client open to XSS attacks.
99

1010
Clients using the exported function may use inputs containing unsafe HTML,
1111
and if these inputs end up in the DOM, the client may be vulnerable to

javascript/ql/src/semmle/javascript/frameworks/Markdown.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ module Markdown {
1717
* Holds if there is a taint-step from `pred` to `succ` for a taint-preserving markdown parser.
1818
*/
1919
abstract predicate step(DataFlow::Node pred, DataFlow::Node succ);
20+
21+
/**
22+
* Holds if the taint-step preserves HTML.
23+
*/
24+
predicate preservesHTML() { any() }
2025
}
2126

2227
private class MarkdownStepAsTaintStep extends TaintTracking::SharedTaintStep {

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-
requireMatchedReturn(source, sink)
41+
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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ module UnsafeHtmlConstruction {
165165
MarkdownSink() {
166166
exists(DataFlow::Node pred, DataFlow::Node succ, Markdown::MarkdownStep step |
167167
step.step(pred, succ) and
168-
step.preservesHtml() and
168+
step.preservesHTML() and
169169
this = pred and
170170
succ = isUsedInXssSink(xssSink)
171171
)
@@ -177,7 +177,9 @@ module UnsafeHtmlConstruction {
177177
/**
178178
* Holds if there is a path without unmatched return steps from `source` to `sink`.
179179
*/
180-
predicate hasPathWithoutUnmatchedReturn(DataFlow::SourcePathNode source, DataFlow::SinkPathNode sink) {
180+
predicate hasPathWithoutUnmatchedReturn(
181+
DataFlow::SourcePathNode source, DataFlow::SinkPathNode sink
182+
) {
181183
exists(DataFlow::MidPathNode mid |
182184
source.getASuccessor*() = mid and
183185
sink = mid.getASuccessor() and

0 commit comments

Comments
 (0)