@@ -328,16 +328,18 @@ module Vue {
328328 result = getAsClassComponent ( ) .getAnInstanceMember ( )
329329 }
330330
331+ /**
332+ * Gets a reference to `this` inside the component, referring to an instance of the component.
333+ */
334+ DataFlow:: SourceNode getASelfRef ( ) {
335+ result = getABoundFunction ( ) .getReceiver ( )
336+ }
337+
331338 pragma [ noinline]
332339 private DataFlow:: PropWrite getAPropertyValueWrite ( string name ) {
333340 result = getData ( ) .getALocalSource ( ) .getAPropertyWrite ( name )
334341 or
335- result =
336- getABoundFunction ( )
337- .getALocalSource ( )
338- .( DataFlow:: FunctionNode )
339- .getReceiver ( )
340- .getAPropertyWrite ( name )
342+ result = getASelfRef ( ) .getAPropertyWrite ( name )
341343 }
342344
343345 /**
@@ -547,20 +549,31 @@ module Vue {
547549 VueFile ( ) { getExtension ( ) = "vue" }
548550 }
549551
552+ pragma [ nomagic]
553+ private DataFlow:: Node propStepPred ( Component comp , string name ) {
554+ result = comp .getAPropertyValue ( name )
555+ }
556+
557+ pragma [ nomagic]
558+ private DataFlow:: Node propStepSucc ( Component comp , string name ) {
559+ result = comp .getASelfRef ( ) .getAPropertyRead ( name )
560+ }
561+
550562 /**
551563 * A taint propagating data flow edge through a Vue instance property.
552564 */
553- class InstanceHeapStep extends TaintTracking:: SharedTaintStep {
554- override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
555- exists ( Component i , string name , DataFlow:: FunctionNode bound |
556- bound .flowsTo ( i .getABoundFunction ( ) ) and
557- not bound .getFunction ( ) instanceof ArrowFunctionExpr and
558- succ = bound .getReceiver ( ) .getAPropertyRead ( name ) and
559- pred = i .getAPropertyValue ( name )
565+ private class PropStep extends TaintTracking:: SharedTaintStep {
566+ override predicate viewComponentStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
567+ exists ( Component comp , string name |
568+ pred = propStepPred ( comp , name ) and
569+ succ = propStepSucc ( comp , name )
560570 )
561571 }
562572 }
563573
574+ /** DEPRECATED. Do not use. */
575+ deprecated class InstanceHeapStep = PropStep ;
576+
564577 /**
565578 * A Vue `v-html` attribute.
566579 */
@@ -585,11 +598,11 @@ module Vue {
585598 * of `inst = new Vue({ ..., data: { prop: source } })`, if the
586599 * `div` element is part of the template for `inst`.
587600 */
588- class VHtmlSourceWrite extends TaintTracking:: SharedTaintStep {
589- override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
590- exists ( Vue :: Component component , string expr , VHtmlAttribute attr |
601+ private class VHtmlAttributeStep extends TaintTracking:: SharedTaintStep {
602+ override predicate viewComponentStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
603+ exists ( Component component , string expr , VHtmlAttribute attr |
591604 attr .getAttr ( ) .getRoot ( ) =
592- component .getTemplateElement ( ) .( Vue :: Template:: HtmlElement ) .getElement ( ) and
605+ component .getTemplateElement ( ) .( Template:: HtmlElement ) .getElement ( ) and
593606 expr = attr .getAttr ( ) .getValue ( ) and
594607 // only support for simple identifier expressions
595608 expr .regexpMatch ( "(?i)[a-z0-9_]+" ) and
@@ -599,6 +612,11 @@ module Vue {
599612 }
600613 }
601614
615+ /**
616+ * DEPRECATED. Do not use.
617+ */
618+ deprecated class VHtmlSourceWrite = VHtmlAttributeStep ;
619+
602620 /*
603621 * Provides classes for working with Vue templates.
604622 */
0 commit comments