mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Javascript: Autoformat qlls
This commit is contained in:
@@ -212,7 +212,9 @@ class JavaScriptURL extends @javascript_url, CodeInAttribute { }
|
||||
/**
|
||||
* A toplevel syntactic entity containing Closure-style externs definitions.
|
||||
*/
|
||||
class Externs extends TopLevel { Externs() { isExterns() } }
|
||||
class Externs extends TopLevel {
|
||||
Externs() { isExterns() }
|
||||
}
|
||||
|
||||
/** A program element that is either an expression or a statement. */
|
||||
class ExprOrStmt extends @exprorstmt, ControlFlowNode, ASTNode { }
|
||||
|
||||
@@ -284,13 +284,17 @@ class BasicBlock extends @cfg_node, Locatable {
|
||||
* An unreachable basic block, that is, a basic block
|
||||
* whose first node is unreachable.
|
||||
*/
|
||||
class UnreachableBlock extends BasicBlock { UnreachableBlock() { getFirstNode().isUnreachable() } }
|
||||
class UnreachableBlock extends BasicBlock {
|
||||
UnreachableBlock() { getFirstNode().isUnreachable() }
|
||||
}
|
||||
|
||||
/**
|
||||
* An entry basic block, that is, a basic block
|
||||
* whose first node is the entry node of a statement container.
|
||||
*/
|
||||
class EntryBasicBlock extends BasicBlock { EntryBasicBlock() { entryBB(this) } }
|
||||
class EntryBasicBlock extends BasicBlock {
|
||||
EntryBasicBlock() { entryBB(this) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A basic block that is reachable from an entry basic block.
|
||||
|
||||
@@ -227,9 +227,7 @@ class ClassExpr extends @classexpr, ClassDefinition, Expr {
|
||||
result = min(ClassInitializedMember m |
|
||||
m = getClassInitializedMember()
|
||||
|
|
||||
m
|
||||
order by
|
||||
m.getIndex()
|
||||
m order by m.getIndex()
|
||||
)
|
||||
else result = this
|
||||
}
|
||||
@@ -287,7 +285,9 @@ class SuperPropAccess extends PropAccess {
|
||||
*
|
||||
* See also ECMAScript 2015 Language Specification, Chapter 12.3.8.
|
||||
*/
|
||||
class NewTargetExpr extends @newtargetexpr, Expr { override predicate isImpure() { none() } }
|
||||
class NewTargetExpr extends @newtargetexpr, Expr {
|
||||
override predicate isImpure() { none() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A scope induced by a named class expression or class expression with type parameters.
|
||||
@@ -432,12 +432,16 @@ class MemberDeclaration extends @property, Documentable {
|
||||
/**
|
||||
* A concrete member of a class, that is, a non-abstract, non-ambient field or method with a body.
|
||||
*/
|
||||
class MemberDefinition extends MemberDeclaration { MemberDefinition() { isConcrete() } }
|
||||
class MemberDefinition extends MemberDeclaration {
|
||||
MemberDefinition() { isConcrete() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A member signature declared in a class or interface, that is, an abstract or ambient field or method without a function body.
|
||||
*/
|
||||
class MemberSignature extends MemberDeclaration { MemberSignature() { isSignature() } }
|
||||
class MemberSignature extends MemberDeclaration {
|
||||
MemberSignature() { isSignature() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A method declaration in a class or interface, either a concrete definition or a signature without a body.
|
||||
|
||||
@@ -38,7 +38,9 @@ module Closure {
|
||||
Expr getAnArgument() { result = getArgument(_) }
|
||||
}
|
||||
|
||||
abstract private class GoogNamespaceRef extends ExprOrStmt { abstract string getNamespaceId(); }
|
||||
abstract private class GoogNamespaceRef extends ExprOrStmt {
|
||||
abstract string getNamespaceId();
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to `goog.provide`.
|
||||
|
||||
@@ -123,4 +123,6 @@ module SyntacticConstants {
|
||||
/**
|
||||
* An expression that evaluates to a constant string.
|
||||
*/
|
||||
class ConstantString extends ConstantExpr { ConstantString() { exists(getStringValue()) } }
|
||||
class ConstantString extends ConstantExpr {
|
||||
ConstantString() { exists(getStringValue()) }
|
||||
}
|
||||
|
||||
@@ -193,9 +193,7 @@ class VarDef extends ControlFlowNode {
|
||||
* such as `for-in` loops, parameters or destructuring assignments.
|
||||
*/
|
||||
AST::ValueNode getSource() {
|
||||
exists(Expr target |
|
||||
not target instanceof DestructuringPattern and defn(this, target, result)
|
||||
)
|
||||
exists(Expr target | not target instanceof DestructuringPattern and defn(this, target, result))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,9 +201,7 @@ class VarDef extends ControlFlowNode {
|
||||
* right hand side of a destructuring assignment.
|
||||
*/
|
||||
AST::ValueNode getDestructuringSource() {
|
||||
exists(Expr target |
|
||||
target instanceof DestructuringPattern and defn(this, target, result)
|
||||
)
|
||||
exists(Expr target | target instanceof DestructuringPattern and defn(this, target, result))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -199,8 +199,7 @@ module Internal {
|
||||
Expr target;
|
||||
|
||||
UndefinedNullCrashUse() {
|
||||
exists (Expr thrower |
|
||||
stripNotsAndParens(this, _) = thrower |
|
||||
exists(Expr thrower | stripNotsAndParens(this, _) = thrower |
|
||||
thrower.(InvokeExpr).getCallee().getUnderlyingValue() = target
|
||||
or
|
||||
thrower.(PropAccess).getBase().getUnderlyingValue() = target
|
||||
@@ -224,7 +223,8 @@ module Internal {
|
||||
Expr target;
|
||||
|
||||
NonFunctionCallCrashUse() {
|
||||
stripNotsAndParens(this, _).(InvokeExpr).getCallee().getUnderlyingValue() = target }
|
||||
stripNotsAndParens(this, _).(InvokeExpr).getCallee().getUnderlyingValue() = target
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the subexpression that will cause an exception to be thrown if it is not a `function`.
|
||||
@@ -276,9 +276,7 @@ module Internal {
|
||||
guardVar = stripNotsAndParens(this.asExpr(), polarity) and
|
||||
guardVar.getVariable() = useVar.getVariable()
|
||||
|
|
||||
getAGuardedExpr(this.asExpr())
|
||||
.(UndefinedNullCrashUse)
|
||||
.getVulnerableSubexpression() = useVar and
|
||||
getAGuardedExpr(this.asExpr()).(UndefinedNullCrashUse).getVulnerableSubexpression() = useVar and
|
||||
// exclude types whose truthiness depend on the value
|
||||
not isStringOrNumOrBool(guardVar.analyze().getAType())
|
||||
)
|
||||
@@ -308,9 +306,7 @@ module Internal {
|
||||
test.getOperand() = guardVar and
|
||||
guardVar.getVariable() = useVar.getVariable()
|
||||
|
|
||||
getAGuardedExpr(guard)
|
||||
.(UndefinedNullCrashUse)
|
||||
.getVulnerableSubexpression() = useVar
|
||||
getAGuardedExpr(guard).(UndefinedNullCrashUse).getVulnerableSubexpression() = useVar
|
||||
)
|
||||
}
|
||||
|
||||
@@ -376,9 +372,7 @@ module Internal {
|
||||
test.getOperand() = guardVar and
|
||||
guardVar.getVariable() = useVar.getVariable()
|
||||
|
|
||||
getAGuardedExpr(guard)
|
||||
.(NonFunctionCallCrashUse)
|
||||
.getVulnerableSubexpression() = useVar
|
||||
getAGuardedExpr(guard).(NonFunctionCallCrashUse).getVulnerableSubexpression() = useVar
|
||||
) and
|
||||
test.getTag() = "function"
|
||||
}
|
||||
|
||||
@@ -6,9 +6,7 @@ import javascript
|
||||
* An ECMAScript 2015 module.
|
||||
*/
|
||||
class ES2015Module extends Module {
|
||||
ES2015Module() {
|
||||
isES2015Module(this)
|
||||
}
|
||||
ES2015Module() { isES2015Module(this) }
|
||||
|
||||
override ModuleScope getScope() { result.getScopeElement() = this }
|
||||
|
||||
|
||||
@@ -173,7 +173,9 @@ class Identifier extends @identifier, ExprOrType {
|
||||
* A statement or property label, that is, an identifier that
|
||||
* does not refer to a variable.
|
||||
*/
|
||||
class Label extends @label, Identifier, Expr { override predicate isImpure() { none() } }
|
||||
class Label extends @label, Identifier, Expr {
|
||||
override predicate isImpure() { none() }
|
||||
}
|
||||
|
||||
/** A literal. */
|
||||
class Literal extends @literal, Expr {
|
||||
@@ -445,7 +447,9 @@ class PropertySetter extends PropertyAccessor, @property_setter { }
|
||||
* `{ x: 42, ...others }`. The value of a spread property is always
|
||||
* a `SpreadElement`.
|
||||
*/
|
||||
class SpreadProperty extends Property { SpreadProperty() { not exists(getNameExpr()) } }
|
||||
class SpreadProperty extends Property {
|
||||
SpreadProperty() { not exists(getNameExpr()) }
|
||||
}
|
||||
|
||||
/** A function expression. */
|
||||
class FunctionExpr extends @functionexpr, Expr, Function {
|
||||
@@ -744,13 +748,19 @@ class NegExpr extends @negexpr, UnaryExpr {
|
||||
}
|
||||
|
||||
/** A unary plus expression. */
|
||||
class PlusExpr extends @plusexpr, UnaryExpr { override string getOperator() { result = "+" } }
|
||||
class PlusExpr extends @plusexpr, UnaryExpr {
|
||||
override string getOperator() { result = "+" }
|
||||
}
|
||||
|
||||
/** A logical negation expression. */
|
||||
class LogNotExpr extends @lognotexpr, UnaryExpr { override string getOperator() { result = "!" } }
|
||||
class LogNotExpr extends @lognotexpr, UnaryExpr {
|
||||
override string getOperator() { result = "!" }
|
||||
}
|
||||
|
||||
/** A bitwise negation expression. */
|
||||
class BitNotExpr extends @bitnotexpr, UnaryExpr { override string getOperator() { result = "~" } }
|
||||
class BitNotExpr extends @bitnotexpr, UnaryExpr {
|
||||
override string getOperator() { result = "~" }
|
||||
}
|
||||
|
||||
/** A `typeof` expression. */
|
||||
class TypeofExpr extends @typeofexpr, UnaryExpr {
|
||||
@@ -758,7 +768,9 @@ class TypeofExpr extends @typeofexpr, UnaryExpr {
|
||||
}
|
||||
|
||||
/** A `void` expression. */
|
||||
class VoidExpr extends @voidexpr, UnaryExpr { override string getOperator() { result = "void" } }
|
||||
class VoidExpr extends @voidexpr, UnaryExpr {
|
||||
override string getOperator() { result = "void" }
|
||||
}
|
||||
|
||||
/** A `delete` expression. */
|
||||
class DeleteExpr extends @deleteexpr, UnaryExpr {
|
||||
@@ -839,10 +851,14 @@ class EqualityTest extends @equalitytest, Comparison {
|
||||
}
|
||||
|
||||
/** An equality test using `==`. */
|
||||
class EqExpr extends @eqexpr, EqualityTest { override string getOperator() { result = "==" } }
|
||||
class EqExpr extends @eqexpr, EqualityTest {
|
||||
override string getOperator() { result = "==" }
|
||||
}
|
||||
|
||||
/** An inequality test using `!=`. */
|
||||
class NEqExpr extends @neqexpr, EqualityTest { override string getOperator() { result = "!=" } }
|
||||
class NEqExpr extends @neqexpr, EqualityTest {
|
||||
override string getOperator() { result = "!=" }
|
||||
}
|
||||
|
||||
/** A strict equality test using `===`. */
|
||||
class StrictEqExpr extends @eqqexpr, EqualityTest {
|
||||
@@ -855,22 +871,34 @@ class StrictNEqExpr extends @neqqexpr, EqualityTest {
|
||||
}
|
||||
|
||||
/** A less-than expression. */
|
||||
class LTExpr extends @ltexpr, Comparison { override string getOperator() { result = "<" } }
|
||||
class LTExpr extends @ltexpr, Comparison {
|
||||
override string getOperator() { result = "<" }
|
||||
}
|
||||
|
||||
/** A less-than-or-equal expression. */
|
||||
class LEExpr extends @leexpr, Comparison { override string getOperator() { result = "<=" } }
|
||||
class LEExpr extends @leexpr, Comparison {
|
||||
override string getOperator() { result = "<=" }
|
||||
}
|
||||
|
||||
/** A greater-than expression. */
|
||||
class GTExpr extends @gtexpr, Comparison { override string getOperator() { result = ">" } }
|
||||
class GTExpr extends @gtexpr, Comparison {
|
||||
override string getOperator() { result = ">" }
|
||||
}
|
||||
|
||||
/** A greater-than-or-equal expression. */
|
||||
class GEExpr extends @geexpr, Comparison { override string getOperator() { result = ">=" } }
|
||||
class GEExpr extends @geexpr, Comparison {
|
||||
override string getOperator() { result = ">=" }
|
||||
}
|
||||
|
||||
/** A left-shift expression using `<<`. */
|
||||
class LShiftExpr extends @lshiftexpr, BinaryExpr { override string getOperator() { result = "<<" } }
|
||||
class LShiftExpr extends @lshiftexpr, BinaryExpr {
|
||||
override string getOperator() { result = "<<" }
|
||||
}
|
||||
|
||||
/** A right-shift expression using `>>`. */
|
||||
class RShiftExpr extends @rshiftexpr, BinaryExpr { override string getOperator() { result = ">>" } }
|
||||
class RShiftExpr extends @rshiftexpr, BinaryExpr {
|
||||
override string getOperator() { result = ">>" }
|
||||
}
|
||||
|
||||
/** An unsigned right-shift expression using `>>>`. */
|
||||
class URShiftExpr extends @urshiftexpr, BinaryExpr {
|
||||
@@ -887,31 +915,49 @@ class AddExpr extends @addexpr, BinaryExpr {
|
||||
}
|
||||
|
||||
/** A subtraction expression. */
|
||||
class SubExpr extends @subexpr, BinaryExpr { override string getOperator() { result = "-" } }
|
||||
class SubExpr extends @subexpr, BinaryExpr {
|
||||
override string getOperator() { result = "-" }
|
||||
}
|
||||
|
||||
/** A multiplication expression. */
|
||||
class MulExpr extends @mulexpr, BinaryExpr { override string getOperator() { result = "*" } }
|
||||
class MulExpr extends @mulexpr, BinaryExpr {
|
||||
override string getOperator() { result = "*" }
|
||||
}
|
||||
|
||||
/** A division expression. */
|
||||
class DivExpr extends @divexpr, BinaryExpr { override string getOperator() { result = "/" } }
|
||||
class DivExpr extends @divexpr, BinaryExpr {
|
||||
override string getOperator() { result = "/" }
|
||||
}
|
||||
|
||||
/** A modulo expression. */
|
||||
class ModExpr extends @modexpr, BinaryExpr { override string getOperator() { result = "%" } }
|
||||
class ModExpr extends @modexpr, BinaryExpr {
|
||||
override string getOperator() { result = "%" }
|
||||
}
|
||||
|
||||
/** An exponentiation expression. */
|
||||
class ExpExpr extends @expexpr, BinaryExpr { override string getOperator() { result = "**" } }
|
||||
class ExpExpr extends @expexpr, BinaryExpr {
|
||||
override string getOperator() { result = "**" }
|
||||
}
|
||||
|
||||
/** A bitwise 'or' expression. */
|
||||
class BitOrExpr extends @bitorexpr, BinaryExpr { override string getOperator() { result = "|" } }
|
||||
class BitOrExpr extends @bitorexpr, BinaryExpr {
|
||||
override string getOperator() { result = "|" }
|
||||
}
|
||||
|
||||
/** An exclusive 'or' expression. */
|
||||
class XOrExpr extends @xorexpr, BinaryExpr { override string getOperator() { result = "^" } }
|
||||
class XOrExpr extends @xorexpr, BinaryExpr {
|
||||
override string getOperator() { result = "^" }
|
||||
}
|
||||
|
||||
/** A bitwise 'and' expression. */
|
||||
class BitAndExpr extends @bitandexpr, BinaryExpr { override string getOperator() { result = "&" } }
|
||||
class BitAndExpr extends @bitandexpr, BinaryExpr {
|
||||
override string getOperator() { result = "&" }
|
||||
}
|
||||
|
||||
/** An `in` expression. */
|
||||
class InExpr extends @inexpr, BinaryExpr { override string getOperator() { result = "in" } }
|
||||
class InExpr extends @inexpr, BinaryExpr {
|
||||
override string getOperator() { result = "in" }
|
||||
}
|
||||
|
||||
/** An `instanceof` expression. */
|
||||
class InstanceofExpr extends @instanceofexpr, BinaryExpr {
|
||||
@@ -1359,7 +1405,9 @@ class AwaitExpr extends @awaitexpr, Expr {
|
||||
* to the generator by the `next` method that most recently resumed execution
|
||||
* of the generator.
|
||||
*/
|
||||
class FunctionSentExpr extends @functionsentexpr, Expr { override predicate isImpure() { none() } }
|
||||
class FunctionSentExpr extends @functionsentexpr, Expr {
|
||||
override predicate isImpure() { none() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A decorator applied to a class, property or member definition.
|
||||
@@ -1468,7 +1516,9 @@ private class LiteralDynamicImportPath extends PathExprInModule, ConstantString
|
||||
/**
|
||||
* A call or member access that evaluates to `undefined` if its base operand evaluates to `undefined` or `null`.
|
||||
*/
|
||||
class OptionalUse extends Expr, @optionalchainable { OptionalUse() { isOptionalChaining(this) } }
|
||||
class OptionalUse extends Expr, @optionalchainable {
|
||||
OptionalUse() { isOptionalChaining(this) }
|
||||
}
|
||||
|
||||
private class ChainElem extends Expr, @optionalchainable {
|
||||
/**
|
||||
|
||||
@@ -217,7 +217,9 @@ class ExternalFunction extends ExternalEntity, Function {
|
||||
/**
|
||||
* A `@constructor` tag.
|
||||
*/
|
||||
class ConstructorTag extends JSDocTag { ConstructorTag() { getTitle() = "constructor" } }
|
||||
class ConstructorTag extends JSDocTag {
|
||||
ConstructorTag() { getTitle() = "constructor" }
|
||||
}
|
||||
|
||||
/** A JSDoc tag that refers to a named type. */
|
||||
abstract private class NamedTypeReferent extends JSDocTag {
|
||||
@@ -256,17 +258,23 @@ private ExternalType sourceDecl(JSDocTypeExpr tp) {
|
||||
/**
|
||||
* An `@implements` tag.
|
||||
*/
|
||||
class ImplementsTag extends NamedTypeReferent { ImplementsTag() { getTitle() = "implements" } }
|
||||
class ImplementsTag extends NamedTypeReferent {
|
||||
ImplementsTag() { getTitle() = "implements" }
|
||||
}
|
||||
|
||||
/**
|
||||
* An `@extends` tag.
|
||||
*/
|
||||
class ExtendsTag extends NamedTypeReferent { ExtendsTag() { getTitle() = "extends" } }
|
||||
class ExtendsTag extends NamedTypeReferent {
|
||||
ExtendsTag() { getTitle() = "extends" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A `@type` tag.
|
||||
*/
|
||||
class ExternalTypeTag extends NamedTypeReferent { ExternalTypeTag() { getTitle() = "type" } }
|
||||
class ExternalTypeTag extends NamedTypeReferent {
|
||||
ExternalTypeTag() { getTitle() = "type" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A constructor or interface function defined in an externs file.
|
||||
@@ -306,14 +314,20 @@ class ExternalInterface extends ExternalType {
|
||||
/**
|
||||
* Externs definition for the Function object.
|
||||
*/
|
||||
class FunctionExternal extends ExternalConstructor { FunctionExternal() { getName() = "Function" } }
|
||||
class FunctionExternal extends ExternalConstructor {
|
||||
FunctionExternal() { getName() = "Function" }
|
||||
}
|
||||
|
||||
/**
|
||||
* Externs definition for the Object object.
|
||||
*/
|
||||
class ObjectExternal extends ExternalConstructor { ObjectExternal() { getName() = "Object" } }
|
||||
class ObjectExternal extends ExternalConstructor {
|
||||
ObjectExternal() { getName() = "Object" }
|
||||
}
|
||||
|
||||
/**
|
||||
* Externs definition for the Array object.
|
||||
*/
|
||||
class ArrayExternal extends ExternalConstructor { ArrayExternal() { getName() = "Array" } }
|
||||
class ArrayExternal extends ExternalConstructor {
|
||||
ArrayExternal() { getName() = "Array" }
|
||||
}
|
||||
|
||||
@@ -186,9 +186,7 @@ class Folder extends Container, @folder {
|
||||
result = min(int p, string ext |
|
||||
p = getFileExtensionPriority(ext)
|
||||
|
|
||||
getFile(stem, ext)
|
||||
order by
|
||||
p
|
||||
getFile(stem, ext) order by p
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@ module HTML {
|
||||
/**
|
||||
* An HTML file.
|
||||
*/
|
||||
class HtmlFile extends File { HtmlFile() { getFileType().isHtml() } }
|
||||
class HtmlFile extends File {
|
||||
HtmlFile() { getFileType().isHtml() }
|
||||
}
|
||||
|
||||
/**
|
||||
* An HTML element like `<a href="semmle.com">Semmle</a>`.
|
||||
@@ -115,7 +117,9 @@ module HTML {
|
||||
/**
|
||||
* An HTML `<html>` element.
|
||||
*/
|
||||
class DocumentElement extends Element { DocumentElement() { getName() = "html" } }
|
||||
class DocumentElement extends Element {
|
||||
DocumentElement() { getName() = "html" }
|
||||
}
|
||||
|
||||
/**
|
||||
* An HTML `<script>` element.
|
||||
@@ -164,12 +168,15 @@ module HTML {
|
||||
* Gets the inline script of this script element, if any.
|
||||
*/
|
||||
private InlineScript getInlineScript() {
|
||||
exists(string f, Location l1, int sl1, int sc1, int el1, int ec1, Location l2, int sl2, int sc2, int el2, int ec2 |
|
||||
exists(
|
||||
string f, Location l1, int sl1, int sc1, int el1, int ec1, Location l2, int sl2, int sc2,
|
||||
int el2, int ec2
|
||||
|
|
||||
l1 = getLocation() and
|
||||
l2 = result.getLocation() and
|
||||
l1.hasLocationInfo(f, sl1, sc1, el1, ec1) and
|
||||
l2.hasLocationInfo(f, sl2, sc2, el2, ec2)
|
||||
|
|
||||
|
|
||||
(
|
||||
sl1 = sl2 and sc1 < sc2
|
||||
or
|
||||
@@ -192,7 +199,6 @@ module HTML {
|
||||
result = getInlineScript() or
|
||||
result = resolveSource()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,4 +112,6 @@ class MainModulePath extends PathExpr, @json_string {
|
||||
}
|
||||
}
|
||||
|
||||
module MainModulePath { MainModulePath of(PackageJSON pkg) { result.getPackageJSON() = pkg } }
|
||||
module MainModulePath {
|
||||
MainModulePath of(PackageJSON pkg) { result.getPackageJSON() = pkg }
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ module RangeAnalysis {
|
||||
isRelevant(node) and
|
||||
strictcount(node.getAPredecessor()) = 1 and
|
||||
// exclude parameters with default values
|
||||
not exists (Parameter p |
|
||||
not exists(Parameter p |
|
||||
DataFlow::parameterNode(p) = node and
|
||||
exists(p.getDefault())
|
||||
)
|
||||
|
||||
@@ -158,10 +158,14 @@ class RegExpSequence extends RegExpTerm, @regexp_seq {
|
||||
}
|
||||
|
||||
/** A caret assertion `^` matching the beginning of a line. */
|
||||
class RegExpCaret extends RegExpTerm, @regexp_caret { override predicate isNullable() { any() } }
|
||||
class RegExpCaret extends RegExpTerm, @regexp_caret {
|
||||
override predicate isNullable() { any() }
|
||||
}
|
||||
|
||||
/** A dollar assertion `$` matching the end of a line. */
|
||||
class RegExpDollar extends RegExpTerm, @regexp_dollar { override predicate isNullable() { any() } }
|
||||
class RegExpDollar extends RegExpTerm, @regexp_dollar {
|
||||
override predicate isNullable() { any() }
|
||||
}
|
||||
|
||||
/** A word boundary assertion `\b`. */
|
||||
class RegExpWordBoundary extends RegExpTerm, @regexp_wordboundary {
|
||||
@@ -210,7 +214,9 @@ class RegExpPlus extends RegExpQuantifier, @regexp_plus {
|
||||
}
|
||||
|
||||
/** An optional term, that is, a term of the form `...?`. */
|
||||
class RegExpOpt extends RegExpQuantifier, @regexp_opt { override predicate isNullable() { any() } }
|
||||
class RegExpOpt extends RegExpQuantifier, @regexp_opt {
|
||||
override predicate isNullable() { any() }
|
||||
}
|
||||
|
||||
/** A range-quantified term, that is, a term of the form `...{m,n}`. */
|
||||
class RegExpRange extends RegExpQuantifier, @regexp_range {
|
||||
@@ -227,7 +233,9 @@ class RegExpRange extends RegExpQuantifier, @regexp_range {
|
||||
}
|
||||
|
||||
/** A dot regular expression `.`. */
|
||||
class RegExpDot extends RegExpTerm, @regexp_dot { override predicate isNullable() { none() } }
|
||||
class RegExpDot extends RegExpTerm, @regexp_dot {
|
||||
override predicate isNullable() { none() }
|
||||
}
|
||||
|
||||
/** A grouped regular expression, that is, a term of the form `(...)` or `(?:...)` */
|
||||
class RegExpGroup extends RegExpTerm, @regexp_group {
|
||||
|
||||
@@ -167,7 +167,9 @@ class StrictModeDecl extends KnownDirective {
|
||||
}
|
||||
|
||||
/** An asm.js directive. */
|
||||
class ASMJSDirective extends KnownDirective { ASMJSDirective() { getDirectiveText() = "use asm" } }
|
||||
class ASMJSDirective extends KnownDirective {
|
||||
ASMJSDirective() { getDirectiveText() = "use asm" }
|
||||
}
|
||||
|
||||
/** A Babel directive. */
|
||||
class BabelDirective extends KnownDirective {
|
||||
@@ -205,7 +207,9 @@ class SystemJSDepsDirective extends KnownDirective {
|
||||
}
|
||||
|
||||
/** A `bundle` directive. */
|
||||
class BundleDirective extends KnownDirective { BundleDirective() { getDirectiveText() = "bundle" } }
|
||||
class BundleDirective extends KnownDirective {
|
||||
BundleDirective() { getDirectiveText() = "bundle" }
|
||||
}
|
||||
|
||||
/** An `if` statement. */
|
||||
class IfStmt extends @ifstmt, ControlStmt {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Provides classes and predicates for reasoning about string-manipulating expressions.
|
||||
*/
|
||||
|
||||
import javascript
|
||||
|
||||
module StringOps {
|
||||
|
||||
/**
|
||||
* A expression that is equivalent to `A.startsWith(B)` or `!A.startsWith(B)`.
|
||||
*/
|
||||
@@ -37,13 +37,9 @@ module StringOps {
|
||||
getNumArgument() = 1
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = getReceiver()
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = getReceiver() }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = getArgument(0)
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = getArgument(0) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,6 +47,7 @@ module StringOps {
|
||||
*/
|
||||
private class StartsWith_IndexOfEquals extends StartsWith, DataFlow::ValueNode {
|
||||
override EqualityTest astNode;
|
||||
|
||||
DataFlow::MethodCallNode indexOf;
|
||||
|
||||
StartsWith_IndexOfEquals() {
|
||||
@@ -60,17 +57,11 @@ module StringOps {
|
||||
astNode.getAnOperand().getIntValue() = 0
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = indexOf.getReceiver()
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = indexOf.getReceiver() }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = indexOf.getArgument(0)
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = indexOf.getArgument(0) }
|
||||
|
||||
override boolean getPolarity() {
|
||||
result = astNode.getPolarity()
|
||||
}
|
||||
override boolean getPolarity() { result = astNode.getPolarity() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,17 +76,11 @@ module StringOps {
|
||||
this.flowsToExpr(any(ConditionGuardNode guard).getTest()) // check for boolean coercion
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = getReceiver()
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = getReceiver() }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = getArgument(0)
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = getArgument(0) }
|
||||
|
||||
override boolean getPolarity() {
|
||||
result = false
|
||||
}
|
||||
override boolean getPolarity() { result = false }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,19 +89,15 @@ module StringOps {
|
||||
private class StartsWith_Library extends StartsWith, DataFlow::CallNode {
|
||||
StartsWith_Library() {
|
||||
getNumArgument() = 2 and
|
||||
exists (DataFlow::SourceNode callee | this = callee.getACall() |
|
||||
exists(DataFlow::SourceNode callee | this = callee.getACall() |
|
||||
callee = LodashUnderscore::member("startsWith") or
|
||||
callee = DataFlow::moduleMember("ramda", "startsWith")
|
||||
)
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = getArgument(0)
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = getArgument(0) }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = getArgument(1)
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = getArgument(1) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,7 +105,9 @@ module StringOps {
|
||||
*/
|
||||
private class StartsWith_FirstCharacter extends StartsWith, DataFlow::ValueNode {
|
||||
override EqualityTest astNode;
|
||||
|
||||
DataFlow::PropRead read;
|
||||
|
||||
Expr constant;
|
||||
|
||||
StartsWith_FirstCharacter() {
|
||||
@@ -134,17 +117,11 @@ module StringOps {
|
||||
astNode.getAnOperand() = constant
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = read.getBase()
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = read.getBase() }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = constant.flow()
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = constant.flow() }
|
||||
|
||||
override boolean getPolarity() {
|
||||
result = astNode.getPolarity()
|
||||
}
|
||||
override boolean getPolarity() { result = astNode.getPolarity() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +129,9 @@ module StringOps {
|
||||
*/
|
||||
private class StartsWith_Substring extends StartsWith, DataFlow::ValueNode {
|
||||
override EqualityTest astNode;
|
||||
|
||||
DataFlow::MethodCallNode call;
|
||||
|
||||
DataFlow::Node substring;
|
||||
|
||||
StartsWith_Substring() {
|
||||
@@ -166,17 +145,11 @@ module StringOps {
|
||||
)
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = call.getReceiver()
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = call.getReceiver() }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = substring
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = substring }
|
||||
|
||||
override boolean getPolarity() {
|
||||
result = astNode.getPolarity()
|
||||
}
|
||||
override boolean getPolarity() { result = astNode.getPolarity() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,13 +182,9 @@ module StringOps {
|
||||
getNumArgument() = 1
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = getReceiver()
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = getReceiver() }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = getArgument(0)
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = getArgument(0) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,19 +192,15 @@ module StringOps {
|
||||
*/
|
||||
private class Includes_Library extends Includes, DataFlow::CallNode {
|
||||
Includes_Library() {
|
||||
exists (string name |
|
||||
exists(string name |
|
||||
this = LodashUnderscore::member(name).getACall() and
|
||||
(name = "includes" or name = "include" or name = "contains")
|
||||
)
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = getArgument(0)
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = getArgument(0) }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = getArgument(1)
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = getArgument(1) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,10 +208,11 @@ module StringOps {
|
||||
*/
|
||||
private class Includes_IndexOfEquals extends Includes, DataFlow::ValueNode {
|
||||
MethodCallExpr indexOf;
|
||||
|
||||
override EqualityTest astNode;
|
||||
|
||||
Includes_IndexOfEquals() {
|
||||
exists (Expr index | astNode.hasOperands(indexOf, index) |
|
||||
exists(Expr index | astNode.hasOperands(indexOf, index) |
|
||||
// one operand is of the form `whitelist.indexOf(x)`
|
||||
indexOf.getMethodName() = "indexOf" and
|
||||
// and the other one is -1
|
||||
@@ -254,17 +220,11 @@ module StringOps {
|
||||
)
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = indexOf.getReceiver().flow()
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = indexOf.getReceiver().flow() }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = indexOf.getArgument(0).flow()
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = indexOf.getArgument(0).flow() }
|
||||
|
||||
override boolean getPolarity() {
|
||||
result = astNode.getPolarity().booleanNot()
|
||||
}
|
||||
override boolean getPolarity() { result = astNode.getPolarity().booleanNot() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,15 +232,18 @@ module StringOps {
|
||||
*/
|
||||
private class Includes_IndexOfRelational extends Includes, DataFlow::ValueNode {
|
||||
MethodCallExpr indexOf;
|
||||
|
||||
override RelationalComparison astNode;
|
||||
|
||||
boolean polarity;
|
||||
|
||||
Includes_IndexOfRelational() {
|
||||
exists (Expr lesser, Expr greater |
|
||||
exists(Expr lesser, Expr greater |
|
||||
astNode.getLesserOperand() = lesser and
|
||||
astNode.getGreaterOperand() = greater and
|
||||
indexOf.getMethodName() = "indexOf" and
|
||||
indexOf.getNumArgument() = 1 |
|
||||
indexOf.getNumArgument() = 1
|
||||
|
|
||||
polarity = true and
|
||||
greater = indexOf and
|
||||
(
|
||||
@@ -299,17 +262,11 @@ module StringOps {
|
||||
)
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = indexOf.getReceiver().flow()
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = indexOf.getReceiver().flow() }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = indexOf.getArgument(0).flow()
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = indexOf.getArgument(0).flow() }
|
||||
|
||||
override boolean getPolarity() {
|
||||
result = polarity
|
||||
}
|
||||
override boolean getPolarity() { result = polarity }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -317,6 +274,7 @@ module StringOps {
|
||||
*/
|
||||
private class Includes_IndexOfBitwise extends Includes, DataFlow::ValueNode {
|
||||
MethodCallExpr indexOf;
|
||||
|
||||
override BitNotExpr astNode;
|
||||
|
||||
Includes_IndexOfBitwise() {
|
||||
@@ -324,13 +282,9 @@ module StringOps {
|
||||
indexOf.getMethodName() = "indexOf"
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = indexOf.getReceiver().flow()
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = indexOf.getReceiver().flow() }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = indexOf.getArgument(0).flow()
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = indexOf.getArgument(0).flow() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -365,13 +319,9 @@ module StringOps {
|
||||
getNumArgument() = 1
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = getReceiver()
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = getReceiver() }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = getArgument(0)
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = getArgument(0) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -380,18 +330,14 @@ module StringOps {
|
||||
private class EndsWith_Library extends StartsWith, DataFlow::CallNode {
|
||||
EndsWith_Library() {
|
||||
getNumArgument() = 2 and
|
||||
exists (DataFlow::SourceNode callee | this = callee.getACall() |
|
||||
exists(DataFlow::SourceNode callee | this = callee.getACall() |
|
||||
callee = LodashUnderscore::member("endsWith") or
|
||||
callee = DataFlow::moduleMember("ramda", "endsWith")
|
||||
)
|
||||
}
|
||||
|
||||
override DataFlow::Node getBaseString() {
|
||||
result = getArgument(0)
|
||||
}
|
||||
override DataFlow::Node getBaseString() { result = getArgument(0) }
|
||||
|
||||
override DataFlow::Node getSubstring() {
|
||||
result = getArgument(1)
|
||||
}
|
||||
override DataFlow::Node getSubstring() { result = getArgument(1) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -652,7 +652,9 @@ class PredefinedTypeExpr extends KeywordTypeExpr {
|
||||
/**
|
||||
* A use of the `this` type.
|
||||
*/
|
||||
class ThisTypeExpr extends KeywordTypeExpr { ThisTypeExpr() { isThis() } }
|
||||
class ThisTypeExpr extends KeywordTypeExpr {
|
||||
ThisTypeExpr() { isThis() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A possibly qualified name that is used as part of a type, such as `Date` or `http.ServerRequest`.
|
||||
@@ -1472,7 +1474,9 @@ class MappedTypeScope extends @mappedtypescope, Scope {
|
||||
* Initializers of enum members are resolved in this scope since they can reference
|
||||
* previously-defined enum members by their unqualified name.
|
||||
*/
|
||||
class EnumScope extends @enumscope, Scope { override string toString() { result = "enum scope" } }
|
||||
class EnumScope extends @enumscope, Scope {
|
||||
override string toString() { result = "enum scope" }
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope induced by a declaration of form `declare module "X" {...}`.
|
||||
@@ -1566,9 +1570,7 @@ class ReferenceTypesImport extends ReferenceImport {
|
||||
result = min(Folder nodeModules, int distance |
|
||||
findNodeModulesFolder(getFile().getParentContainer(), nodeModules, distance)
|
||||
|
|
||||
nodeModules.getFolder("@types").getFolder(value).getFile("index.d.ts")
|
||||
order by
|
||||
distance
|
||||
nodeModules.getFolder("@types").getFolder(value).getFile("index.d.ts") order by distance
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,10 @@ string describeExpression(Expr e) {
|
||||
(
|
||||
if e instanceof NewExpr
|
||||
then prefix = "constructor call"
|
||||
else if e instanceof MethodCallExpr then prefix = "method call" else prefix = "call"
|
||||
else
|
||||
if e instanceof MethodCallExpr
|
||||
then prefix = "method call"
|
||||
else prefix = "call"
|
||||
) and
|
||||
(
|
||||
if exists(e.(InvokeExpr).getCalleeName())
|
||||
@@ -57,5 +60,8 @@ string describeExpression(Expr e) {
|
||||
else
|
||||
if e instanceof PropAccess and exists(e.(PropAccess).getPropertyName())
|
||||
then result = "use of property '" + e.(PropAccess).getPropertyName() + "'"
|
||||
else if e instanceof LogNotExpr then result = "negation" else result = "expression"
|
||||
else
|
||||
if e instanceof LogNotExpr
|
||||
then result = "negation"
|
||||
else result = "expression"
|
||||
}
|
||||
|
||||
@@ -47,7 +47,9 @@ class GlobalScope extends Scope, @globalscope {
|
||||
}
|
||||
|
||||
/** A local scope, that is, a scope that is not the global scope. */
|
||||
class LocalScope extends Scope { LocalScope() { not this instanceof GlobalScope } }
|
||||
class LocalScope extends Scope {
|
||||
LocalScope() { not this instanceof GlobalScope }
|
||||
}
|
||||
|
||||
/**
|
||||
* A scope induced by a Node.js or ES2015 module
|
||||
@@ -263,7 +265,9 @@ class ExportVarAccess extends VarAccess, @export_varaccess {
|
||||
}
|
||||
|
||||
/** A global variable. */
|
||||
class GlobalVariable extends Variable { GlobalVariable() { isGlobal() } }
|
||||
class GlobalVariable extends Variable {
|
||||
GlobalVariable() { isGlobal() }
|
||||
}
|
||||
|
||||
/** A local variable or a parameter. */
|
||||
class LocalVariable extends Variable {
|
||||
@@ -290,10 +294,14 @@ class LocalVariable extends Variable {
|
||||
}
|
||||
|
||||
/** A local variable that is not captured. */
|
||||
class PurelyLocalVariable extends LocalVariable { PurelyLocalVariable() { not isCaptured() } }
|
||||
class PurelyLocalVariable extends LocalVariable {
|
||||
PurelyLocalVariable() { not isCaptured() }
|
||||
}
|
||||
|
||||
/** An identifier that refers to a global variable. */
|
||||
class GlobalVarAccess extends VarAccess { GlobalVarAccess() { getVariable().isGlobal() } }
|
||||
class GlobalVarAccess extends VarAccess {
|
||||
GlobalVarAccess() { getVariable().isGlobal() }
|
||||
}
|
||||
|
||||
/**
|
||||
* A binding pattern, i.e., either an identifier or a destructuring pattern.
|
||||
@@ -357,7 +365,9 @@ class VarDecl extends @vardecl, VarRef, LexicalDecl {
|
||||
}
|
||||
|
||||
/** An identifier that declares a global variable. */
|
||||
class GlobalVarDecl extends VarDecl { GlobalVarDecl() { getVariable() instanceof GlobalVariable } }
|
||||
class GlobalVarDecl extends VarDecl {
|
||||
GlobalVarDecl() { getVariable() instanceof GlobalVariable }
|
||||
}
|
||||
|
||||
/** An array pattern. */
|
||||
class ArrayPattern extends DestructuringPattern, @arraypattern {
|
||||
|
||||
@@ -87,9 +87,7 @@ class XMLParent extends @xmlparent {
|
||||
result = concat(string chars, int pos |
|
||||
xmlChars(_, chars, this, pos, _, _)
|
||||
|
|
||||
chars, " "
|
||||
order by
|
||||
pos
|
||||
chars, " " order by pos
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -166,17 +166,23 @@ class YAMLBool extends YAMLScalar {
|
||||
/**
|
||||
* A YAML scalar representing the null value.
|
||||
*/
|
||||
class YAMLNull extends YAMLScalar { YAMLNull() { hasStandardTypeTag("null") } }
|
||||
class YAMLNull extends YAMLScalar {
|
||||
YAMLNull() { hasStandardTypeTag("null") }
|
||||
}
|
||||
|
||||
/**
|
||||
* A YAML scalar representing a string value.
|
||||
*/
|
||||
class YAMLString extends YAMLScalar { YAMLString() { hasStandardTypeTag("str") } }
|
||||
class YAMLString extends YAMLScalar {
|
||||
YAMLString() { hasStandardTypeTag("str") }
|
||||
}
|
||||
|
||||
/**
|
||||
* A YAML scalar representing a merge key.
|
||||
*/
|
||||
class YAMLMergeKey extends YAMLScalar { YAMLMergeKey() { hasStandardTypeTag("merge") } }
|
||||
class YAMLMergeKey extends YAMLScalar {
|
||||
YAMLMergeKey() { hasStandardTypeTag("merge") }
|
||||
}
|
||||
|
||||
/**
|
||||
* A YAML scalar representing an `!include` directive.
|
||||
@@ -286,7 +292,9 @@ class YAMLAliasNode extends YAMLNode, @yaml_alias_node {
|
||||
/**
|
||||
* A YAML document.
|
||||
*/
|
||||
class YAMLDocument extends YAMLNode { YAMLDocument() { not exists(getParentNode()) } }
|
||||
class YAMLDocument extends YAMLNode {
|
||||
YAMLDocument() { not exists(getParentNode()) }
|
||||
}
|
||||
|
||||
/**
|
||||
* An error message produced by the YAML parser while processing a YAML file.
|
||||
|
||||
@@ -909,12 +909,16 @@ class PathNode extends TPathNode {
|
||||
/**
|
||||
* A path node corresponding to a flow source.
|
||||
*/
|
||||
class SourcePathNode extends PathNode { SourcePathNode() { isSource(nd, cfg, _) } }
|
||||
class SourcePathNode extends PathNode {
|
||||
SourcePathNode() { isSource(nd, cfg, _) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A path node corresponding to a flow sink.
|
||||
*/
|
||||
class SinkPathNode extends PathNode { SinkPathNode() { isSink(nd, cfg, _) } }
|
||||
class SinkPathNode extends PathNode {
|
||||
SinkPathNode() { isSink(nd, cfg, _) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the query predicates needed to include a graph in a path-problem query.
|
||||
|
||||
@@ -764,7 +764,9 @@ module DataFlow {
|
||||
/**
|
||||
* A data flow node representing an explicit (that is, non-reflective) function call.
|
||||
*/
|
||||
class ExplicitCallNode extends CallNodeDef, ExplicitInvokeNode { override CallExpr astNode; }
|
||||
class ExplicitCallNode extends CallNodeDef, ExplicitInvokeNode {
|
||||
override CallExpr astNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* A data flow node representing an explicit (that is, non-reflective) method call.
|
||||
@@ -1005,7 +1007,7 @@ module DataFlow {
|
||||
private Node defSourceNode(VarDef def, SsaSourceVariable v) {
|
||||
exists(BindingPattern lhs, VarRef r |
|
||||
lhs = def.getTarget() and r = lhs.getABindingVarRef() and r.getVariable() = v
|
||||
|
|
||||
|
|
||||
// follow one step of the def-use chain if the lhs is a simple variable reference
|
||||
lhs = r and
|
||||
result = TValueNode(defSourceNode(def))
|
||||
|
||||
@@ -218,7 +218,9 @@ class MethodCallNode extends CallNode {
|
||||
}
|
||||
|
||||
/** A data flow node corresponding to a `new` expression. */
|
||||
class NewNode extends InvokeNode { override DataFlow::Impl::NewNodeDef impl; }
|
||||
class NewNode extends InvokeNode {
|
||||
override DataFlow::Impl::NewNodeDef impl;
|
||||
}
|
||||
|
||||
/** A data flow node corresponding to the `this` parameter in a function or `this` at the top-level. */
|
||||
class ThisNode extends DataFlow::Node, DataFlow::SourceNode {
|
||||
@@ -554,7 +556,9 @@ class ClassNode extends DataFlow::SourceNode {
|
||||
*
|
||||
* Does not include methods from superclasses.
|
||||
*/
|
||||
FunctionNode getInstanceMethod(string name) { result = impl.getInstanceMember(name, MemberKind::method()) }
|
||||
FunctionNode getInstanceMethod(string name) {
|
||||
result = impl.getInstanceMember(name, MemberKind::method())
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an instance method declared in this class.
|
||||
@@ -570,7 +574,9 @@ class ClassNode extends DataFlow::SourceNode {
|
||||
*
|
||||
* Does not include members from superclasses.
|
||||
*/
|
||||
FunctionNode getInstanceMember(string name, MemberKind kind) { result = impl.getInstanceMember(name, kind) }
|
||||
FunctionNode getInstanceMember(string name, MemberKind kind) {
|
||||
result = impl.getInstanceMember(name, kind)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an instance method, getter, or setter with the given kind.
|
||||
@@ -743,7 +749,7 @@ module ClassNode {
|
||||
kind = MemberKind::method() and
|
||||
result = getAPrototypeReference().getAPropertySource(name)
|
||||
or
|
||||
exists (PropertyAccessor accessor |
|
||||
exists(PropertyAccessor accessor |
|
||||
accessor = getAnAccessor(kind) and
|
||||
accessor.getName() = name and
|
||||
result = accessor.getInit().flow()
|
||||
@@ -754,15 +760,13 @@ module ClassNode {
|
||||
kind = MemberKind::method() and
|
||||
result = getAPrototypeReference().getAPropertyWrite().getRhs().getALocalSource()
|
||||
or
|
||||
exists (PropertyAccessor accessor |
|
||||
exists(PropertyAccessor accessor |
|
||||
accessor = getAnAccessor(kind) and
|
||||
result = accessor.getInit().flow()
|
||||
)
|
||||
}
|
||||
|
||||
override FunctionNode getStaticMethod(string name) {
|
||||
result = getAPropertySource(name)
|
||||
}
|
||||
override FunctionNode getStaticMethod(string name) { result = getAPropertySource(name) }
|
||||
|
||||
override FunctionNode getAStaticMethod() {
|
||||
result = getAPropertyWrite().getRhs().getALocalSource()
|
||||
|
||||
@@ -487,7 +487,6 @@ module TaintTracking {
|
||||
self.getNumArgument() = 1
|
||||
}
|
||||
|
||||
|
||||
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
|
||||
pred = self.getArgument(0) and
|
||||
succ = this
|
||||
@@ -716,14 +715,16 @@ module TaintTracking {
|
||||
*/
|
||||
class PositiveIndexOfSanitizer extends AdditionalSanitizerGuardNode, DataFlow::ValueNode {
|
||||
MethodCallExpr indexOf;
|
||||
|
||||
override RelationalComparison astNode;
|
||||
|
||||
PositiveIndexOfSanitizer() {
|
||||
indexOf.getMethodName() = "indexOf" and
|
||||
exists (int bound |
|
||||
exists(int bound |
|
||||
astNode.getGreaterOperand() = indexOf and
|
||||
astNode.getLesserOperand().getIntValue() = bound and
|
||||
bound >= 0)
|
||||
bound >= 0
|
||||
)
|
||||
}
|
||||
|
||||
override predicate sanitizes(boolean outcome, Expr e) {
|
||||
|
||||
@@ -288,7 +288,9 @@ predicate receiverPropWrite(Function f, string prop, DataFlow::Node rhs) {
|
||||
/**
|
||||
* A utility class that is equivalent to `boolean` but does not require type joining.
|
||||
*/
|
||||
class Boolean extends boolean { Boolean() { this = true or this = false } }
|
||||
class Boolean extends boolean {
|
||||
Boolean() { this = true or this = false }
|
||||
}
|
||||
|
||||
/**
|
||||
* A summary of an inter-procedural data flow path.
|
||||
|
||||
@@ -785,17 +785,23 @@ private class QUnitJS extends FrameworkLibraryWithGenericURL, FrameworkLibraryWi
|
||||
/**
|
||||
* The Mocha framework.
|
||||
*/
|
||||
private class Mocha extends FrameworkLibraryWithGenericURL { Mocha() { this = "mocha" } }
|
||||
private class Mocha extends FrameworkLibraryWithGenericURL {
|
||||
Mocha() { this = "mocha" }
|
||||
}
|
||||
|
||||
/**
|
||||
* The Jasmine framework.
|
||||
*/
|
||||
private class Jasmine extends FrameworkLibraryWithGenericURL { Jasmine() { this = "jasmine" } }
|
||||
private class Jasmine extends FrameworkLibraryWithGenericURL {
|
||||
Jasmine() { this = "jasmine" }
|
||||
}
|
||||
|
||||
/**
|
||||
* The Chai framework.
|
||||
*/
|
||||
private class Chai extends FrameworkLibraryWithGenericURL { Chai() { this = "chai" } }
|
||||
private class Chai extends FrameworkLibraryWithGenericURL {
|
||||
Chai() { this = "chai" }
|
||||
}
|
||||
|
||||
/**
|
||||
* The Sinon.JS framework.
|
||||
|
||||
@@ -302,9 +302,7 @@ private module Lexer {
|
||||
op = "%" or
|
||||
op = "|"
|
||||
|
|
||||
"\\Q" + op + "\\E", "|"
|
||||
order by
|
||||
op.length() desc
|
||||
"\\Q" + op + "\\E", "|" order by op.length() desc
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -392,9 +390,7 @@ abstract class NgAstNode extends TNode {
|
||||
child = getChild(idx) and
|
||||
not child instanceof Empty
|
||||
|
|
||||
child.pp(), " "
|
||||
order by
|
||||
idx
|
||||
child.pp(), " " order by idx
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -244,7 +244,9 @@ private module AsmCrypto {
|
||||
* A model of the browserid-crypto library.
|
||||
*/
|
||||
private module BrowserIdCrypto {
|
||||
private class Key extends CryptographicKey { Key() { this = any(Apply apply).getKey() } }
|
||||
private class Key extends CryptographicKey {
|
||||
Key() { this = any(Apply apply).getKey() }
|
||||
}
|
||||
|
||||
private class Apply extends CryptographicOperation {
|
||||
CryptographicAlgorithm algorithm; // non-functional
|
||||
@@ -650,7 +652,9 @@ private module Forge {
|
||||
override CryptographicAlgorithm getAlgorithm() { result = algorithm }
|
||||
}
|
||||
|
||||
private class Key extends CryptographicKey { Key() { this = any(KeyCipher cipher).getKey() } }
|
||||
private class Key extends CryptographicKey {
|
||||
Key() { this = any(KeyCipher cipher).getKey() }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -364,12 +364,16 @@ module Express {
|
||||
/**
|
||||
* An Express response expression.
|
||||
*/
|
||||
class ResponseExpr extends HTTP::Servers::StandardResponseExpr { override ResponseSource src; }
|
||||
class ResponseExpr extends HTTP::Servers::StandardResponseExpr {
|
||||
override ResponseSource src;
|
||||
}
|
||||
|
||||
/**
|
||||
* An Express request expression.
|
||||
*/
|
||||
class RequestExpr extends HTTP::Servers::StandardRequestExpr { override RequestSource src; }
|
||||
class RequestExpr extends HTTP::Servers::StandardRequestExpr {
|
||||
override RequestSource src;
|
||||
}
|
||||
|
||||
/**
|
||||
* An access to a user-controlled Express request input.
|
||||
|
||||
@@ -66,12 +66,16 @@ module Hapi {
|
||||
/**
|
||||
* A Hapi response expression.
|
||||
*/
|
||||
class ResponseExpr extends HTTP::Servers::StandardResponseExpr { override ResponseSource src; }
|
||||
class ResponseExpr extends HTTP::Servers::StandardResponseExpr {
|
||||
override ResponseSource src;
|
||||
}
|
||||
|
||||
/**
|
||||
* An Hapi request expression.
|
||||
*/
|
||||
class RequestExpr extends HTTP::Servers::StandardRequestExpr { override RequestSource src; }
|
||||
class RequestExpr extends HTTP::Servers::StandardRequestExpr {
|
||||
override RequestSource src;
|
||||
}
|
||||
|
||||
/**
|
||||
* An access to a user-controlled Hapi request input.
|
||||
|
||||
@@ -126,12 +126,16 @@ module Koa {
|
||||
/**
|
||||
* An expression that may hold a Koa request object.
|
||||
*/
|
||||
class RequestExpr extends HTTP::Servers::StandardRequestExpr { override RequestSource src; }
|
||||
class RequestExpr extends HTTP::Servers::StandardRequestExpr {
|
||||
override RequestSource src;
|
||||
}
|
||||
|
||||
/**
|
||||
* An expression that may hold a Koa response object.
|
||||
*/
|
||||
class ResponseExpr extends HTTP::Servers::StandardResponseExpr { override ResponseSource src; }
|
||||
class ResponseExpr extends HTTP::Servers::StandardResponseExpr {
|
||||
override ResponseSource src;
|
||||
}
|
||||
|
||||
/**
|
||||
* An access to a user-controlled Koa request input.
|
||||
|
||||
@@ -51,7 +51,8 @@ module LodashUnderscore {
|
||||
* Holds if `name` is the name of a member exported from the `lodash` package
|
||||
* which has a corresponding `lodash.xxx` NPM package.
|
||||
*/
|
||||
private predicate isLodashMember(string name) { // Can be generated using Object.keys(require('lodash'))
|
||||
private predicate isLodashMember(string name) {
|
||||
// Can be generated using Object.keys(require('lodash'))
|
||||
name = "templateSettings" or
|
||||
name = "after" or
|
||||
name = "ary" or
|
||||
|
||||
@@ -370,6 +370,7 @@ private module ClosureLibraryUri {
|
||||
*/
|
||||
private class SetterCall extends DataFlow::MethodCallNode, UriLibraryStep {
|
||||
DataFlow::NewNode uri;
|
||||
|
||||
string name;
|
||||
|
||||
SetterCall() {
|
||||
@@ -390,7 +391,8 @@ private module ClosureLibraryUri {
|
||||
pred = getReceiver() and succ = this
|
||||
or
|
||||
(name = "setDomain" or name = "setPath" or name = "setScheme") and
|
||||
pred = getArgument(0) and succ = uri
|
||||
pred = getArgument(0) and
|
||||
succ = uri
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,10 +147,11 @@ module Vue {
|
||||
private DataFlow::Node getAnAccessor(string kind) {
|
||||
exists(DataFlow::SourceNode computedObj, DataFlow::Node accessorObjOrGetter |
|
||||
computedObj.flowsTo(getComputed()) and
|
||||
computedObj.getAPropertyWrite().getRhs() = accessorObjOrGetter |
|
||||
computedObj.getAPropertyWrite().getRhs() = accessorObjOrGetter
|
||||
|
|
||||
result = accessorObjOrGetter and kind = "get"
|
||||
or
|
||||
exists (DataFlow::SourceNode accessorObj |
|
||||
exists(DataFlow::SourceNode accessorObj |
|
||||
accessorObj.flowsTo(accessorObjOrGetter) and
|
||||
result = accessorObj.getAPropertyWrite(kind).getRhs()
|
||||
)
|
||||
@@ -164,9 +165,10 @@ module Vue {
|
||||
exists(DataFlow::SourceNode computedObj, DataFlow::SourceNode accessorObjOrGetter |
|
||||
computedObj.flowsTo(getComputed()) and
|
||||
accessorObjOrGetter.flowsTo(computedObj.getAPropertyWrite(name).getRhs())
|
||||
|
|
||||
result = accessorObjOrGetter and kind = "get" or
|
||||
exists (DataFlow::SourceNode accessorObj |
|
||||
|
|
||||
result = accessorObjOrGetter and kind = "get"
|
||||
or
|
||||
exists(DataFlow::SourceNode accessorObj |
|
||||
accessorObj.flowsTo(accessorObjOrGetter) and
|
||||
result = accessorObj.getAPropertyWrite(kind).getRhs()
|
||||
)
|
||||
@@ -243,7 +245,6 @@ module Vue {
|
||||
}
|
||||
|
||||
override DataFlow::Node getOwnOption(string name) { result = def.getOptionArgument(0, name) }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,7 +264,6 @@ module Vue {
|
||||
}
|
||||
|
||||
override DataFlow::Node getOwnOption(string name) { result = extend.getOptionArgument(0, name) }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,7 +291,6 @@ module Vue {
|
||||
or
|
||||
result = MkExtendedVue(extend).(ExtendedVue).getOption(name)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -311,7 +310,6 @@ module Vue {
|
||||
}
|
||||
|
||||
override DataFlow::Node getOwnOption(string name) { result = def.getOptionArgument(1, name) }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -365,5 +363,7 @@ module Vue {
|
||||
/**
|
||||
* A `.vue` file.
|
||||
*/
|
||||
class VueFile extends File { VueFile() { getExtension() = "vue" } }
|
||||
class VueFile extends File {
|
||||
VueFile() { getExtension() = "vue" }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,9 +93,7 @@ module SensitiveExpr {
|
||||
* Instead, use the predicates below to work with classifications.
|
||||
*/
|
||||
class Classification extends string {
|
||||
Classification() {
|
||||
this = "secret" or this = "id" or this = "password" or this = "certificate"
|
||||
}
|
||||
Classification() { this = "secret" or this = "id" or this = "password" or this = "certificate" }
|
||||
}
|
||||
|
||||
/** Gets the classification for secret or trusted data. */
|
||||
@@ -148,8 +146,7 @@ abstract class SensitiveVariableAccess extends SensitiveExpr {
|
||||
}
|
||||
|
||||
/** A write to a location that might contain sensitive data. */
|
||||
abstract class SensitiveWrite extends DataFlow::Node {
|
||||
}
|
||||
abstract class SensitiveWrite extends DataFlow::Node { }
|
||||
|
||||
/** A write to a variable or property that might contain sensitive data. */
|
||||
private class BasicSensitiveWrite extends SensitiveWrite {
|
||||
@@ -248,5 +245,6 @@ class CleartextPasswordExpr extends SensitiveExpr {
|
||||
CleartextPasswordExpr() { this.(SensitiveExpr).getClassification() = SensitiveExpr::password() }
|
||||
|
||||
override string describe() { none() }
|
||||
|
||||
override SensitiveExpr::Classification getClassification() { none() }
|
||||
}
|
||||
|
||||
@@ -59,7 +59,9 @@ module CleartextStorage {
|
||||
}
|
||||
|
||||
/** A call to any function whose name suggests that it encodes or encrypts its arguments. */
|
||||
class ProtectSanitizer extends Sanitizer { ProtectSanitizer() { this instanceof ProtectCall } }
|
||||
class ProtectSanitizer extends Sanitizer {
|
||||
ProtectSanitizer() { this instanceof ProtectCall }
|
||||
}
|
||||
|
||||
/**
|
||||
* An expression set as a value on a cookie instance.
|
||||
|
||||
@@ -27,7 +27,9 @@ module ClientSideUrlRedirect {
|
||||
* A flow label for values that represent the URL of the current document, and
|
||||
* hence are only partially user-controlled.
|
||||
*/
|
||||
class DocumentUrl extends DataFlow::FlowLabel { DocumentUrl() { this = "document.url" } }
|
||||
class DocumentUrl extends DataFlow::FlowLabel {
|
||||
DocumentUrl() { this = "document.url" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A taint-tracking configuration for reasoning about unvalidated URL redirections.
|
||||
|
||||
@@ -14,7 +14,9 @@ module HardcodedCredentials {
|
||||
/**
|
||||
* A data flow sink for hardcoded credentials.
|
||||
*/
|
||||
abstract class Sink extends DataFlow::Node { abstract string getKind(); }
|
||||
abstract class Sink extends DataFlow::Node {
|
||||
abstract string getKind();
|
||||
}
|
||||
|
||||
/**
|
||||
* A sanitizer for hardcoded credentials.
|
||||
|
||||
@@ -101,11 +101,15 @@ module InsecureRandomness {
|
||||
* A sensitive write, considered as a sink for random values that are not cryptographically
|
||||
* secure.
|
||||
*/
|
||||
class SensitiveWriteSink extends Sink { SensitiveWriteSink() { this instanceof SensitiveWrite } }
|
||||
class SensitiveWriteSink extends Sink {
|
||||
SensitiveWriteSink() { this instanceof SensitiveWrite }
|
||||
}
|
||||
|
||||
/**
|
||||
* A cryptographic key, considered as a sink for random values that are not cryptographically
|
||||
* secure.
|
||||
*/
|
||||
class CryptoKeySink extends Sink { CryptoKeySink() { this instanceof CryptographicKey } }
|
||||
class CryptoKeySink extends Sink {
|
||||
CryptoKeySink() { this instanceof CryptographicKey }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,5 +76,7 @@ module NosqlInjection {
|
||||
}
|
||||
|
||||
/** An expression interpreted as a NoSQL query, viewed as a sink. */
|
||||
class NosqlQuerySink extends Sink, DataFlow::ValueNode { override NoSQL::Query astNode; }
|
||||
class NosqlQuerySink extends Sink, DataFlow::ValueNode {
|
||||
override NoSQL::Query astNode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,10 +90,14 @@ module PostMessageStar {
|
||||
* A sensitive expression, viewed as a data flow source for cross-window communication
|
||||
* with unrestricted origin.
|
||||
*/
|
||||
class SensitiveExprSource extends Source, DataFlow::ValueNode { override SensitiveExpr astNode; }
|
||||
class SensitiveExprSource extends Source, DataFlow::ValueNode {
|
||||
override SensitiveExpr astNode;
|
||||
}
|
||||
|
||||
/** A call to any function whose name suggests that it encodes or encrypts its arguments. */
|
||||
class ProtectSanitizer extends Sanitizer { ProtectSanitizer() { this instanceof ProtectCall } }
|
||||
class ProtectSanitizer extends Sanitizer {
|
||||
ProtectSanitizer() { this instanceof ProtectCall }
|
||||
}
|
||||
|
||||
/**
|
||||
* An expression sent using `postMessage` without restricting the target window origin.
|
||||
|
||||
@@ -43,7 +43,9 @@ module SqlInjection {
|
||||
}
|
||||
|
||||
/** An SQL expression passed to an API call that executes SQL. */
|
||||
class SqlInjectionExprSink extends Sink, DataFlow::ValueNode { override SQL::SqlString astNode; }
|
||||
class SqlInjectionExprSink extends Sink, DataFlow::ValueNode {
|
||||
override SQL::SqlString astNode;
|
||||
}
|
||||
|
||||
/** An expression that sanitizes a value for the purposes of SQL injection. */
|
||||
class SanitizerExpr extends Sanitizer, DataFlow::ValueNode {
|
||||
|
||||
@@ -51,5 +51,7 @@ module StackTraceExposure {
|
||||
* An expression that can become part of an HTTP response body, viewed
|
||||
* as a data flow sink for stack trace exposure vulnerabilities.
|
||||
*/
|
||||
class DefaultSink extends Sink, DataFlow::ValueNode { override HTTP::ResponseBody astNode; }
|
||||
class DefaultSink extends Sink, DataFlow::ValueNode {
|
||||
override HTTP::ResponseBody astNode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,9 @@ module TaintedFormatString {
|
||||
}
|
||||
|
||||
/** A source of remote user input, considered as a flow source for format injection. */
|
||||
class RemoteSource extends Source { RemoteSource() { this instanceof RemoteFlowSource } }
|
||||
class RemoteSource extends Source {
|
||||
RemoteSource() { this instanceof RemoteFlowSource }
|
||||
}
|
||||
|
||||
/**
|
||||
* A format argument to a printf-like function, considered as a flow sink for format injection.
|
||||
|
||||
@@ -109,7 +109,9 @@ module UnsafeDynamicMethodAccess {
|
||||
/**
|
||||
* The page URL considered as a flow source for unsafe dynamic method access.
|
||||
*/
|
||||
class DocumentUrlAsSource extends Source { DocumentUrlAsSource() { isDocumentURL(asExpr()) } }
|
||||
class DocumentUrlAsSource extends Source {
|
||||
DocumentUrlAsSource() { isDocumentURL(asExpr()) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A function invocation of an unsafe function, as a sink for remote unsafe dynamic method access.
|
||||
|
||||
@@ -101,7 +101,9 @@ module UnvalidatedDynamicMethodCall {
|
||||
/**
|
||||
* The page URL considered as a flow source for unvalidated dynamic method calls.
|
||||
*/
|
||||
class DocumentUrlAsSource extends Source { DocumentUrlAsSource() { isDocumentURL(asExpr()) } }
|
||||
class DocumentUrlAsSource extends Source {
|
||||
DocumentUrlAsSource() { isDocumentURL(asExpr()) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A function invocation of an unsafe function, as a sink for remote unvalidated dynamic method calls.
|
||||
|
||||
@@ -38,7 +38,9 @@ module XpathInjection {
|
||||
}
|
||||
|
||||
/** A source of remote user input, considered as a flow source for XPath injection. */
|
||||
class RemoteSource extends Source { RemoteSource() { this instanceof RemoteFlowSource } }
|
||||
class RemoteSource extends Source {
|
||||
RemoteSource() { this instanceof RemoteFlowSource }
|
||||
}
|
||||
|
||||
/**
|
||||
* The `expression` argument to `xpath.parse` or `xpath.select` (and similar) from
|
||||
|
||||
@@ -254,7 +254,9 @@ module StoredXss {
|
||||
abstract class Sanitizer extends Shared::Sanitizer { }
|
||||
|
||||
/** An arbitrary XSS sink, considered as a flow sink for stored XSS. */
|
||||
private class AnySink extends Sink { AnySink() { this instanceof Shared::Sink } }
|
||||
private class AnySink extends Sink {
|
||||
AnySink() { this instanceof Shared::Sink }
|
||||
}
|
||||
|
||||
/**
|
||||
* A regexp replacement involving an HTML meta-character, viewed as a sanitizer for
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import semmle.javascript.dependencies.FrameworkLibraries
|
||||
|
||||
class FooTools extends FrameworkLibrary { FooTools() { this = "footools" } }
|
||||
class FooTools extends FrameworkLibrary {
|
||||
FooTools() { this = "footools" }
|
||||
}
|
||||
|
||||
class FooToolsInstance extends FrameworkLibraryInstance {
|
||||
FooToolsInstance() {
|
||||
|
||||
@@ -3,10 +3,14 @@ import javascript
|
||||
import HTTP
|
||||
|
||||
/** An import of the Osprey module. */
|
||||
class OspreyImport extends Require { OspreyImport() { getImportedPath().getValue() = "osprey" } }
|
||||
class OspreyImport extends Require {
|
||||
OspreyImport() { getImportedPath().getValue() = "osprey" }
|
||||
}
|
||||
|
||||
/** A variable that holds the Osprey module. */
|
||||
class Osprey extends Variable { Osprey() { getAnAssignedExpr() instanceof OspreyImport } }
|
||||
class Osprey extends Variable {
|
||||
Osprey() { getAnAssignedExpr() instanceof OspreyImport }
|
||||
}
|
||||
|
||||
/** A call to `osprey.create`. */
|
||||
class OspreyCreateAPICall extends MethodCallExpr {
|
||||
|
||||
Reference in New Issue
Block a user