mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
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
This commit is contained in:
@@ -20,9 +20,7 @@ module Vue {
|
||||
private class VueExportEntryPoint extends API::EntryPoint {
|
||||
VueExportEntryPoint() { this = "VueExportEntryPoint" }
|
||||
|
||||
override DataFlow::Node getASink() {
|
||||
result = any(SingleFileComponent c).getModule().getDefaultOrBulkExport()
|
||||
}
|
||||
override DataFlow::Node getASink() { result = getModuleFromVueFile(_).getDefaultOrBulkExport() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -455,6 +453,13 @@ module Vue {
|
||||
}
|
||||
}
|
||||
|
||||
private Module getModuleFromVueFile(VueFile file) {
|
||||
exists(HTML::ScriptElement elem |
|
||||
xmlElements(elem, _, _, _, file) and // Avoid materializing all of Locatable.getFile()
|
||||
result.getTopLevel() = elem.getScript()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* A single file Vue component in a `.vue` file.
|
||||
*/
|
||||
@@ -482,12 +487,7 @@ module Vue {
|
||||
}
|
||||
|
||||
/** Gets the module defined by the `script` tag in this .vue file, if any. */
|
||||
Module getModule() {
|
||||
exists(HTML::ScriptElement elem |
|
||||
xmlElements(elem, _, _, _, file) and // Avoid materializing all of Locatable.getFile()
|
||||
result.getTopLevel() = elem.getScript()
|
||||
)
|
||||
}
|
||||
Module getModule() { result = getModuleFromVueFile(file) }
|
||||
|
||||
override API::Node getComponentRef() {
|
||||
// There is no explicit `new Vue()` call in .vue files, so instead get all the imports
|
||||
|
||||
Reference in New Issue
Block a user