mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
Merge pull request #828 from esben-semmle/js/vue-support-1
JS: basic Vue support
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
| tst.html:2:3:2:32 | <script>...</> | tst.js:1:1:2:0 | <toplevel> |
|
||||
| tst.html:5:3:5:38 | <script>...</> | tst.js:1:1:2:0 | <toplevel> |
|
||||
| tst.html:8:3:8:25 | <script>...</> | tst.html:8:11:8:16 | <toplevel> |
|
||||
| tst.html:9:3:11:11 | <script>...</> | tst.html:9:11:11:2 | <toplevel> |
|
||||
@@ -0,0 +1,5 @@
|
||||
import javascript
|
||||
|
||||
|
||||
from HTML::ScriptElement e
|
||||
select e, e.getScript()
|
||||
12
javascript/ql/test/library-tests/HTML/HtmlScript/tst.html
Normal file
12
javascript/ql/test/library-tests/HTML/HtmlScript/tst.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<script src="tst.js"></script>
|
||||
<script src="does-not-exist.js"></script>
|
||||
|
||||
<script src="tst.js">inline</script>
|
||||
<script src="does-not-exist.js">inline</script>
|
||||
|
||||
<script>inline</script>
|
||||
<script>
|
||||
inline
|
||||
</script>
|
||||
</html>
|
||||
1
javascript/ql/test/library-tests/HTML/HtmlScript/tst.js
Normal file
1
javascript/ql/test/library-tests/HTML/HtmlScript/tst.js
Normal file
@@ -0,0 +1 @@
|
||||
not_inline
|
||||
@@ -0,0 +1,17 @@
|
||||
| single-component-file-1.vue:0:0:0:0 | single-component-file-1.vue |
|
||||
| single-file-component-2.vue:0:0:0:0 | single-file-component-2.vue |
|
||||
| single-file-component-3.vue:0:0:0:0 | single-file-component-3.vue |
|
||||
| tst.js:3:1:10:2 | new Vue ... 2\\n\\t}\\n}) |
|
||||
| tst.js:12:1:16:2 | new Vue ... \\t}),\\n}) |
|
||||
| tst.js:18:1:27:2 | Vue.com ... }\\n\\t}\\n}) |
|
||||
| tst.js:29:1:35:2 | new Vue ... }\\n\\t}\\n}) |
|
||||
| tst.js:37:1:39:2 | new Vue ... nger\\n}) |
|
||||
| tst.js:41:17:47:2 | Vue.ext ... \\n }\\n}) |
|
||||
| tst.js:48:1:50:2 | new Ext ... 42 }\\n}) |
|
||||
| tst.js:51:17:57:2 | Vue.ext ... \\n }\\n}) |
|
||||
| tst.js:58:1:61:2 | new Vue ... 42 }\\n}) |
|
||||
| tst.js:63:1:66:2 | new Vue ... 42 }\\n}) |
|
||||
| tst.js:72:1:75:2 | new Vue ... 42 }\\n}) |
|
||||
| tst.js:77:20:83:2 | Vue.ext ... \\n }\\n}) |
|
||||
| tst.js:85:1:87:2 | new Vue ... e; }\\n}) |
|
||||
| tst.js:94:2:96:3 | new Vue ... f,\\n\\t}) |
|
||||
@@ -0,0 +1,3 @@
|
||||
import javascript
|
||||
|
||||
select any(Vue::Instance i)
|
||||
@@ -0,0 +1,22 @@
|
||||
| single-component-file-1.vue:0:0:0:0 | single-component-file-1.vue | dataA | single-component-file-1.vue:6:40:6:41 | 42 |
|
||||
| single-file-component-3.vue:0:0:0:0 | single-file-component-3.vue | dataA | single-file-component-3-script.js:4:37:4:38 | 42 |
|
||||
| tst.js:3:1:10:2 | new Vue ... 2\\n\\t}\\n}) | dataA | tst.js:8:10:8:11 | 42 |
|
||||
| tst.js:12:1:16:2 | new Vue ... \\t}),\\n}) | dataA | tst.js:14:10:14:11 | 42 |
|
||||
| tst.js:18:1:27:2 | Vue.com ... }\\n\\t}\\n}) | dataA | tst.js:20:10:20:11 | 42 |
|
||||
| tst.js:18:1:27:2 | Vue.com ... }\\n\\t}\\n}) | dataB | tst.js:24:17:24:20 | true |
|
||||
| tst.js:29:1:35:2 | new Vue ... }\\n\\t}\\n}) | x | tst.js:31:12:31:13 | 42 |
|
||||
| tst.js:29:1:35:2 | new Vue ... }\\n\\t}\\n}) | y | tst.js:32:19:32:20 | 42 |
|
||||
| tst.js:29:1:35:2 | new Vue ... }\\n\\t}\\n}) | z2 | tst.js:33:36:33:37 | 42 |
|
||||
| tst.js:41:17:47:2 | Vue.ext ... \\n }\\n}) | fromSuper | tst.js:44:18:44:19 | 42 |
|
||||
| tst.js:48:1:50:2 | new Ext ... 42 }\\n}) | fromSub | tst.js:49:19:49:20 | 42 |
|
||||
| tst.js:48:1:50:2 | new Ext ... 42 }\\n}) | fromSuper | tst.js:44:18:44:19 | 42 |
|
||||
| tst.js:51:17:57:2 | Vue.ext ... \\n }\\n}) | fromSuper | tst.js:54:18:54:19 | 42 |
|
||||
| tst.js:58:1:61:2 | new Vue ... 42 }\\n}) | fromSub | tst.js:60:19:60:20 | 42 |
|
||||
| tst.js:63:1:66:2 | new Vue ... 42 }\\n}) | fromMixin1 | tst.js:64:32:64:33 | 42 |
|
||||
| tst.js:63:1:66:2 | new Vue ... 42 }\\n}) | fromMixin2 | tst.js:64:61:64:62 | 42 |
|
||||
| tst.js:63:1:66:2 | new Vue ... 42 }\\n}) | fromSub | tst.js:65:19:65:20 | 42 |
|
||||
| tst.js:72:1:75:2 | new Vue ... 42 }\\n}) | fromMixinValue | tst.js:69:28:69:29 | 42 |
|
||||
| tst.js:72:1:75:2 | new Vue ... 42 }\\n}) | fromSub | tst.js:74:19:74:20 | 42 |
|
||||
| tst.js:77:20:83:2 | Vue.ext ... \\n }\\n}) | deadExtended | tst.js:80:21:80:22 | 42 |
|
||||
| tst.js:85:1:87:2 | new Vue ... e; }\\n}) | created | tst.js:86:38:86:41 | true |
|
||||
| tst.js:94:2:96:3 | new Vue ... f,\\n\\t}) | dataA | tst.js:89:22:89:23 | 42 |
|
||||
@@ -0,0 +1,4 @@
|
||||
import javascript
|
||||
|
||||
from Vue::Instance i, string name
|
||||
select i, name, i.getAPropertyValue(name)
|
||||
@@ -0,0 +1,25 @@
|
||||
| single-component-file-1.vue:0:0:0:0 | single-component-file-1.vue | data | single-component-file-1.vue:6:11:6:45 | functio ... 42 } } |
|
||||
| single-file-component-3.vue:0:0:0:0 | single-file-component-3.vue | data | single-file-component-3-script.js:4:8:4:42 | functio ... 42 } } |
|
||||
| tst.js:3:1:10:2 | new Vue ... 2\\n\\t}\\n}) | data | tst.js:7:8:9:2 | {\\n\\t\\tdataA: 42\\n\\t} |
|
||||
| tst.js:3:1:10:2 | new Vue ... 2\\n\\t}\\n}) | render | tst.js:4:10:6:2 | functio ... c);\\n\\t} |
|
||||
| tst.js:12:1:16:2 | new Vue ... \\t}),\\n}) | data | tst.js:13:8:15:3 | () => ( ... 42\\n\\t}) |
|
||||
| tst.js:18:1:27:2 | Vue.com ... }\\n\\t}\\n}) | data | tst.js:19:8:21:3 | () => ( ... 42\\n\\t}) |
|
||||
| tst.js:18:1:27:2 | Vue.com ... }\\n\\t}\\n}) | methods | tst.js:22:11:26:2 | {\\n\\t\\tmet ... \\n\\t\\t}\\n\\t} |
|
||||
| tst.js:29:1:35:2 | new Vue ... }\\n\\t}\\n}) | computed | tst.js:30:12:34:2 | {\\n\\t\\tx: ... } }\\n\\t} |
|
||||
| tst.js:37:1:39:2 | new Vue ... nger\\n}) | template | tst.js:38:12:38:17 | danger |
|
||||
| tst.js:41:17:47:2 | Vue.ext ... \\n }\\n}) | data | tst.js:42:9:46:3 | functio ... };\\n } |
|
||||
| tst.js:48:1:50:2 | new Ext ... 42 }\\n}) | data | tst.js:42:9:46:3 | functio ... };\\n } |
|
||||
| tst.js:48:1:50:2 | new Ext ... 42 }\\n}) | data | tst.js:49:8:49:22 | { fromSub: 42 } |
|
||||
| tst.js:51:17:57:2 | Vue.ext ... \\n }\\n}) | data | tst.js:52:9:56:3 | functio ... };\\n } |
|
||||
| tst.js:58:1:61:2 | new Vue ... 42 }\\n}) | data | tst.js:60:8:60:22 | { fromSub: 42 } |
|
||||
| tst.js:58:1:61:2 | new Vue ... 42 }\\n}) | mixins | tst.js:59:10:59:18 | Extended2 |
|
||||
| tst.js:63:1:66:2 | new Vue ... 42 }\\n}) | data | tst.js:64:18:64:35 | { fromMixin1: 42 } |
|
||||
| tst.js:63:1:66:2 | new Vue ... 42 }\\n}) | data | tst.js:64:47:64:64 | { fromMixin2: 42 } |
|
||||
| tst.js:63:1:66:2 | new Vue ... 42 }\\n}) | data | tst.js:65:8:65:22 | { fromSub: 42 } |
|
||||
| tst.js:63:1:66:2 | new Vue ... 42 }\\n}) | mixins | tst.js:64:10:64:67 | [{data: ... 42 } }] |
|
||||
| tst.js:72:1:75:2 | new Vue ... 42 }\\n}) | data | tst.js:70:20:70:28 | mixinData |
|
||||
| tst.js:72:1:75:2 | new Vue ... 42 }\\n}) | data | tst.js:74:8:74:22 | { fromSub: 42 } |
|
||||
| tst.js:72:1:75:2 | new Vue ... 42 }\\n}) | mixins | tst.js:73:10:73:15 | mixins |
|
||||
| tst.js:77:20:83:2 | Vue.ext ... \\n }\\n}) | data | tst.js:78:9:82:3 | functio ... };\\n } |
|
||||
| tst.js:85:1:87:2 | new Vue ... e; }\\n}) | created | tst.js:86:11:86:44 | functio ... true; } |
|
||||
| tst.js:94:2:96:3 | new Vue ... f,\\n\\t}) | data | tst.js:95:9:95:9 | f |
|
||||
@@ -0,0 +1,4 @@
|
||||
import javascript
|
||||
|
||||
from Vue::Instance i, string name
|
||||
select i, name, i.getOption(name)
|
||||
@@ -0,0 +1,2 @@
|
||||
| tst.js:5:13:5:13 | a |
|
||||
| tst.js:38:12:38:17 | danger |
|
||||
@@ -0,0 +1,4 @@
|
||||
import javascript
|
||||
import semmle.javascript.security.dataflow.DomBasedXss
|
||||
|
||||
select any(DomBasedXss::Sink s)
|
||||
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<p v-html="dataA"/>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data: function() { return { dataA: 42 } }
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
@@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<p v-html="dataA"/>
|
||||
</template>
|
||||
<script>
|
||||
var x = require('x');
|
||||
module.exports = { // not properly detected by the module system yet
|
||||
data: function() { return { dataA: 42 } }
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
@@ -0,0 +1,5 @@
|
||||
var x = require('x');
|
||||
|
||||
module.exports = {
|
||||
data: function() { return { dataA: 42 } }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<template>
|
||||
<p v-html="dataA"/>
|
||||
</template>
|
||||
<script src="./single-file-component-3-script.js">
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
97
javascript/ql/test/library-tests/frameworks/Vue/tst.js
Normal file
97
javascript/ql/test/library-tests/frameworks/Vue/tst.js
Normal file
@@ -0,0 +1,97 @@
|
||||
var Vue = require('vue');
|
||||
|
||||
new Vue({
|
||||
render: function(ce) {
|
||||
return ce(a, b, c);
|
||||
},
|
||||
data: {
|
||||
dataA: 42
|
||||
}
|
||||
});
|
||||
|
||||
new Vue({
|
||||
data: () => ({
|
||||
dataA: 42
|
||||
}),
|
||||
});
|
||||
|
||||
Vue.component("my-component", {
|
||||
data: () => ({
|
||||
dataA: 42
|
||||
}),
|
||||
methods: {
|
||||
method: function() {
|
||||
this.dataB = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
new Vue({
|
||||
computed: {
|
||||
x: () => 42,
|
||||
y: { get: () => 42 },
|
||||
z1: { set: function(){ this.z2 = 42; } }
|
||||
}
|
||||
});
|
||||
|
||||
new Vue({
|
||||
template: danger
|
||||
});
|
||||
|
||||
var Extended1 = Vue.extend({
|
||||
data: function () {
|
||||
return {
|
||||
fromSuper: 42
|
||||
};
|
||||
}
|
||||
});
|
||||
new Extended1({
|
||||
data: { fromSub: 42 }
|
||||
});
|
||||
var Extended2 = Vue.extend({
|
||||
data: function () {
|
||||
return {
|
||||
fromSuper: 42
|
||||
};
|
||||
}
|
||||
});
|
||||
new Vue({
|
||||
mixins: Extended2,
|
||||
data: { fromSub: 42 }
|
||||
});
|
||||
|
||||
new Vue({
|
||||
mixins: [{data: { fromMixin1: 42 } }, {data: { fromMixin2: 42 } }],
|
||||
data: { fromSub: 42 }
|
||||
});
|
||||
|
||||
var mixinData = { };
|
||||
mixinData.fromMixinValue = 42;
|
||||
var mixin = {data: mixinData };
|
||||
var mixins = [mixin];
|
||||
new Vue({
|
||||
mixins: mixins,
|
||||
data: { fromSub: 42 }
|
||||
});
|
||||
|
||||
var DeadExtended = Vue.extend({
|
||||
data: function () {
|
||||
return {
|
||||
deadExtended: 42
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
new Vue({
|
||||
created: function(){ this.created = true; }
|
||||
});
|
||||
(function() {
|
||||
var data = { dataA: 42 };
|
||||
function f() {
|
||||
return data;
|
||||
}
|
||||
|
||||
new Vue({
|
||||
data: f,
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user