diff --git a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointCharacteristics.qll b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointCharacteristics.qll index 25ac8ca402a..6bb2f29d05c 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointCharacteristics.qll +++ b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointCharacteristics.qll @@ -317,7 +317,8 @@ abstract class OtherModeledArgumentCharacteristic extends EndpointCharacteristic * A characteristic that is an indicator of not being a sink of any type, because it's an argument to a function of a * builtin object. */ -abstract private class ArgumentToBuiltinFunctionCharacteristic extends OtherModeledArgumentCharacteristic { +abstract private class ArgumentToBuiltinFunctionCharacteristic extends OtherModeledArgumentCharacteristic +{ bindingset[this] ArgumentToBuiltinFunctionCharacteristic() { any() } } @@ -358,7 +359,8 @@ abstract class LikelyNotASinkCharacteristic extends EndpointCharacteristic { } private class LodashUnderscoreCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ LodashUnderscoreCharacteristic() { this = "LodashUnderscoreArgument" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -367,7 +369,8 @@ private class LodashUnderscoreCharacteristic extends NotASinkCharacteristic, } private class JQueryArgumentCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ JQueryArgumentCharacteristic() { this = "JQueryArgument" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -376,7 +379,8 @@ private class JQueryArgumentCharacteristic extends NotASinkCharacteristic, } private class ClientRequestCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ ClientRequestCharacteristic() { this = "ClientRequest" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -387,7 +391,8 @@ private class ClientRequestCharacteristic extends NotASinkCharacteristic, } private class PromiseDefinitionCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ PromiseDefinitionCharacteristic() { this = "PromiseDefinition" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -398,14 +403,16 @@ private class PromiseDefinitionCharacteristic extends NotASinkCharacteristic, } private class CryptographicKeyCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ CryptographicKeyCharacteristic() { this = "CryptographicKey" } override predicate appliesToEndpoint(DataFlow::Node n) { n instanceof CryptographicKey } } private class CryptographicOperationFlowCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ CryptographicOperationFlowCharacteristic() { this = "CryptographicOperationFlow" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -414,7 +421,8 @@ private class CryptographicOperationFlowCharacteristic extends NotASinkCharacter } private class LoggerMethodCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ LoggerMethodCharacteristic() { this = "LoggerMethod" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -425,7 +433,8 @@ private class LoggerMethodCharacteristic extends NotASinkCharacteristic, } private class TimeoutCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ TimeoutCharacteristic() { this = "Timeout" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -436,7 +445,8 @@ private class TimeoutCharacteristic extends NotASinkCharacteristic, } private class ReceiverStorageCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ ReceiverStorageCharacteristic() { this = "ReceiverStorage" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -447,7 +457,8 @@ private class ReceiverStorageCharacteristic extends NotASinkCharacteristic, } private class StringStartsWithCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ StringStartsWithCharacteristic() { this = "StringStartsWith" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -458,7 +469,8 @@ private class StringStartsWithCharacteristic extends NotASinkCharacteristic, } private class StringEndsWithCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ StringEndsWithCharacteristic() { this = "StringEndsWith" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -467,7 +479,8 @@ private class StringEndsWithCharacteristic extends NotASinkCharacteristic, } private class StringRegExpTestCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ StringRegExpTestCharacteristic() { this = "StringRegExpTest" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -478,7 +491,8 @@ private class StringRegExpTestCharacteristic extends NotASinkCharacteristic, } private class EventRegistrationCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ EventRegistrationCharacteristic() { this = "EventRegistration" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -487,7 +501,8 @@ private class EventRegistrationCharacteristic extends NotASinkCharacteristic, } private class EventDispatchCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ EventDispatchCharacteristic() { this = "EventDispatch" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -496,7 +511,8 @@ private class EventDispatchCharacteristic extends NotASinkCharacteristic, } private class MembershipCandidateTestCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ MembershipCandidateTestCharacteristic() { this = "MembershipCandidateTest" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -507,7 +523,8 @@ private class MembershipCandidateTestCharacteristic extends NotASinkCharacterist } private class FileSystemAccessCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ FileSystemAccessCharacteristic() { this = "FileSystemAccess" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -516,7 +533,8 @@ private class FileSystemAccessCharacteristic extends NotASinkCharacteristic, } private class DatabaseAccessCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ DatabaseAccessCharacteristic() { this = "DatabaseAccess" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -540,7 +558,8 @@ private class DomCharacteristic extends NotASinkCharacteristic, OtherModeledArgu } private class NextFunctionCallCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ NextFunctionCallCharacteristic() { this = "NextFunctionCall" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -552,7 +571,8 @@ private class NextFunctionCallCharacteristic extends NotASinkCharacteristic, } private class DojoRequireCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ DojoRequireCharacteristic() { this = "DojoRequire" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -563,7 +583,8 @@ private class DojoRequireCharacteristic extends NotASinkCharacteristic, } private class Base64ManipulationCharacteristic extends NotASinkCharacteristic, - OtherModeledArgumentCharacteristic { + OtherModeledArgumentCharacteristic +{ Base64ManipulationCharacteristic() { this = "Base64Manipulation" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -573,7 +594,8 @@ private class Base64ManipulationCharacteristic extends NotASinkCharacteristic, } private class ArgumentToArrayCharacteristic extends ArgumentToBuiltinFunctionCharacteristic, - LikelyNotASinkCharacteristic { + LikelyNotASinkCharacteristic +{ ArgumentToArrayCharacteristic() { this = "ArgumentToArray" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -588,7 +610,8 @@ private class ArgumentToArrayCharacteristic extends ArgumentToBuiltinFunctionCha } private class ArgumentToBuiltinGlobalVarRefCharacteristic extends ArgumentToBuiltinFunctionCharacteristic, - LikelyNotASinkCharacteristic { + LikelyNotASinkCharacteristic +{ ArgumentToBuiltinGlobalVarRefCharacteristic() { this = "ArgumentToBuiltinGlobalVarRef" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -607,7 +630,8 @@ private class ArgumentToBuiltinGlobalVarRefCharacteristic extends ArgumentToBuil } private class ConstantReceiverCharacteristic extends ArgumentToBuiltinFunctionCharacteristic, - NotASinkCharacteristic { + NotASinkCharacteristic +{ ConstantReceiverCharacteristic() { this = "ConstantReceiver" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -623,7 +647,8 @@ private class ConstantReceiverCharacteristic extends ArgumentToBuiltinFunctionCh } private class BuiltinCallNameCharacteristic extends ArgumentToBuiltinFunctionCharacteristic, - NotASinkCharacteristic { + NotASinkCharacteristic +{ BuiltinCallNameCharacteristic() { this = "BuiltinCallName" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -684,7 +709,8 @@ class IsArgumentToModeledFunctionCharacteristic extends StandardEndpointFilterCh } } -private class IsArgumentToSinklessLibraryCharacteristic extends StandardEndpointFilterCharacteristic { +private class IsArgumentToSinklessLibraryCharacteristic extends StandardEndpointFilterCharacteristic +{ IsArgumentToSinklessLibraryCharacteristic() { this = "argument to sinkless library" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -750,7 +776,8 @@ private class InIrrelevantFileCharacteristic extends StandardEndpointFilterChara } /** An EndpointFilterCharacteristic that indicates that an endpoint is unlikely to be a NoSQL injection sink. */ -abstract private class NosqlInjectionSinkEndpointFilterCharacteristic extends EndpointFilterCharacteristic { +abstract private class NosqlInjectionSinkEndpointFilterCharacteristic extends EndpointFilterCharacteristic +{ bindingset[this] NosqlInjectionSinkEndpointFilterCharacteristic() { any() } @@ -763,7 +790,8 @@ abstract private class NosqlInjectionSinkEndpointFilterCharacteristic extends En } } -private class DatabaseAccessCallHeuristicCharacteristic extends NosqlInjectionSinkEndpointFilterCharacteristic { +private class DatabaseAccessCallHeuristicCharacteristic extends NosqlInjectionSinkEndpointFilterCharacteristic +{ DatabaseAccessCallHeuristicCharacteristic() { this = "matches database access call heuristic" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -794,7 +822,8 @@ private class ModeledSinkCharacteristic extends NosqlInjectionSinkEndpointFilter } } -private class PredecessorInModeledFlowStepCharacteristic extends NosqlInjectionSinkEndpointFilterCharacteristic { +private class PredecessorInModeledFlowStepCharacteristic extends NosqlInjectionSinkEndpointFilterCharacteristic +{ PredecessorInModeledFlowStepCharacteristic() { this = "predecessor in a modeled flow step" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -805,7 +834,8 @@ private class PredecessorInModeledFlowStepCharacteristic extends NosqlInjectionS } } -private class ModeledDatabaseAccessCharacteristic extends NosqlInjectionSinkEndpointFilterCharacteristic { +private class ModeledDatabaseAccessCharacteristic extends NosqlInjectionSinkEndpointFilterCharacteristic +{ ModeledDatabaseAccessCharacteristic() { this = "modeled database access" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -818,7 +848,8 @@ private class ModeledDatabaseAccessCharacteristic extends NosqlInjectionSinkEndp } } -private class ReceiverIsHttpRequestExpressionCharacteristic extends NosqlInjectionSinkEndpointFilterCharacteristic { +private class ReceiverIsHttpRequestExpressionCharacteristic extends NosqlInjectionSinkEndpointFilterCharacteristic +{ ReceiverIsHttpRequestExpressionCharacteristic() { this = "receiver is a HTTP request expression" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -829,7 +860,8 @@ private class ReceiverIsHttpRequestExpressionCharacteristic extends NosqlInjecti } } -private class ReceiverIsHttpResponseExpressionCharacteristic extends NosqlInjectionSinkEndpointFilterCharacteristic { +private class ReceiverIsHttpResponseExpressionCharacteristic extends NosqlInjectionSinkEndpointFilterCharacteristic +{ ReceiverIsHttpResponseExpressionCharacteristic() { this = "receiver is a HTTP response expression" } @@ -842,7 +874,8 @@ private class ReceiverIsHttpResponseExpressionCharacteristic extends NosqlInject } } -private class NotDirectArgumentToLikelyExternalLibraryCallOrHeuristicSinkNosqlCharacteristic extends NosqlInjectionSinkEndpointFilterCharacteristic { +private class NotDirectArgumentToLikelyExternalLibraryCallOrHeuristicSinkNosqlCharacteristic extends NosqlInjectionSinkEndpointFilterCharacteristic +{ NotDirectArgumentToLikelyExternalLibraryCallOrHeuristicSinkNosqlCharacteristic() { this = "not a direct argument to a likely external library call or a heuristic sink (nosql)" } @@ -885,7 +918,8 @@ private class NotDirectArgumentToLikelyExternalLibraryCallOrHeuristicSinkNosqlCh } /** An EndpointFilterCharacteristic that indicates that an endpoint is unlikely to be a SQL injection sink. */ -abstract private class SqlInjectionSinkEndpointFilterCharacteristic extends EndpointFilterCharacteristic { +abstract private class SqlInjectionSinkEndpointFilterCharacteristic extends EndpointFilterCharacteristic +{ bindingset[this] SqlInjectionSinkEndpointFilterCharacteristic() { any() } @@ -898,7 +932,8 @@ abstract private class SqlInjectionSinkEndpointFilterCharacteristic extends Endp } } -private class PreparedSqlStatementCharacteristic extends SqlInjectionSinkEndpointFilterCharacteristic { +private class PreparedSqlStatementCharacteristic extends SqlInjectionSinkEndpointFilterCharacteristic +{ PreparedSqlStatementCharacteristic() { this = "prepared SQL statement" } override predicate appliesToEndpoint(DataFlow::Node n) { @@ -932,7 +967,8 @@ private class HtmlOrRenderingCharacteristic extends SqlInjectionSinkEndpointFilt } } -private class NotAnArgumentToLikelyExternalLibraryCallOrHeuristicSinkCharacteristic extends SqlInjectionSinkEndpointFilterCharacteristic { +private class NotAnArgumentToLikelyExternalLibraryCallOrHeuristicSinkCharacteristic extends SqlInjectionSinkEndpointFilterCharacteristic +{ NotAnArgumentToLikelyExternalLibraryCallOrHeuristicSinkCharacteristic() { this = "not an argument to a likely external library call or a heuristic sink" } @@ -956,7 +992,8 @@ private class NotAnArgumentToLikelyExternalLibraryCallOrHeuristicSinkCharacteris } /** An EndpointFilterCharacteristic that indicates that an endpoint is unlikely to be a tainted path injection sink. */ -abstract private class TaintedPathSinkEndpointFilterCharacteristic extends EndpointFilterCharacteristic { +abstract private class TaintedPathSinkEndpointFilterCharacteristic extends EndpointFilterCharacteristic +{ bindingset[this] TaintedPathSinkEndpointFilterCharacteristic() { any() } @@ -969,7 +1006,8 @@ abstract private class TaintedPathSinkEndpointFilterCharacteristic extends Endpo } } -private class NotDirectArgumentToLikelyExternalLibraryCallOrHeuristicSinkTaintedPathCharacteristic extends TaintedPathSinkEndpointFilterCharacteristic { +private class NotDirectArgumentToLikelyExternalLibraryCallOrHeuristicSinkTaintedPathCharacteristic extends TaintedPathSinkEndpointFilterCharacteristic +{ NotDirectArgumentToLikelyExternalLibraryCallOrHeuristicSinkTaintedPathCharacteristic() { this = "not a direct argument to a likely external library call or a heuristic sink (tainted path)" @@ -1021,7 +1059,8 @@ abstract private class XssSinkEndpointFilterCharacteristic extends EndpointFilte } } -private class SetStateCallsInReactApplicationsCharacteristic extends XssSinkEndpointFilterCharacteristic { +private class SetStateCallsInReactApplicationsCharacteristic extends XssSinkEndpointFilterCharacteristic +{ SetStateCallsInReactApplicationsCharacteristic() { this = "setState calls ought to be safe in react applications" } @@ -1031,7 +1070,8 @@ private class SetStateCallsInReactApplicationsCharacteristic extends XssSinkEndp } } -private class NotDirectArgumentToLikelyExternalLibraryCallOrHeuristicSinkXssCharacteristic extends XssSinkEndpointFilterCharacteristic { +private class NotDirectArgumentToLikelyExternalLibraryCallOrHeuristicSinkXssCharacteristic extends XssSinkEndpointFilterCharacteristic +{ NotDirectArgumentToLikelyExternalLibraryCallOrHeuristicSinkXssCharacteristic() { this = "not a direct argument to a likely external library call or a heuristic sink (xss)" } diff --git a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll index 0ac74597478..8e34d714f18 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll +++ b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll @@ -204,7 +204,8 @@ class FileImports extends EndpointFeature, TFileImports { * will be treated by tokenization as if they were spaces. */ class ContextSurroundingFunctionParameters extends EndpointFeature, - TContextSurroundingFunctionParameters { + TContextSurroundingFunctionParameters +{ override string getName() { result = "contextSurroundingFunctionParameters" } Function getRelevantFunction(DataFlow::Node endpoint) { diff --git a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointTypes.qll b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointTypes.qll index ade9f9ed99d..452128083fa 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointTypes.qll +++ b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointTypes.qll @@ -64,7 +64,8 @@ class TaintedPathSinkType extends EndpointType, TTaintedPathSinkType { /** The `ShellCommandInjectionFromEnvironmentSink` class that can be predicted by endpoint scoring models. */ class ShellCommandInjectionFromEnvironmentSinkType extends EndpointType, - TShellCommandInjectionFromEnvironmentSinkType { + TShellCommandInjectionFromEnvironmentSinkType +{ override string getDescription() { result = "ShellCommandInjectionFromEnvironmentSink" } override int getEncoding() { result = 5 } diff --git a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/TaintedPathATM.qll b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/TaintedPathATM.qll index c494a7587d6..de5c9fab415 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/TaintedPathATM.qll +++ b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/TaintedPathATM.qll @@ -51,7 +51,8 @@ class TaintedPathAtmConfig extends AtmConfig { * of barrier guards, we port the barrier guards for the boosted query from the standard library to * sanitizer guards here. */ -private class BarrierGuardNodeAsSanitizerGuardNode extends TaintTracking::LabeledSanitizerGuardNode instanceof TaintedPath::BarrierGuardNode { +private class BarrierGuardNodeAsSanitizerGuardNode extends TaintTracking::LabeledSanitizerGuardNode instanceof TaintedPath::BarrierGuardNode +{ override predicate sanitizes(boolean outcome, Expr e) { blocks(outcome, e) or blocks(outcome, e, _) } diff --git a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/XssATM.qll b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/XssATM.qll index d28b669bf49..5daac270292 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/XssATM.qll +++ b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/XssATM.qll @@ -40,7 +40,8 @@ class DomBasedXssAtmConfig extends AtmConfig { private import semmle.javascript.security.dataflow.Xss::Shared as Shared private class PrefixStringSanitizerActivated extends TaintTracking::SanitizerGuardNode, - DomBasedXss::PrefixStringSanitizer { + DomBasedXss::PrefixStringSanitizer +{ PrefixStringSanitizerActivated() { this = this } } @@ -52,6 +53,7 @@ private class QuoteGuard extends TaintTracking::SanitizerGuardNode, Shared::Quot QuoteGuard() { this = this } } -private class ContainsHtmlGuard extends TaintTracking::SanitizerGuardNode, Shared::ContainsHtmlGuard { +private class ContainsHtmlGuard extends TaintTracking::SanitizerGuardNode, Shared::ContainsHtmlGuard +{ ContainsHtmlGuard() { this = this } } diff --git a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/XssThroughDomATM.qll b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/XssThroughDomATM.qll index 87d69a37165..e188da15a7e 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/XssThroughDomATM.qll +++ b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/XssThroughDomATM.qll @@ -71,7 +71,8 @@ class TypeTestGuard extends TaintTracking::SanitizerGuardNode, DataFlow::ValueNo private import semmle.javascript.security.dataflow.Xss::Shared as Shared private class PrefixStringSanitizer extends TaintTracking::SanitizerGuardNode, - DomBasedXss::PrefixStringSanitizer { + DomBasedXss::PrefixStringSanitizer +{ PrefixStringSanitizer() { this = this } } @@ -83,6 +84,7 @@ private class QuoteGuard extends TaintTracking::SanitizerGuardNode, Shared::Quot QuoteGuard() { this = this } } -private class ContainsHtmlGuard extends TaintTracking::SanitizerGuardNode, Shared::ContainsHtmlGuard { +private class ContainsHtmlGuard extends TaintTracking::SanitizerGuardNode, Shared::ContainsHtmlGuard +{ ContainsHtmlGuard() { this = this } } diff --git a/javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/extraction/Queries.qll b/javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/extraction/Queries.qll index a84872c4ee4..4f7260e7e62 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/extraction/Queries.qll +++ b/javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/extraction/Queries.qll @@ -39,6 +39,7 @@ class XssThroughDomQuery extends Query, TXssThroughDomQuery { } class ShellCommandInjectionFromEnvironmentQuery extends Query, - TShellCommandInjectionFromEnvironmentQuery { + TShellCommandInjectionFromEnvironmentQuery +{ override string getName() { result = "ShellCommandInjectionFromEnvironment" } } diff --git a/javascript/ql/lib/semmle/javascript/Closure.qll b/javascript/ql/lib/semmle/javascript/Closure.qll index e27387255a1..c69363588cc 100644 --- a/javascript/ql/lib/semmle/javascript/Closure.qll +++ b/javascript/ql/lib/semmle/javascript/Closure.qll @@ -48,7 +48,8 @@ module Closure { * A call to a method on the `goog.` namespace, as a closure reference. */ abstract private class DefaultNamespaceRef extends DataFlow::MethodCallNode, - ClosureNamespaceRef::Range { + ClosureNamespaceRef::Range + { DefaultNamespaceRef() { this = DataFlow::globalVarRef("goog").getAMethodCall() } override string getClosureNamespace() { result = getArgument(0).getStringValue() } @@ -75,21 +76,22 @@ module Closure { /** * A top-level call to `goog.provide`. */ - class ClosureProvideCall extends ClosureNamespaceRef, DataFlow::MethodCallNode instanceof DefaultClosureProvideCall { - } + class ClosureProvideCall extends ClosureNamespaceRef, DataFlow::MethodCallNode instanceof DefaultClosureProvideCall + { } /** * A call to `goog.require`. */ - private class DefaultClosureRequireCall extends DefaultNamespaceRef, ClosureNamespaceAccess::Range { + private class DefaultClosureRequireCall extends DefaultNamespaceRef, ClosureNamespaceAccess::Range + { DefaultClosureRequireCall() { getMethodName() = "require" } } /** * A call to `goog.require`. */ - class ClosureRequireCall extends ClosureNamespaceAccess, DataFlow::MethodCallNode instanceof DefaultClosureRequireCall { - } + class ClosureRequireCall extends ClosureNamespaceAccess, DataFlow::MethodCallNode instanceof DefaultClosureRequireCall + { } /** * A top-level call to `goog.module` or `goog.declareModuleId`. @@ -104,8 +106,8 @@ module Closure { /** * A top-level call to `goog.module` or `goog.declareModuleId`. */ - class ClosureModuleDeclaration extends ClosureNamespaceRef, DataFlow::MethodCallNode instanceof DefaultClosureModuleDeclaration { - } + class ClosureModuleDeclaration extends ClosureNamespaceRef, DataFlow::MethodCallNode instanceof DefaultClosureModuleDeclaration + { } private GlobalVariable googVariable() { variables(result, "goog", any(GlobalScope sc)) } diff --git a/javascript/ql/lib/semmle/javascript/Concepts.qll b/javascript/ql/lib/semmle/javascript/Concepts.qll index 67cf325eb11..01970490374 100644 --- a/javascript/ql/lib/semmle/javascript/Concepts.qll +++ b/javascript/ql/lib/semmle/javascript/Concepts.qll @@ -124,7 +124,8 @@ module Cryptography { * Extend this class to refine existing API models. If you want to model new APIs, * extend `CryptographicOperation::Range` instead. */ - class CryptographicOperation extends SC::CryptographicOperation instanceof CryptographicOperation::Range { + class CryptographicOperation extends SC::CryptographicOperation instanceof CryptographicOperation::Range + { /** * DEPRECATED. This predicate has been renamed to `getAnInput`. * diff --git a/javascript/ql/lib/semmle/javascript/DOM.qll b/javascript/ql/lib/semmle/javascript/DOM.qll index 954ac8571e7..f06f43d5976 100644 --- a/javascript/ql/lib/semmle/javascript/DOM.qll +++ b/javascript/ql/lib/semmle/javascript/DOM.qll @@ -63,7 +63,8 @@ module DOM { /** * An HTML element, viewed as an `ElementDefinition`. */ - private class HtmlElementDefinition extends ElementDefinition, @xmlelement instanceof HTML::Element { + private class HtmlElementDefinition extends ElementDefinition, @xmlelement instanceof HTML::Element + { override string getName() { result = HTML::Element.super.getName() } override AttributeDefinition getAttribute(int i) { @@ -127,7 +128,8 @@ module DOM { /** * An HTML attribute, viewed as an `AttributeDefinition`. */ - private class HtmlAttributeDefinition extends AttributeDefinition, @xmlattribute instanceof HTML::Attribute { + private class HtmlAttributeDefinition extends AttributeDefinition, @xmlattribute instanceof HTML::Attribute + { override string getName() { result = HTML::Attribute.super.getName() } override string getStringValue() { result = super.getValue() } @@ -138,7 +140,8 @@ module DOM { /** * A JSX attribute, viewed as an `AttributeDefinition`. */ - private class JsxAttributeDefinition extends AttributeDefinition, @jsx_attribute instanceof JsxAttribute { + private class JsxAttributeDefinition extends AttributeDefinition, @jsx_attribute instanceof JsxAttribute + { override string getName() { result = JsxAttribute.super.getName() } override DataFlow::Node getValueNode() { diff --git a/javascript/ql/lib/semmle/javascript/Functions.qll b/javascript/ql/lib/semmle/javascript/Functions.qll index 62abdddaa69..b3731e512fe 100644 --- a/javascript/ql/lib/semmle/javascript/Functions.qll +++ b/javascript/ql/lib/semmle/javascript/Functions.qll @@ -37,7 +37,8 @@ import javascript * ``` */ class Function extends @function, Parameterized, TypeParameterized, StmtContainer, Documentable, - AST::ValueNode { + AST::ValueNode +{ /** Gets the `i`th parameter of this function. */ Parameter getParameter(int i) { result = this.getChildExpr(i) } diff --git a/javascript/ql/lib/semmle/javascript/GeneratedCode.qll b/javascript/ql/lib/semmle/javascript/GeneratedCode.qll index ea397a9c40d..e045a98f3b0 100644 --- a/javascript/ql/lib/semmle/javascript/GeneratedCode.qll +++ b/javascript/ql/lib/semmle/javascript/GeneratedCode.qll @@ -16,8 +16,8 @@ abstract class GeneratedCodeMarkerComment extends Comment { } /** * A source mapping comment, viewed as a marker comment indicating generated code. */ -private class SourceMappingCommentMarkerComment extends GeneratedCodeMarkerComment instanceof SourceMappingComment { -} +private class SourceMappingCommentMarkerComment extends GeneratedCodeMarkerComment instanceof SourceMappingComment +{ } /** * A marker comment left by a known code generator. diff --git a/javascript/ql/lib/semmle/javascript/MembershipCandidates.qll b/javascript/ql/lib/semmle/javascript/MembershipCandidates.qll index 0f9a8c33a37..21f4cc1b1c5 100644 --- a/javascript/ql/lib/semmle/javascript/MembershipCandidates.qll +++ b/javascript/ql/lib/semmle/javascript/MembershipCandidates.qll @@ -220,7 +220,8 @@ module MembershipCandidate { * A candidate that may be a property name of an object. */ class ObjectPropertyNameMembershipCandidate extends MembershipCandidate::Range, - DataFlow::ValueNode { + DataFlow::ValueNode + { Expr test; Expr membersNode; diff --git a/javascript/ql/lib/semmle/javascript/Promises.qll b/javascript/ql/lib/semmle/javascript/Promises.qll index f34885644e8..bb1ee9326d8 100644 --- a/javascript/ql/lib/semmle/javascript/Promises.qll +++ b/javascript/ql/lib/semmle/javascript/Promises.qll @@ -616,7 +616,8 @@ module Bluebird { } private class BluebirdCoroutineDefinitionAsPartialInvoke extends DataFlow::PartialInvokeNode::Range, - BluebirdCoroutineDefinition { + BluebirdCoroutineDefinition + { override DataFlow::SourceNode getBoundFunction(DataFlow::Node callback, int boundArgs) { boundArgs = 0 and callback = this.getArgument(0) and diff --git a/javascript/ql/lib/semmle/javascript/Routing.qll b/javascript/ql/lib/semmle/javascript/Routing.qll index c55069924fd..93e5cd24328 100644 --- a/javascript/ql/lib/semmle/javascript/Routing.qll +++ b/javascript/ql/lib/semmle/javascript/Routing.qll @@ -508,7 +508,8 @@ module Routing { /** * An array which has been determined to be a route node, seen as a route node with arguments. */ - private class ImpliedArrayRoute extends ValueNode::WithArguments, DataFlow::ArrayCreationNode instanceof ValueNode::UseSite { + private class ImpliedArrayRoute extends ValueNode::WithArguments, DataFlow::ArrayCreationNode instanceof ValueNode::UseSite + { override DataFlow::Node getArgumentNode(int n) { result = this.getElement(n) } } } diff --git a/javascript/ql/lib/semmle/javascript/StandardLibrary.qll b/javascript/ql/lib/semmle/javascript/StandardLibrary.qll index 9366c76d9cc..b40f10d9369 100644 --- a/javascript/ql/lib/semmle/javascript/StandardLibrary.qll +++ b/javascript/ql/lib/semmle/javascript/StandardLibrary.qll @@ -50,7 +50,8 @@ class DirectEval extends CallExpr { * argument as the receiver to the callback. */ private class ArrayIterationCallbackAsPartialInvoke extends DataFlow::PartialInvokeNode::Range, - DataFlow::MethodCallNode { + DataFlow::MethodCallNode +{ ArrayIterationCallbackAsPartialInvoke() { this.getNumArgument() = 2 and // Filter out library methods named 'forEach' etc diff --git a/javascript/ql/lib/semmle/javascript/TypeScript.qll b/javascript/ql/lib/semmle/javascript/TypeScript.qll index 5b8cd763dfe..4e0d61179d2 100644 --- a/javascript/ql/lib/semmle/javascript/TypeScript.qll +++ b/javascript/ql/lib/semmle/javascript/TypeScript.qll @@ -1470,7 +1470,8 @@ class NamespaceAccess extends TypeExpr, NamespaceRef, @namespace_access { * An identifier that refers to a namespace from inside a type annotation. */ class LocalNamespaceAccess extends NamespaceAccess, LexicalAccess, Identifier, - @local_namespace_access { + @local_namespace_access +{ override Identifier getIdentifier() { result = this } /** Gets the local name being accessed. */ diff --git a/javascript/ql/lib/semmle/javascript/dataflow/Refinements.qll b/javascript/ql/lib/semmle/javascript/dataflow/Refinements.qll index 91ed08e4a44..52a7f74719b 100644 --- a/javascript/ql/lib/semmle/javascript/dataflow/Refinements.qll +++ b/javascript/ql/lib/semmle/javascript/dataflow/Refinements.qll @@ -117,7 +117,8 @@ private class IntRefinement extends NumberRefinement, NumberLiteral { * A use of the global variable `undefined`, viewed as a refinement expression. */ private class UndefinedInRefinement extends RefinementCandidate, - SyntacticConstants::UndefinedConstant { + SyntacticConstants::UndefinedConstant +{ override SsaSourceVariable getARefinedVar() { none() } override RefinementValue eval(RefinementContext ctxt) { diff --git a/javascript/ql/lib/semmle/javascript/dataflow/TaintTracking.qll b/javascript/ql/lib/semmle/javascript/dataflow/TaintTracking.qll index 1e6a7044178..2e80990ac13 100644 --- a/javascript/ql/lib/semmle/javascript/dataflow/TaintTracking.qll +++ b/javascript/ql/lib/semmle/javascript/dataflow/TaintTracking.qll @@ -1005,7 +1005,8 @@ module TaintTracking { * Note that the `includes` method is covered by `MembershipTestSanitizer`. */ class WhitelistContainmentCallSanitizer extends AdditionalSanitizerGuardNode, - DataFlow::MethodCallNode { + DataFlow::MethodCallNode + { WhitelistContainmentCallSanitizer() { this.getMethodName() = ["contains", "has", "hasOwnProperty", "hasOwn"] } diff --git a/javascript/ql/lib/semmle/javascript/dataflow/internal/PropertyTypeInference.qll b/javascript/ql/lib/semmle/javascript/dataflow/internal/PropertyTypeInference.qll index 25b6cfdb2d9..26a8e34beee 100644 --- a/javascript/ql/lib/semmle/javascript/dataflow/internal/PropertyTypeInference.qll +++ b/javascript/ql/lib/semmle/javascript/dataflow/internal/PropertyTypeInference.qll @@ -120,7 +120,8 @@ abstract class AnalyzedPropertyWrite extends DataFlow::Node { /** * Flow analysis for property writes. */ -private class AnalyzedExplicitPropertyWrite extends AnalyzedPropertyWrite instanceof DataFlow::PropWrite { +private class AnalyzedExplicitPropertyWrite extends AnalyzedPropertyWrite instanceof DataFlow::PropWrite +{ override predicate writes(AbstractValue base, string prop, DataFlow::AnalyzedNode source) { explicitPropertyWrite(this, base, prop, source) } diff --git a/javascript/ql/lib/semmle/javascript/dataflow/internal/VariableTypeInference.qll b/javascript/ql/lib/semmle/javascript/dataflow/internal/VariableTypeInference.qll index 29a7b420513..c7f67e7a4f5 100644 --- a/javascript/ql/lib/semmle/javascript/dataflow/internal/VariableTypeInference.qll +++ b/javascript/ql/lib/semmle/javascript/dataflow/internal/VariableTypeInference.qll @@ -690,7 +690,8 @@ abstract private class CallWithAnalyzedParameters extends FunctionWithAnalyzedPa /** * Flow analysis for simple parameters of IIFEs. */ -private class IifeWithAnalyzedParameters extends CallWithAnalyzedParameters instanceof ImmediatelyInvokedFunctionExpr { +private class IifeWithAnalyzedParameters extends CallWithAnalyzedParameters instanceof ImmediatelyInvokedFunctionExpr +{ IifeWithAnalyzedParameters() { super.getInvocationKind() = "direct" } override DataFlow::InvokeNode getAnInvocation() { result = super.getInvocation().flow() } @@ -711,7 +712,8 @@ private class IifeWithAnalyzedParameters extends CallWithAnalyzedParameters inst /** * Enables inter-procedural type inference for `LocalFunction`. */ -private class LocalFunctionWithAnalyzedParameters extends CallWithAnalyzedParameters instanceof LocalFunction { +private class LocalFunctionWithAnalyzedParameters extends CallWithAnalyzedParameters instanceof LocalFunction +{ override DataFlow::InvokeNode getAnInvocation() { result = LocalFunction.super.getAnInvocation() } override predicate isIncomplete(DataFlow::Incompleteness cause) { none() } diff --git a/javascript/ql/lib/semmle/javascript/dependencies/Dependencies.qll b/javascript/ql/lib/semmle/javascript/dependencies/Dependencies.qll index f110f3d5f97..76a285ccd8c 100644 --- a/javascript/ql/lib/semmle/javascript/dependencies/Dependencies.qll +++ b/javascript/ql/lib/semmle/javascript/dependencies/Dependencies.qll @@ -226,7 +226,8 @@ abstract class ScriptDependency extends Dependency { /** * An embedded JavaScript library included inside a `