Skip to content

Commit bbdda9e

Browse files
authored
Merge pull request github#10727 from erik-krogh/js-last-msg
JS: fix some more style-guide violations in the alert-messages
2 parents f237360 + 3e06e20 commit bbdda9e

File tree

128 files changed

+1301
-1282
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+1301
-1282
lines changed

javascript/ql/examples/queries/dataflow/DecodingAfterSanitization/DecodingAfterSanitizationGeneralized.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ from DecodingAfterSanitization cfg, PathNode source, PathNode sink, DecodingCall
4848
where
4949
cfg.hasFlowPath(source, sink) and
5050
decoder.getInput() = sink.getNode()
51-
select sink.getNode(), source, sink,
52-
decoder.getKind() + " invalidates the HTML sanitization performed $@.", source.getNode(), "here"
51+
select sink.getNode(), source, sink, decoder.getKind() + " invalidates .", source.getNode(),
52+
"this HTML sanitization performed"

javascript/ql/lib/semmle/javascript/security/dataflow/CodeInjectionCustomizations.qll

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ module CodeInjection {
1717
*/
1818
abstract class Sink extends DataFlow::Node {
1919
/**
20+
* DEPRECATED: Use `getMessagePrefix()` instead.
2021
* Gets the substitute for `X` in the message `User-provided value flows to X`.
2122
*/
22-
string getMessageSuffix() { result = "this location and is interpreted as code" }
23+
deprecated string getMessageSuffix() { result = "this location and is interpreted as code" }
24+
25+
/**
26+
* Gets the prefix for the message `X depends on a user-provided value.`.
27+
*/
28+
string getMessagePrefix() { result = "This code execution" }
2329
}
2430

2531
/**
@@ -125,10 +131,14 @@ module CodeInjection {
125131
)
126132
}
127133

128-
override string getMessageSuffix() {
134+
deprecated override string getMessageSuffix() {
129135
result =
130136
"this location and is interpreted by " + templateType + ", which may evaluate it as code"
131137
}
138+
139+
override string getMessagePrefix() {
140+
result = "This " + templateType + " template, which may contain code,"
141+
}
132142
}
133143

134144
/**
@@ -288,9 +298,11 @@ module CodeInjection {
288298

289299
/** A sink for code injection via template injection. */
290300
abstract private class TemplateSink extends Sink {
291-
override string getMessageSuffix() {
301+
deprecated override string getMessageSuffix() {
292302
result = "this location and is interpreted as a template, which may contain code"
293303
}
304+
305+
override string getMessagePrefix() { result = "Template, which may contain code," }
294306
}
295307

296308
/**

javascript/ql/lib/semmle/javascript/security/dataflow/UnsafeCodeConstructionCustomizations.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ module UnsafeCodeConstruction {
3737
* Gets the node where the unsafe code is executed.
3838
*/
3939
abstract DataFlow::Node getCodeSink();
40+
41+
/**
42+
* Gets the type of sink.
43+
*/
44+
string getSinkType() { result = "code construction" }
4045
}
4146

4247
/**
@@ -59,5 +64,7 @@ module UnsafeCodeConstruction {
5964
}
6065

6166
override DataFlow::Node getCodeSink() { result = codeSink }
67+
68+
override string getSinkType() { result = "string concatenation" }
6269
}
6370
}

javascript/ql/lib/semmle/javascript/security/dataflow/UnsafeHtmlConstructionCustomizations.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ module UnsafeHtmlConstruction {
178178
)
179179
}
180180

181-
override string describe() { result = "Markdown rendering" }
181+
override string describe() { result = "markdown rendering" }
182182
}
183183

184184
/** A test for the value of `typeof x`, restricting the potential types of `x`. */

javascript/ql/lib/semmle/javascript/security/dataflow/UnsafeShellCommandConstructionCustomizations.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ module UnsafeShellCommandConstruction {
9797
)
9898
}
9999

100-
override string getSinkType() { result = "String concatenation" }
100+
override string getSinkType() { result = "string concatenation" }
101101

102102
override SystemCommandExecution getCommandExecution() { result = sys }
103103

@@ -125,7 +125,7 @@ module UnsafeShellCommandConstruction {
125125
)
126126
}
127127

128-
override string getSinkType() { result = "Array element" }
128+
override string getSinkType() { result = "array element" }
129129

130130
override SystemCommandExecution getCommandExecution() { result = sys }
131131

@@ -148,7 +148,7 @@ module UnsafeShellCommandConstruction {
148148
)
149149
}
150150

151-
override string getSinkType() { result = "Formatted string" }
151+
override string getSinkType() { result = "formatted string" }
152152

153153
override SystemCommandExecution getCommandExecution() { result = sys }
154154

@@ -195,7 +195,7 @@ module UnsafeShellCommandConstruction {
195195
)
196196
}
197197

198-
override string getSinkType() { result = "Shell argument" }
198+
override string getSinkType() { result = "shell argument" }
199199

200200
override SystemCommandExecution getCommandExecution() { result = sys }
201201

@@ -217,7 +217,7 @@ module UnsafeShellCommandConstruction {
217217
)
218218
}
219219

220-
override string getSinkType() { result = "Path concatenation" }
220+
override string getSinkType() { result = "path concatenation" }
221221

222222
override SystemCommandExecution getCommandExecution() { result = sys }
223223

javascript/ql/src/AngularJS/DuplicateDependency.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ from AngularJS::InjectableFunction f, DataFlow::Node node, string name
2424
where
2525
isRepeatedDependency(f, name, node) and
2626
not count(f.asFunction().getParameterByName(name)) > 1 // avoid duplicating reports from js/duplicate-parameter-name
27-
select f.asFunction().getFunction().(FirstLineOf), "This function has a duplicate dependency '$@'.",
27+
select f.asFunction().getFunction().(FirstLineOf), "This function has a duplicate dependency $@.",
2828
node, name

javascript/ql/src/AngularJS/InsecureUrlWhitelist.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,5 @@ from ResourceUrlWhitelistEntry entry, DataFlow::MethodCallNode setupCall, string
7878
where
7979
entry.isInsecure(explanation) and
8080
setupCall = entry.getSetupCall()
81-
select setupCall, "'$@' is not a secure whitelist entry, because " + explanation + ".", entry,
81+
select setupCall, "$@ is not a secure whitelist entry, because " + explanation + ".", entry,
8282
entry.toString()

javascript/ql/src/DOM/DuplicateAttributes.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ predicate duplicate(DOM::AttributeDefinition earlier, DOM::AttributeDefinition l
2828

2929
from DOM::AttributeDefinition earlier, DOM::AttributeDefinition later
3030
where duplicate(earlier, later) and not duplicate(_, earlier)
31-
select earlier, "This attribute is duplicated $@.", later, "here"
31+
select earlier, "This attribute $@.", later, "is duplicated later"

javascript/ql/src/Declarations/ClobberingVarInit.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ where
2525
exists(Expr e1, Expr e2 | e1 = vd1.getInit() and e2 = vd2.getInit() |
2626
not v.getAnAccess().getParentExpr*() = e2
2727
)
28-
select vd2.(FirstLineOf), "This initialization of " + v.getName() + " overwrites $@.", vd1,
29-
"an earlier initialization"
28+
select vd2.(FirstLineOf), "This initialization of " + v.getName() + " overwrites an $@.", vd1,
29+
"earlier initialization"

javascript/ql/src/Declarations/DuplicateVarDecl.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ where
1818
vd1.getBindingPattern().getAVariable() = v and
1919
vd2.getBindingPattern().getAVariable() = v and
2020
i < j
21-
select vd2, "Variable " + v.getName() + " has already been declared $@.", vd1, "here"
21+
select vd2, "Variable " + v.getName() + " has already $@.", vd1, "been previously declared"

0 commit comments

Comments
 (0)