Skip to content

Commit 8692564

Browse files
committed
ReflectedXss: Prevent bad join order
1 parent 85bf10e commit 8692564

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ module ReflectedXss {
103103
)
104104
}
105105

106+
bindingset[headerBlock]
107+
pragma[inline_late]
108+
private predicate doesNotDominateCallback(ReachableBasicBlock headerBlock) {
109+
not exists(Expr e | e instanceof Function | headerBlock.dominates(e.getBasicBlock()))
110+
}
111+
106112
/**
107113
* Holds if the HeaderDefinition `header` seems to be local.
108114
* A HeaderDefinition is local if it dominates exactly one `ResponseSendArgument`.
@@ -122,7 +128,7 @@ module ReflectedXss {
122128
header.getBasicBlock().(ReachableBasicBlock).dominates(sender.getBasicBlock())
123129
) and
124130
// doesn't dominate something that looks like a callback.
125-
not exists(Expr e | e instanceof Function | headerBlock.dominates(e.getBasicBlock()))
131+
doesNotDominateCallback(headerBlock)
126132
)
127133
}
128134

0 commit comments

Comments
 (0)