Skip to content

Commit 3bbded5

Browse files
author
Max Schaefer
committed
JavaScript: Autoformat.
1 parent bb0771b commit 3bbded5

1 file changed

Lines changed: 13 additions & 39 deletions

File tree

javascript/ql/src/Security/CWE-116/DoubleEscaping.ql

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,12 @@ abstract class Replacement extends DataFlow::Node {
116116
/**
117117
* Gets the previous replacement in this chain of replacements.
118118
*/
119-
Replacement getPreviousReplacement() {
120-
result.getOutput() = getASimplePredecessor*(getInput())
121-
}
119+
Replacement getPreviousReplacement() { result.getOutput() = getASimplePredecessor*(getInput()) }
122120

123121
/**
124122
* Gets the next replacement in this chain of replacements.
125123
*/
126-
Replacement getNextReplacement() {
127-
this = result.getPreviousReplacement()
128-
}
124+
Replacement getNextReplacement() { this = result.getPreviousReplacement() }
129125

130126
/**
131127
* Gets an earlier replacement in this chain of replacements that
@@ -182,35 +178,25 @@ class GlobalStringReplacement extends Replacement, DataFlow::MethodCallNode {
182178
)
183179
}
184180

185-
override DataFlow::Node getInput() {
186-
result = this.getReceiver()
187-
}
181+
override DataFlow::Node getInput() { result = this.getReceiver() }
188182

189-
override DataFlow::SourceNode getOutput() {
190-
result = this
191-
}
183+
override DataFlow::SourceNode getOutput() { result = this }
192184
}
193185

194186
/**
195187
* A call to `JSON.stringify`, viewed as a string replacement.
196188
*/
197189
class JsonStringifyReplacement extends Replacement, DataFlow::CallNode {
198-
JsonStringifyReplacement() {
199-
this = DataFlow::globalVarRef("JSON").getAMemberCall("stringify")
200-
}
190+
JsonStringifyReplacement() { this = DataFlow::globalVarRef("JSON").getAMemberCall("stringify") }
201191

202192
override predicate replaces(string input, string output) {
203193
input = "\\" and output = "\\\\"
204194
// the other replacements are not relevant for this query
205195
}
206196

207-
override DataFlow::Node getInput() {
208-
result = this.getArgument(0)
209-
}
197+
override DataFlow::Node getInput() { result = this.getArgument(0) }
210198

211-
override DataFlow::SourceNode getOutput() {
212-
result = this
213-
}
199+
override DataFlow::SourceNode getOutput() { result = this }
214200
}
215201

216202
/**
@@ -219,22 +205,16 @@ class JsonStringifyReplacement extends Replacement, DataFlow::CallNode {
219205
class JsonParseReplacement extends Replacement {
220206
JsonParserCall self;
221207

222-
JsonParseReplacement() {
223-
this = self
224-
}
208+
JsonParseReplacement() { this = self }
225209

226210
override predicate replaces(string input, string output) {
227211
input = "\\\\" and output = "\\"
228212
// the other replacements are not relevant for this query
229213
}
230214

231-
override DataFlow::Node getInput() {
232-
result = self.getInput()
233-
}
215+
override DataFlow::Node getInput() { result = self.getInput() }
234216

235-
override DataFlow::SourceNode getOutput() {
236-
result = self.getOutput()
237-
}
217+
override DataFlow::SourceNode getOutput() { result = self.getOutput() }
238218
}
239219

240220
/**
@@ -252,17 +232,11 @@ class WrappedReplacement extends Replacement, DataFlow::CallNode {
252232
)
253233
}
254234

255-
override predicate replaces(string input, string output) {
256-
inner.replaces(input, output)
257-
}
235+
override predicate replaces(string input, string output) { inner.replaces(input, output) }
258236

259-
override DataFlow::Node getInput() {
260-
result = getArgument(i)
261-
}
237+
override DataFlow::Node getInput() { result = getArgument(i) }
262238

263-
override DataFlow::SourceNode getOutput() {
264-
result = this
265-
}
239+
override DataFlow::SourceNode getOutput() { result = this }
266240
}
267241

268242
from Replacement primary, Replacement supplementary, string message, string metachar

0 commit comments

Comments
 (0)