Skip to content

Commit 7c9e1ad

Browse files
committed
JS: Fix accidental recursion in Vue model
The API graph entry point depended on API::Node. This was due to depending on the the TComponent newtype which has a branch that depends on API::Node
1 parent 60af9b0 commit 7c9e1ad

File tree

1 file changed

+9
-9
lines changed
  • javascript/ql/lib/semmle/javascript/frameworks

1 file changed

+9
-9
lines changed

javascript/ql/lib/semmle/javascript/frameworks/Vue.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ module Vue {
2020
private class VueExportEntryPoint extends API::EntryPoint {
2121
VueExportEntryPoint() { this = "VueExportEntryPoint" }
2222

23-
override DataFlow::Node getASink() {
24-
result = any(SingleFileComponent c).getModule().getDefaultOrBulkExport()
25-
}
23+
override DataFlow::Node getASink() { result = getModuleFromVueFile(_).getDefaultOrBulkExport() }
2624
}
2725

2826
/**
@@ -455,6 +453,13 @@ module Vue {
455453
}
456454
}
457455

456+
private Module getModuleFromVueFile(VueFile file) {
457+
exists(HTML::ScriptElement elem |
458+
xmlElements(elem, _, _, _, file) and // Avoid materializing all of Locatable.getFile()
459+
result.getTopLevel() = elem.getScript()
460+
)
461+
}
462+
458463
/**
459464
* A single file Vue component in a `.vue` file.
460465
*/
@@ -482,12 +487,7 @@ module Vue {
482487
}
483488

484489
/** Gets the module defined by the `script` tag in this .vue file, if any. */
485-
Module getModule() {
486-
exists(HTML::ScriptElement elem |
487-
xmlElements(elem, _, _, _, file) and // Avoid materializing all of Locatable.getFile()
488-
result.getTopLevel() = elem.getScript()
489-
)
490-
}
490+
Module getModule() { result = getModuleFromVueFile(file) }
491491

492492
override API::Node getComponentRef() {
493493
// There is no explicit `new Vue()` call in .vue files, so instead get all the imports

0 commit comments

Comments
 (0)