Skip to content

Commit 5f9bd7a

Browse files
authored
Merge pull request #7984 from erik-krogh/fix-ql-for-ql-js
JS: fix most ql-for-ql warnings
2 parents e4f801b + a1c5724 commit 5f9bd7a

29 files changed

+117
-167
lines changed

javascript/ql/examples/queries/dataflow/BackendIdor/BackendIdor.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import DataFlow
1313
import DataFlow::PathGraph
1414

1515
/**
16-
* Tracks user-controlled values into a 'userId' property sent to a backend service.
16+
* A taint-tracking configuration that tracks user-controlled values into a 'userId' property sent to a backend service.
1717
*/
1818
class IdorTaint extends TaintTracking::Configuration {
1919
IdorTaint() { this = "IdorTaint" }
@@ -34,7 +34,7 @@ class IdorTaint extends TaintTracking::Configuration {
3434
}
3535

3636
/**
37-
* Sanitize values that have succesfully been compared to another value.
37+
* A sanitizer for values that have succesfully been compared to another value.
3838
*/
3939
class EqualityGuard extends TaintTracking::SanitizerGuardNode, ValueNode {
4040
override EqualityTest astNode;

javascript/ql/examples/queries/dataflow/InformationDisclosure/InformationDisclosure.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import DataFlow
1313
import DataFlow::PathGraph
1414

1515
/**
16-
* Tracks authentication tokens ("authKey") to a postMessage call with unrestricted target origin.
16+
* A dataflow configuration that tracks authentication tokens ("authKey")
17+
* to a postMessage call with unrestricted target origin.
1718
*
1819
* For example:
1920
* ```

javascript/ql/examples/queries/dataflow/StoredXss/StoredXss.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import semmle.javascript.security.dataflow.StoredXssQuery
1212
import DataFlow::PathGraph
1313

1414
/**
15-
* Data returned from a MySQL query, such as the `data` parameter in this example:
15+
* The data returned from a MySQL query, such as the `data` parameter in this example:
1616
* ```
1717
* let mysql = require('mysql');
1818
* let connection = mysql.createConnection();

javascript/ql/examples/queries/dataflow/StoredXss/StoredXssTypeTracking.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ DataFlow::SourceNode mysqlConnection(DataFlow::TypeTracker t) {
2828
DataFlow::SourceNode mysqlConnection() { result = mysqlConnection(DataFlow::TypeTracker::end()) }
2929

3030
/**
31-
* Data returned from a MySQL query.
31+
* The data returned from a MySQL query.
3232
*
3333
* For example:
3434
* ```

javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/BaseScoring.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ external predicate availableMlModels(
1515
ATMConfig getCfg() { any() }
1616

1717
/**
18-
* Scoring information produced by a scoring model.
18+
* A string containing scoring information produced by a scoring model.
1919
*
2020
* Scoring models include embedding models and endpoint scoring models.
2121
*/

javascript/ql/lib/semmle/javascript/DefensiveProgramming.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ module DefensiveExpressionTest {
188188
}
189189

190190
/**
191-
* Comparison against `undefined`, such as `x === undefined`.
191+
* A comparison against `undefined`, such as `x === undefined`.
192192
*/
193193
class UndefinedComparison extends NullUndefinedComparison {
194194
UndefinedComparison() { op2type = TTUndefined() }

javascript/ql/lib/semmle/javascript/Routing.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ module Routing {
652652
*/
653653
module Router {
654654
/**
655-
* Creation of a mutable router object.
655+
* The creation of a mutable router object.
656656
*/
657657
abstract class Range extends DataFlow::Node {
658658
/** Gets a reference to this router. */

javascript/ql/lib/semmle/javascript/TypeScript.qll

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,7 +1679,7 @@ class EnumScope extends @enum_scope, Scope {
16791679
}
16801680

16811681
/**
1682-
* Scope induced by a declaration of form `declare module "X" {...}`.
1682+
* A scope induced by a declaration of form `declare module "X" {...}`.
16831683
*/
16841684
class ExternalModuleScope extends @external_module_scope, Scope {
16851685
override string toString() { result = "external module scope" }
@@ -2836,12 +2836,7 @@ class ConstructorCallSignatureType extends CallSignatureType, @constructor_signa
28362836
private class PromiseTypeName extends TypeName {
28372837
PromiseTypeName() {
28382838
// The name must suggest it is a promise.
2839-
exists(string name | name = this.getName() |
2840-
name.matches("%Promise") or
2841-
name.matches("%PromiseLike") or
2842-
name.matches("%Thenable") or
2843-
name.matches("%Deferred")
2844-
) and
2839+
this.getName().matches(["%Promise", "%PromiseLike", "%Thenable", "%Deferred"]) and
28452840
// The `then` method should take a callback, taking an argument of type `T`.
28462841
exists(TypeReference self, Type thenMethod | self = this.getType() |
28472842
self.getNumTypeArgument() = 1 and

javascript/ql/lib/semmle/javascript/dataflow/TaintTracking.qll

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -635,39 +635,18 @@ module TaintTracking {
635635
pred.asExpr() = succ.getAstNode().(MethodCallExpr).getReceiver() and
636636
(
637637
// sorted, interesting, properties of String.prototype
638-
name = "anchor" or
639-
name = "big" or
640-
name = "blink" or
641-
name = "bold" or
642-
name = "concat" or
643-
name = "fixed" or
644-
name = "fontcolor" or
645-
name = "fontsize" or
646-
name = "italics" or
647-
name = "link" or
648-
name = "padEnd" or
649-
name = "padStart" or
650-
name = "repeat" or
651-
name = "replace" or
652-
name = "replaceAll" or
653-
name = "slice" or
654-
name = "small" or
655-
name = "split" or
656-
name = "strike" or
657-
name = "sub" or
658-
name = "substr" or
659-
name = "substring" or
660-
name = "sup" or
661-
name = "toLocaleLowerCase" or
662-
name = "toLocaleUpperCase" or
663-
name = "toLowerCase" or
664-
name = "toUpperCase" or
665-
name = "trim" or
666-
name = "trimLeft" or
667-
name = "trimRight" or
638+
name =
639+
[
640+
"anchor", "big", "blink", "bold", "concat", "fixed", "fontcolor", "fontsize",
641+
"italics", "link", "padEnd", "padStart", "repeat", "replace", "replaceAll", "slice",
642+
"small", "split", "strike", "sub", "substr", "substring", "sup",
643+
"toLocaleLowerCase", "toLocaleUpperCase", "toLowerCase", "toUpperCase", "trim",
644+
"trimLeft", "trimRight"
645+
]
646+
or
668647
// sorted, interesting, properties of Object.prototype
669-
name = "toString" or
670-
name = "valueOf" or
648+
name = ["toString", "valueOf"]
649+
or
671650
// sorted, interesting, properties of Array.prototype
672651
name = "join"
673652
)

javascript/ql/lib/semmle/javascript/dataflow/TypeInference.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class AnalyzedModule extends TopLevel {
230230
}
231231

232232
/**
233-
* Flow analysis for functions.
233+
* A function for which analysis results are available.
234234
*/
235235
class AnalyzedFunction extends DataFlow::AnalyzedValueNode {
236236
override Function astNode;

0 commit comments

Comments
 (0)