JS: VHtmlSourceWrite -> SharedTaintStep

This commit is contained in:
Asger Feldthaus
2020-03-28 20:02:29 +00:00
parent bd5452f2cf
commit 58a34fc249

View File

@@ -525,23 +525,18 @@ module Vue {
* of `inst = new Vue({ ..., data: { prop: source } })`, if the
* `div` element is part of the template for `inst`.
*/
class VHtmlSourceWrite extends TaintTracking::AdditionalTaintStep {
VHtmlAttribute attr;
VHtmlSourceWrite() {
exists(Vue::Instance instance, string expr |
class VHtmlSourceWrite extends TaintTracking::SharedTaintStep {
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
exists(Vue::Instance instance, string expr, VHtmlAttribute attr |
attr.getAttr().getRoot() =
instance.getTemplateElement().(Vue::Template::HtmlElement).getElement() and
expr = attr.getAttr().getValue() and
// only support for simple identifier expressions
expr.regexpMatch("(?i)[a-z0-9_]+") and
this = instance.getAPropertyValue(expr)
pred = instance.getAPropertyValue(expr) and
succ = attr
)
}
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
pred = this and succ = attr
}
}
/*