mirror of
https://github.com/github/codeql.git
synced 2026-05-02 04:05:14 +02:00
JS: Treat default-export from .vue file as entry point
This commit is contained in:
@@ -14,6 +14,17 @@ module Vue {
|
||||
override DataFlow::Node getARhs() { none() }
|
||||
}
|
||||
|
||||
/** A value exported from a `.vue` file. */
|
||||
private class VueExportEntryPoint extends API::EntryPoint {
|
||||
VueExportEntryPoint() { this = "VueExportEntryPoint" }
|
||||
|
||||
override DataFlow::SourceNode getAUse() { none() }
|
||||
|
||||
override DataFlow::Node getARhs() {
|
||||
result = any(SingleFileComponent c).getModule().getAnExportedValue("default")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a reference to the `Vue` object.
|
||||
*/
|
||||
@@ -521,7 +532,8 @@ module Vue {
|
||||
endcolumn = 0
|
||||
}
|
||||
|
||||
private Module getModule() {
|
||||
/** 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()
|
||||
|
||||
@@ -7,19 +7,6 @@ private import semmle.javascript.dataflow.internal.FlowSteps as FlowSteps
|
||||
|
||||
/** A minimal adapter for the `vue` model based on API nodes. */
|
||||
private module VueAPI {
|
||||
/** A value exported from a `.vue` file. */
|
||||
private class VueExportEntryPoint extends API::EntryPoint {
|
||||
VueExportEntryPoint() { this = "VueExportEntryPoint" }
|
||||
|
||||
override DataFlow::SourceNode getAUse() { none() }
|
||||
|
||||
override DataFlow::Node getARhs() {
|
||||
exists(Module mod |
|
||||
mod.getFile() instanceof Vue::VueFile and
|
||||
result = mod.getAnExportedValue("default")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An API node representing the object passed to the Vue constructor `new Vue({...})`
|
||||
|
||||
Reference in New Issue
Block a user