Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea175b2

Browse files
author
Esben Sparre Andreasen
committed
JS: introduce Vue XSS sinks
1 parent a6cfee5 commit ea175b2

4 files changed

Lines changed: 28 additions & 2 deletions

File tree

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44

55
import javascript
6-
import semmle.javascript.security.dataflow.DomBasedXss
76

87
module Vue {
98
/**
@@ -372,5 +371,4 @@ module Vue {
372371
* A `.vue` file.
373372
*/
374373
class VueFile extends File { VueFile() { getExtension() = "vue" } }
375-
376374
}

javascript/ql/src/semmle/javascript/security/dataflow/DomBasedXss.qll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,26 @@ module DomBasedXss {
188188

189189
override string getVulnerabilityKind() { result = "HTML injection" }
190190
}
191+
192+
193+
/**
194+
* A write to the `template` option of a Vue instance, viewed as an XSS sink.
195+
*/
196+
class VueTemplateSink extends DomBasedXss::Sink {
197+
VueTemplateSink() { this = any(Vue::Instance i).getTemplate() }
198+
}
199+
200+
/**
201+
* The tag name argument to the `createElement` parameter of the
202+
* `render` method of a Vue instance, viewed as an XSS sink.
203+
*/
204+
class VueCreateElementSink extends DomBasedXss::Sink {
205+
VueCreateElementSink() {
206+
exists(Vue::Instance i, DataFlow::FunctionNode f |
207+
f.flowsTo(i.getRender()) and
208+
this = f.getParameter(0).getACall().getArgument(0)
209+
)
210+
}
211+
}
212+
191213
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| tst.js:5:13:5:13 | a |
2+
| tst.js:38:12:38:17 | danger |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import javascript
2+
import semmle.javascript.security.dataflow.DomBasedXss
3+
4+
select any(DomBasedXss::Sink s)

0 commit comments

Comments
 (0)