Skip to content

Commit b0358d7

Browse files
author
Esben Sparre Andreasen
committed
JS: autoformat
1 parent 97edfc5 commit b0358d7

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

javascript/ql/src/semmle/javascript/dataflow/DataFlow.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ module DataFlow {
116116
int getIntValue() { result = asExpr().getIntValue() }
117117

118118
/** Gets a function value that may reach this node. */
119-
FunctionNode getAFunctionValue() { result.getAstNode() = analyze().getAValue().(AbstractCallable).getFunction() }
119+
FunctionNode getAFunctionValue() {
120+
result.getAstNode() = analyze().getAValue().(AbstractCallable).getFunction()
121+
}
120122

121123
/**
122124
* Holds if this expression may refer to the initial value of parameter `p`.
@@ -1155,7 +1157,7 @@ module DataFlow {
11551157
nd.asExpr() instanceof ExternalModuleReference and
11561158
cause = "import"
11571159
or
1158-
exists (Expr e | e = nd.asExpr() and cause = "heap" |
1160+
exists(Expr e | e = nd.asExpr() and cause = "heap" |
11591161
e instanceof PropAccess or
11601162
e instanceof E4X::XMLAnyName or
11611163
e instanceof E4X::XMLAttributeSelector or

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ module Vue {
392392
* A taint propagating data flow edge through a Vue instance property.
393393
*/
394394
class InstanceHeapStep extends TaintTracking::AdditionalTaintStep {
395-
396395
DataFlow::Node src;
397396

398397
InstanceHeapStep() {
@@ -404,19 +403,16 @@ module Vue {
404403
)
405404
}
406405

407-
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
408-
pred = src and succ = this
409-
}
410-
406+
override predicate step(DataFlow::Node pred, DataFlow::Node succ) { pred = src and succ = this }
411407
}
412408

413409
/*
414410
* Provides classes for working with Vue templates.
415411
*/
412+
416413
module Template {
417414
// Currently only supports HTML elements, but it may be possible to parse simple string templates later
418-
private newtype TElement =
419-
MkHtmlElement(HTML::Element e) { e.getFile() instanceof VueFile }
415+
private newtype TElement = MkHtmlElement(HTML::Element e) { e.getFile() instanceof VueFile }
420416

421417
/**
422418
* An element of a template.
@@ -472,5 +468,4 @@ module Vue {
472468
HTML::Element getElement() { result = elem }
473469
}
474470
}
475-
476471
}

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,15 @@ module DomBasedXss {
203203
*/
204204
class VHtmlSink extends DomBasedXss::Sink {
205205
HTML::Attribute attr;
206-
VHtmlSink() { this.(DataFlow::HtmlAttributeNode).getAttribute() = attr and attr.getName() = "v-html" }
206+
207+
VHtmlSink() {
208+
this.(DataFlow::HtmlAttributeNode).getAttribute() = attr and attr.getName() = "v-html"
209+
}
207210

208211
/**
209212
* Gets the HTML attribute of this sink.
210213
*/
211-
HTML::Attribute getAttr() {
212-
result = attr
213-
}
214+
HTML::Attribute getAttr() { result = attr }
214215
}
215216

216217
/**
@@ -226,7 +227,10 @@ module DomBasedXss {
226227

227228
VHtmlSourceWrite() {
228229
exists(Vue::Instance instance, string expr |
229-
attr.getAttr().getRoot() = instance.getTemplateElement().(Vue::Template::HtmlElement).getElement() and
230+
attr.getAttr().getRoot() = instance
231+
.getTemplateElement()
232+
.(Vue::Template::HtmlElement)
233+
.getElement() and
230234
expr = attr.getAttr().getValue() and
231235
// only support for simple identifier expressions
232236
expr.regexpMatch("(?i)[a-z0-9_]+") and

0 commit comments

Comments
 (0)