mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
JS: Use question-mark variant in all overlay annotations
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides classes and predicates for the 'js/useless-expression' query.
|
* Provides classes and predicates for the 'js/useless-expression' query.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides a predicate for identifying unused index variables in loops.
|
* Provides a predicate for identifying unused index variables in loops.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Provides classes for working with
|
* Provides classes for working with
|
||||||
* [Asynchronous Module Definitions](https://github.com/amdjs/amdjs-api/wiki/AMD).
|
* [Asynchronous Module Definitions](https://github.com/amdjs/amdjs-api/wiki/AMD).
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides classes for working with the AST-based representation of JavaScript programs.
|
* Provides classes for working with the AST-based representation of JavaScript programs.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
@@ -477,7 +477,7 @@ module AST {
|
|||||||
DataFlow::AnalyzedNode analyze() { result = DataFlow::valueNode(this).analyze() }
|
DataFlow::AnalyzedNode analyze() { result = DataFlow::valueNode(this).analyze() }
|
||||||
|
|
||||||
/** Gets the data flow node associated with this program element. */
|
/** Gets the data flow node associated with this program element. */
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
DataFlow::ValueNode flow() { result = DataFlow::valueNode(this) }
|
DataFlow::ValueNode flow() { result = DataFlow::valueNode(this) }
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,7 @@
|
|||||||
* Note that the `import` statement as a whole is part of the CFG of the body, while its single
|
* Note that the `import` statement as a whole is part of the CFG of the body, while its single
|
||||||
* import specifier `x as y` forms part of the preamble.
|
* import specifier `x as y` forms part of the preamble.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Class declarations and class expressions are modeled by (QL) classes `ClassDeclaration`
|
* Class declarations and class expressions are modeled by (QL) classes `ClassDeclaration`
|
||||||
* and `ClassExpression`, respectively, which are both subclasses of `ClassDefinition`.
|
* and `ClassExpression`, respectively, which are both subclasses of `ClassDefinition`.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides classes for working with the Closure-Library module system.
|
* Provides classes for working with the Closure-Library module system.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes for working with JavaScript comments. */
|
/** Provides classes for working with JavaScript comments. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides classes for working with expressions that evaluate to constant values.
|
* Provides classes for working with expressions that evaluate to constant values.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes and predicates for working with variable definitions and uses. */
|
/** Provides classes and predicates for working with variable definitions and uses. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides classes for working with E4X.
|
* Provides classes for working with E4X.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes for working with ECMAScript 2015 modules. */
|
/** Provides classes for working with ECMAScript 2015 modules. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes for working with syntax errors. */
|
/** Provides classes for working with syntax errors. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides classes for working with expressions.
|
* Provides classes for working with expressions.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
@@ -253,7 +253,7 @@ class Expr extends @expr, ExprOrStmt, ExprOrType, AST::ValueNode {
|
|||||||
* Gets the data-flow node where exceptions thrown by this expression will
|
* Gets the data-flow node where exceptions thrown by this expression will
|
||||||
* propagate if this expression causes an exception to be thrown.
|
* propagate if this expression causes an exception to be thrown.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
DataFlow::Node getExceptionTarget() {
|
DataFlow::Node getExceptionTarget() {
|
||||||
result = getCatchParameterFromStmt(getRawEnclosingStmt(this))
|
result = getCatchParameterFromStmt(getRawEnclosingStmt(this))
|
||||||
@@ -271,7 +271,7 @@ private DataFlow::Node getCatchParameterFromStmt(Stmt stmt) {
|
|||||||
DataFlow::parameterNode(stmt.getEnclosingTryCatchStmt().getACatchClause().getAParameter())
|
DataFlow::parameterNode(stmt.getEnclosingTryCatchStmt().getACatchClause().getAParameter())
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
private Stmt getRawEnclosingStmt(Expr e) {
|
private Stmt getRawEnclosingStmt(Expr e) {
|
||||||
// For performance reasons, we need the enclosing statement without overrides
|
// For performance reasons, we need the enclosing statement without overrides
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides classes for reasoning about `extend`-like functions.
|
* Provides classes for reasoning about `extend`-like functions.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
* Array.prototype.length;
|
* Array.prototype.length;
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes for working with files and folders. */
|
/** Provides classes for working with files and folders. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes for working with functions. */
|
/** Provides classes for working with functions. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides predicates for associating qualified names with data flow nodes.
|
* Provides predicates for associating qualified names with data flow nodes.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
@@ -357,7 +357,7 @@ module AccessPath {
|
|||||||
* Gets a variable that is relevant for the computations in the `GetLaterAccess` module.
|
* Gets a variable that is relevant for the computations in the `GetLaterAccess` module.
|
||||||
* This predicate restricts as much as it can, but without depending on `getAVariableRef`.
|
* This predicate restricts as much as it can, but without depending on `getAVariableRef`.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
private SsaVariable getARelevantVariableSimple() {
|
private SsaVariable getARelevantVariableSimple() {
|
||||||
// The variable might be used where `getLaterBaseAccess()` is called.
|
// The variable might be used where `getLaterBaseAccess()` is called.
|
||||||
@@ -409,7 +409,7 @@ module AccessPath {
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
DataFlow::Node getAReferenceTo(Root root, string path) {
|
DataFlow::Node getAReferenceTo(Root root, string path) {
|
||||||
path = fromReference(result, root) and
|
path = fromReference(result, root) and
|
||||||
@@ -433,7 +433,7 @@ module AccessPath {
|
|||||||
* })(NS = NS || {});
|
* })(NS = NS || {});
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
DataFlow::Node getAReferenceTo(string path) {
|
DataFlow::Node getAReferenceTo(string path) {
|
||||||
path = fromReference(result, DataFlow::globalAccessPathRootPseudoNode())
|
path = fromReference(result, DataFlow::globalAccessPathRootPseudoNode())
|
||||||
@@ -455,7 +455,7 @@ module AccessPath {
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
DataFlow::Node getAnAssignmentTo(Root root, string path) {
|
DataFlow::Node getAnAssignmentTo(Root root, string path) {
|
||||||
path = fromRhs(result, root) and
|
path = fromRhs(result, root) and
|
||||||
@@ -477,7 +477,7 @@ module AccessPath {
|
|||||||
* })(foo = foo || {});
|
* })(foo = foo || {});
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
DataFlow::Node getAnAssignmentTo(string path) {
|
DataFlow::Node getAnAssignmentTo(string path) {
|
||||||
path = fromRhs(result, DataFlow::globalAccessPathRootPseudoNode())
|
path = fromRhs(result, DataFlow::globalAccessPathRootPseudoNode())
|
||||||
@@ -488,7 +488,7 @@ module AccessPath {
|
|||||||
*
|
*
|
||||||
* See `getAReferenceTo` and `getAnAssignmentTo` for more details.
|
* See `getAReferenceTo` and `getAnAssignmentTo` for more details.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
DataFlow::Node getAReferenceOrAssignmentTo(string path) {
|
DataFlow::Node getAReferenceOrAssignmentTo(string path) {
|
||||||
result = getAReferenceTo(path)
|
result = getAReferenceTo(path)
|
||||||
@@ -501,7 +501,7 @@ module AccessPath {
|
|||||||
*
|
*
|
||||||
* See `getAReferenceTo` and `getAnAssignmentTo` for more details.
|
* See `getAReferenceTo` and `getAnAssignmentTo` for more details.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
DataFlow::Node getAReferenceOrAssignmentTo(Root root, string path) {
|
DataFlow::Node getAReferenceOrAssignmentTo(Root root, string path) {
|
||||||
result = getAReferenceTo(root, path)
|
result = getAReferenceTo(root, path)
|
||||||
@@ -530,7 +530,7 @@ module AccessPath {
|
|||||||
/**
|
/**
|
||||||
* Gets a `SourceNode` that refers to the same value or access path as the given node.
|
* Gets a `SourceNode` that refers to the same value or access path as the given node.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
DataFlow::SourceNode getAnAliasedSourceNode(DataFlow::Node node) {
|
DataFlow::SourceNode getAnAliasedSourceNode(DataFlow::Node node) {
|
||||||
exists(DataFlow::SourceNode root, string accessPath |
|
exists(DataFlow::SourceNode root, string accessPath |
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes for working with HTML documents. */
|
/** Provides classes for working with HTML documents. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes for working with JSDoc comments. */
|
/** Provides classes for working with JSDoc comments. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides classes for working with JSON data.
|
* Provides classes for working with JSON data.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides classes for working with JSX code.
|
* Provides classes for working with JSX code.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* This information is only available for snapshots that have been extracted with
|
* This information is only available for snapshots that have been extracted with
|
||||||
* the `--extract-program-text` flag.
|
* the `--extract-program-text` flag.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes for working with locations and program elements that have locations. */
|
/** Provides classes for working with locations and program elements that have locations. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
@@ -32,7 +32,7 @@ final class Location extends @location_default {
|
|||||||
int getNumLines() { result = this.getEndLine() - this.getStartLine() + 1 }
|
int getNumLines() { result = this.getEndLine() - this.getStartLine() + 1 }
|
||||||
|
|
||||||
/** Holds if this location starts before location `that`. */
|
/** Holds if this location starts before location `that`. */
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
predicate startsBefore(Location that) {
|
predicate startsBefore(Location that) {
|
||||||
exists(string f, int sl1, int sc1, int sl2, int sc2 |
|
exists(string f, int sl1, int sc1, int sl2, int sc2 |
|
||||||
@@ -46,7 +46,7 @@ final class Location extends @location_default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if this location ends after location `that`. */
|
/** Holds if this location ends after location `that`. */
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
predicate endsAfter(Location that) {
|
predicate endsAfter(Location that) {
|
||||||
exists(string f, int el1, int ec1, int el2, int ec2 |
|
exists(string f, int el1, int ec1, int el2, int ec2 |
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* ECMAScript 2015-style modules, and the older CommonJS and AMD-style
|
* ECMAScript 2015-style modules, and the older CommonJS and AMD-style
|
||||||
* modules.
|
* modules.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ private import semmle.javascript.dataflow.internal.DataFlowNode
|
|||||||
* process.stdout.write(fs.readFileSync(process.argv[i], 'utf8'));
|
* process.stdout.write(fs.readFileSync(process.argv[i], 'utf8'));
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
class NodeModule extends Module {
|
class NodeModule extends Module {
|
||||||
NodeModule() {
|
NodeModule() {
|
||||||
is_module(this) and
|
is_module(this) and
|
||||||
@@ -234,7 +234,7 @@ predicate findNodeModulesFolder(Folder f, Folder nodeModules, int distance) {
|
|||||||
/**
|
/**
|
||||||
* A Node.js `require` variable.
|
* A Node.js `require` variable.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class RequireVariable extends Variable {
|
private class RequireVariable extends Variable {
|
||||||
RequireVariable() {
|
RequireVariable() {
|
||||||
this = any(ModuleScope m).getVariable("require")
|
this = any(ModuleScope m).getVariable("require")
|
||||||
@@ -247,7 +247,7 @@ private class RequireVariable extends Variable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private predicate isModuleModule(EarlyStageNode nd) {
|
private predicate isModuleModule(EarlyStageNode nd) {
|
||||||
exists(ImportDeclaration imp | imp.getRawImportPath() = "module" |
|
exists(ImportDeclaration imp | imp.getRawImportPath() = "module" |
|
||||||
nd = TDestructuredModuleImportNode(imp)
|
nd = TDestructuredModuleImportNode(imp)
|
||||||
@@ -261,7 +261,7 @@ private predicate isModuleModule(EarlyStageNode nd) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private predicate isCreateRequire(EarlyStageNode nd) {
|
private predicate isCreateRequire(EarlyStageNode nd) {
|
||||||
exists(PropAccess prop |
|
exists(PropAccess prop |
|
||||||
isModuleModule(TValueNode(prop.getBase())) and
|
isModuleModule(TValueNode(prop.getBase())) and
|
||||||
@@ -291,7 +291,7 @@ private predicate isCreateRequire(EarlyStageNode nd) {
|
|||||||
/**
|
/**
|
||||||
* Holds if `nd` may refer to `require`, either directly or modulo local data flow.
|
* Holds if `nd` may refer to `require`, either directly or modulo local data flow.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
cached
|
cached
|
||||||
private predicate isRequire(EarlyStageNode nd) {
|
private predicate isRequire(EarlyStageNode nd) {
|
||||||
exists(VarAccess access |
|
exists(VarAccess access |
|
||||||
@@ -334,7 +334,7 @@ private predicate isRequire(EarlyStageNode nd) {
|
|||||||
* require('fs')
|
* require('fs')
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
class Require extends CallExpr, Import {
|
class Require extends CallExpr, Import {
|
||||||
Require() { isRequire(TValueNode(this.getCallee())) }
|
Require() { isRequire(TValueNode(this.getCallee())) }
|
||||||
|
|
||||||
|
|||||||
@@ -186,13 +186,13 @@ module Promises {
|
|||||||
/**
|
/**
|
||||||
* Gets the pseudo-field used to describe resolved values in a promise.
|
* Gets the pseudo-field used to describe resolved values in a promise.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
string valueProp() { result = "$PromiseResolveField$" }
|
string valueProp() { result = "$PromiseResolveField$" }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the pseudo-field used to describe rejected values in a promise.
|
* Gets the pseudo-field used to describe rejected values in a promise.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
string errorProp() { result = "$PromiseRejectField$" }
|
string errorProp() { result = "$PromiseRejectField$" }
|
||||||
|
|
||||||
/** A property set containing the pseudo-properites of a promise object. */
|
/** A property set containing the pseudo-properites of a promise object. */
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Regular expression literals are represented as an abstract syntax tree of regular expression
|
* Regular expression literals are represented as an abstract syntax tree of regular expression
|
||||||
* terms.
|
* terms.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
* expression in `k` induces a re-capture of `x` to reflect the fact that `x`
|
* expression in `k` induces a re-capture of `x` to reflect the fact that `x`
|
||||||
* is incremented between the two `console.log` calls.
|
* is incremented between the two `console.log` calls.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes for working with statements. */
|
/** Provides classes for working with statements. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes for working with ECMAScript 2015-style template expressions. */
|
/** Provides classes for working with ECMAScript 2015-style template expressions. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides classes for working with the token-based representation of JavaScript programs.
|
* Provides classes for working with the token-based representation of JavaScript programs.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides classes for reasoning about type annotations independently of dialect.
|
* Provides classes for reasoning about type annotations independently of dialect.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes for modeling program variables. */
|
/** Provides classes for modeling program variables. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides classes and predicates for working with XML files and their content.
|
* Provides classes and predicates for working with XML files and their content.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import semmle.files.FileSystem
|
import semmle.files.FileSystem
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* YAML documents are represented as abstract syntax trees whose nodes
|
* YAML documents are represented as abstract syntax trees whose nodes
|
||||||
* are either YAML values or alias nodes referring to another YAML value.
|
* are either YAML values or alias nodes referring to another YAML value.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
* they represent; additionally, indefinite abstract values record
|
* they represent; additionally, indefinite abstract values record
|
||||||
* the source of imprecision that caused them to arise.
|
* the source of imprecision that caused them to arise.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript
|
private import javascript
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ private import semmle.javascript.internal.CachedStages
|
|||||||
* Note: For performance reasons, all subclasses of this class should be part
|
* Note: For performance reasons, all subclasses of this class should be part
|
||||||
* of the standard library. Use `isAdditionalFlowStep` for query-specific flow steps.
|
* of the standard library. Use `isAdditionalFlowStep` for query-specific flow steps.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
class AdditionalFlowStep extends Unit {
|
class AdditionalFlowStep extends Unit {
|
||||||
/**
|
/**
|
||||||
* Holds if `pred` → `succ` should be considered a value-preserving data flow edge.f
|
* Holds if `pred` → `succ` should be considered a value-preserving data flow edge.f
|
||||||
|
|||||||
@@ -625,19 +625,19 @@ abstract deprecated class LabeledBarrierGuardNode extends BarrierGuardNode {
|
|||||||
*
|
*
|
||||||
* For use with load/store steps in `DataFlow::SharedFlowStep` and TypeTracking.
|
* For use with load/store steps in `DataFlow::SharedFlowStep` and TypeTracking.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module PseudoProperties {
|
module PseudoProperties {
|
||||||
/** Holds if `s` is a pseudo-property. */
|
/** Holds if `s` is a pseudo-property. */
|
||||||
bindingset[s]
|
bindingset[s]
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
predicate isPseudoProperty(string s) { s.matches("$%$") }
|
predicate isPseudoProperty(string s) { s.matches("$%$") }
|
||||||
|
|
||||||
bindingset[s]
|
bindingset[s]
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
private string pseudoProperty(string s) { result = "$" + s + "$" }
|
private string pseudoProperty(string s) { result = "$" + s + "$" }
|
||||||
|
|
||||||
bindingset[s, v]
|
bindingset[s, v]
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
private string pseudoProperty(string s, string v) { result = "$" + s + "|" + v + "$" }
|
private string pseudoProperty(string s, string v) { result = "$" + s + "|" + v + "$" }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -684,7 +684,7 @@ module PseudoProperties {
|
|||||||
* Gets a pseudo-property for the location of a map value where the key is `key`.
|
* Gets a pseudo-property for the location of a map value where the key is `key`.
|
||||||
* The string value of the `key` is encoded in the result, and there is only a result if the string value of `key` is known.
|
* The string value of the `key` is encoded in the result, and there is only a result if the string value of `key` is known.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
string mapValueKnownKey(DataFlow::Node key) {
|
string mapValueKnownKey(DataFlow::Node key) {
|
||||||
result = mapValueKey(any(string s | key.mayHaveStringValue(s)))
|
result = mapValueKey(any(string s | key.mayHaveStringValue(s)))
|
||||||
@@ -694,20 +694,20 @@ module PseudoProperties {
|
|||||||
* Gets a pseudo-property for the location of a map value where the key is `key`.
|
* Gets a pseudo-property for the location of a map value where the key is `key`.
|
||||||
*/
|
*/
|
||||||
bindingset[key]
|
bindingset[key]
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
string mapValueKey(string key) { result = pseudoProperty("mapValue", key) }
|
string mapValueKey(string key) { result = pseudoProperty("mapValue", key) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if `prop` equals `mapValueKey(key)` for some value of `key`.
|
* Holds if `prop` equals `mapValueKey(key)` for some value of `key`.
|
||||||
*/
|
*/
|
||||||
bindingset[prop]
|
bindingset[prop]
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
predicate isMapValueKey(string prop) { prop.matches("$mapValue|%$") }
|
predicate isMapValueKey(string prop) { prop.matches("$mapValue|%$") }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a pseudo-property for the location of a map value where the key is `key`.
|
* Gets a pseudo-property for the location of a map value where the key is `key`.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
string mapValue(DataFlow::Node key) {
|
string mapValue(DataFlow::Node key) {
|
||||||
result = mapValueKnownKey(key)
|
result = mapValueKnownKey(key)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* For performance reasons, all subclasses of `CustomAbstractValueDefinition`
|
* For performance reasons, all subclasses of `CustomAbstractValueDefinition`
|
||||||
* should be part of the standard library.
|
* should be part of the standard library.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript
|
private import javascript
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
* Flow through global variables, object properties or function calls is not
|
* Flow through global variables, object properties or function calls is not
|
||||||
* modeled (except for immediately invoked functions as explained above).
|
* modeled (except for immediately invoked functions as explained above).
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** Provides classes and predicates for defining flow summaries. */
|
/** Provides classes and predicates for defining flow summaries. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript
|
private import javascript
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* as nodes corresponding to function definitions or nodes corresponding to
|
* as nodes corresponding to function definitions or nodes corresponding to
|
||||||
* parameters.
|
* parameters.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript
|
private import javascript
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
* so the refinement can evaluate to both `true` and `false` for the same
|
* so the refinement can evaluate to both `true` and `false` for the same
|
||||||
* candidate value.
|
* candidate value.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* Note that unlike `TypeTracking.qll`, this library only performs
|
* Note that unlike `TypeTracking.qll`, this library only performs
|
||||||
* local tracking within a function.
|
* local tracking within a function.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript
|
private import javascript
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Provides a representation for abstract values.
|
* Provides a representation for abstract values.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript
|
private import javascript
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* to the same value have the same access paths, so access paths are neither sound nor
|
* to the same value have the same access paths, so access paths are neither sound nor
|
||||||
* complete as an approximation of expression semantics.
|
* complete as an approximation of expression semantics.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ private import semmle.javascript.dataflow.internal.DataFlowPrivate
|
|||||||
/**
|
/**
|
||||||
* Gets a data-flow node synthesized using `AdditionalFlowInternal#needsSynthesizedNode`.
|
* Gets a data-flow node synthesized using `AdditionalFlowInternal#needsSynthesizedNode`.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
DataFlow::Node getSynthesizedNode(AstNode node, string tag) {
|
DataFlow::Node getSynthesizedNode(AstNode node, string tag) {
|
||||||
result = TGenericSynthesizedNode(node, tag, _)
|
result = TGenericSynthesizedNode(node, tag, _)
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ DataFlow::Node getSynthesizedNode(AstNode node, string tag) {
|
|||||||
/**
|
/**
|
||||||
* An extension to `AdditionalFlowStep` with additional internal-only predicates.
|
* An extension to `AdditionalFlowStep` with additional internal-only predicates.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
class AdditionalFlowInternal extends DataFlow::AdditionalFlowStep {
|
class AdditionalFlowInternal extends DataFlow::AdditionalFlowStep {
|
||||||
/**
|
/**
|
||||||
* Holds if a data-flow node should be synthesized for the pair `(node, tag)`.
|
* Holds if a data-flow node should be synthesized for the pair `(node, tag)`.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript
|
private import javascript
|
||||||
@@ -337,14 +337,14 @@ module Public {
|
|||||||
/**
|
/**
|
||||||
* A content set containing only the given content.
|
* A content set containing only the given content.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
ContentSet singleton(Content content) { result.asSingleton() = content }
|
ContentSet singleton(Content content) { result.asSingleton() = content }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A content set corresponding to the given property name.
|
* A content set corresponding to the given property name.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
ContentSet property(PropertyName name) { result.asSingleton().asPropertyName() = name }
|
ContentSet property(PropertyName name) { result.asSingleton().asPropertyName() = name }
|
||||||
|
|
||||||
@@ -405,7 +405,7 @@ module Public {
|
|||||||
* If `bound` is too large, it is truncated to the greatest lower bound we can represent.
|
* If `bound` is too large, it is truncated to the greatest lower bound we can represent.
|
||||||
*/
|
*/
|
||||||
bindingset[bound]
|
bindingset[bound]
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
ContentSet arrayElementLowerBoundFromInt(int bound) {
|
ContentSet arrayElementLowerBoundFromInt(int bound) {
|
||||||
result = arrayElementLowerBound(bound.minimum(getMaxPreciseArrayIndex() + 1))
|
result = arrayElementLowerBound(bound.minimum(getMaxPreciseArrayIndex() + 1))
|
||||||
}
|
}
|
||||||
@@ -416,7 +416,7 @@ module Public {
|
|||||||
* If `n` is too large, it is truncated to the greatest lower bound we can represent.
|
* If `n` is too large, it is truncated to the greatest lower bound we can represent.
|
||||||
*/
|
*/
|
||||||
bindingset[n]
|
bindingset[n]
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
ContentSet arrayElementFromInt(int n) {
|
ContentSet arrayElementFromInt(int n) {
|
||||||
result = arrayElementKnown(n)
|
result = arrayElementKnown(n)
|
||||||
or
|
or
|
||||||
@@ -456,7 +456,7 @@ module Public {
|
|||||||
* If `key` is not one of the keys we track precisely, this is mapped to the unknown key instead.
|
* If `key` is not one of the keys we track precisely, this is mapped to the unknown key instead.
|
||||||
*/
|
*/
|
||||||
bindingset[key]
|
bindingset[key]
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
ContentSet mapValueFromKey(string key) {
|
ContentSet mapValueFromKey(string key) {
|
||||||
result = mapValueWithKnownKey(key)
|
result = mapValueWithKnownKey(key)
|
||||||
or
|
or
|
||||||
@@ -519,7 +519,7 @@ module Public {
|
|||||||
* are mapped to their corresponding content sets (which are no longer seen as property names).
|
* are mapped to their corresponding content sets (which are no longer seen as property names).
|
||||||
*/
|
*/
|
||||||
bindingset[propertyName]
|
bindingset[propertyName]
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
ContentSet fromLegacyProperty(string propertyName) {
|
ContentSet fromLegacyProperty(string propertyName) {
|
||||||
result = fromLegacyPseudoProperty(propertyName)
|
result = fromLegacyPseudoProperty(propertyName)
|
||||||
or
|
or
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Contains the raw data type underlying `DataFlow::Node`.
|
* Contains the raw data type underlying `DataFlow::Node`.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript
|
private import javascript
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript
|
private import javascript
|
||||||
@@ -1108,7 +1108,7 @@ DataFlowCallable viableImplInCallContext(DataFlowCall call, DataFlowCall ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bindingset[node, fun]
|
bindingset[node, fun]
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline_late]
|
pragma[inline_late]
|
||||||
private predicate sameContainerAsEnclosingContainer(Node node, Function fun) {
|
private predicate sameContainerAsEnclosingContainer(Node node, Function fun) {
|
||||||
node.getContainer() = fun.getEnclosingContainer()
|
node.getContainer() = fun.getEnclosingContainer()
|
||||||
@@ -1517,7 +1517,7 @@ private Node getPostUpdateForStore(Node base) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Gets node to target with a store to the given `base` object.. */
|
/** Gets node to target with a store to the given `base` object.. */
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
private Node getStoreTarget(DataFlow::Node base) {
|
private Node getStoreTarget(DataFlow::Node base) {
|
||||||
result = getPostUpdateForStore(base)
|
result = getPostUpdateForStore(base)
|
||||||
|
|||||||
@@ -524,7 +524,7 @@ private module CachedSteps {
|
|||||||
/**
|
/**
|
||||||
* Holds if there is a step from `pred` to `succ` through a call to an identity function.
|
* Holds if there is a step from `pred` to `succ` through a call to an identity function.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
cached
|
cached
|
||||||
predicate identityFunctionStep(DataFlow::Node pred, DataFlow::CallNode succ) {
|
predicate identityFunctionStep(DataFlow::Node pred, DataFlow::CallNode succ) {
|
||||||
exists(DataFlow::GlobalVarRefNode global |
|
exists(DataFlow::GlobalVarRefNode global |
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides JS specific classes and predicates for defining flow summaries.
|
* Provides JS specific classes and predicates for defining flow summaries.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript
|
private import javascript
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript as js
|
private import javascript as js
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript
|
private import javascript
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* JavaScript's old SSA library is still responsible for the ordinary SSA flow.
|
* JavaScript's old SSA library is still responsible for the ordinary SSA flow.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript as js
|
private import javascript as js
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ private import AngularJS
|
|||||||
/**
|
/**
|
||||||
* Holds if `nd` is a reference to the `angular` variable.
|
* Holds if `nd` is a reference to the `angular` variable.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
DataFlow::SourceNode angular() {
|
DataFlow::SourceNode angular() {
|
||||||
// either as a global
|
// either as a global
|
||||||
result = DataFlow::globalVarRef("angular")
|
result = DataFlow::globalVarRef("angular")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Models imports through the NPM `lazy-cache` package.
|
* Models imports through the NPM `lazy-cache` package.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ module LodashUnderscore {
|
|||||||
/**
|
/**
|
||||||
* A data flow node that accesses a given member of `lodash` or `underscore`.
|
* A data flow node that accesses a given member of `lodash` or `underscore`.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
abstract class Member extends DataFlow::SourceNode {
|
abstract class Member extends DataFlow::SourceNode {
|
||||||
/** Gets the name of the accessed member. */
|
/** Gets the name of the accessed member. */
|
||||||
abstract string getName();
|
abstract string getName();
|
||||||
@@ -18,7 +18,7 @@ module LodashUnderscore {
|
|||||||
/**
|
/**
|
||||||
* An import of `lodash` or `underscore` accessing a given member of that package.
|
* An import of `lodash` or `underscore` accessing a given member of that package.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class DefaultMember extends Member {
|
private class DefaultMember extends Member {
|
||||||
string name;
|
string name;
|
||||||
|
|
||||||
@@ -41,14 +41,14 @@ module LodashUnderscore {
|
|||||||
* In addition to normal imports, this supports per-method imports such as `require("lodash.map")` and `require("lodash/map")`.
|
* In addition to normal imports, this supports per-method imports such as `require("lodash.map")` and `require("lodash/map")`.
|
||||||
* In addition, the global variable `_` is assumed to refer to `lodash` or `underscore`.
|
* In addition, the global variable `_` is assumed to refer to `lodash` or `underscore`.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
DataFlow::SourceNode member(string name) { result.(Member).getName() = name }
|
DataFlow::SourceNode member(string name) { result.(Member).getName() = name }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if `name` is the name of a member exported from the `lodash` package
|
* Holds if `name` is the name of a member exported from the `lodash` package
|
||||||
* which has a corresponding `lodash.xxx` NPM package.
|
* which has a corresponding `lodash.xxx` NPM package.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private predicate isLodashMember(string name) {
|
private predicate isLodashMember(string name) {
|
||||||
// Can be generated using Object.keys(require('lodash'))
|
// Can be generated using Object.keys(require('lodash'))
|
||||||
name =
|
name =
|
||||||
@@ -185,7 +185,7 @@ module LodashUnderscore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class LodashEach extends DataFlow::SummarizedCallable {
|
private class LodashEach extends DataFlow::SummarizedCallable {
|
||||||
LodashEach() { this = "_.each-like" }
|
LodashEach() { this = "_.each-like" }
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ module LodashUnderscore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class LodashMap extends DataFlow::SummarizedCallable {
|
private class LodashMap extends DataFlow::SummarizedCallable {
|
||||||
LodashMap() { this = "_.map" }
|
LodashMap() { this = "_.map" }
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ module LodashUnderscore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class LodashFlatMap extends DataFlow::SummarizedCallable {
|
private class LodashFlatMap extends DataFlow::SummarizedCallable {
|
||||||
LodashFlatMap() { this = "_.flatMap" }
|
LodashFlatMap() { this = "_.flatMap" }
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ module LodashUnderscore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class LodashFlatMapDeep extends DataFlow::SummarizedCallable {
|
private class LodashFlatMapDeep extends DataFlow::SummarizedCallable {
|
||||||
LodashFlatMapDeep() { this = "_.flatMapDeep" }
|
LodashFlatMapDeep() { this = "_.flatMapDeep" }
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ module LodashUnderscore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class LodashReduce extends DataFlow::SummarizedCallable {
|
private class LodashReduce extends DataFlow::SummarizedCallable {
|
||||||
LodashReduce() { this = "_.reduce-like" }
|
LodashReduce() { this = "_.reduce-like" }
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ module LodashUnderscore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class LoashSortBy extends DataFlow::SummarizedCallable {
|
private class LoashSortBy extends DataFlow::SummarizedCallable {
|
||||||
LoashSortBy() { this = "_.sortBy-like" }
|
LoashSortBy() { this = "_.sortBy-like" }
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ module LodashUnderscore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class LodashMinMaxBy extends DataFlow::SummarizedCallable {
|
private class LodashMinMaxBy extends DataFlow::SummarizedCallable {
|
||||||
LodashMinMaxBy() { this = "_.minBy / _.maxBy" }
|
LodashMinMaxBy() { this = "_.minBy / _.maxBy" }
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ module LodashUnderscore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class LodashPartition extends DataFlow::SummarizedCallable {
|
private class LodashPartition extends DataFlow::SummarizedCallable {
|
||||||
LodashPartition() { this = "_.partition" }
|
LodashPartition() { this = "_.partition" }
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ module LodashUnderscore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class UnderscoreMapObject extends DataFlow::SummarizedCallable {
|
private class UnderscoreMapObject extends DataFlow::SummarizedCallable {
|
||||||
UnderscoreMapObject() { this = "_.mapObject" }
|
UnderscoreMapObject() { this = "_.mapObject" }
|
||||||
|
|
||||||
@@ -352,7 +352,7 @@ module LodashUnderscore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class LodashTap extends DataFlow::SummarizedCallable {
|
private class LodashTap extends DataFlow::SummarizedCallable {
|
||||||
LodashTap() { this = "_.tap" }
|
LodashTap() { this = "_.tap" }
|
||||||
|
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ import semmle.javascript.security.SensitiveActions
|
|||||||
private import semmle.javascript.dataflow.internal.PreCallGraphStep
|
private import semmle.javascript.dataflow.internal.PreCallGraphStep
|
||||||
|
|
||||||
module NodeJSLib {
|
module NodeJSLib {
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private GlobalVariable processVariable() { variables(result, "process", any(GlobalScope sc)) }
|
private GlobalVariable processVariable() { variables(result, "process", any(GlobalScope sc)) }
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private GlobalVarAccess processExprInTopLevel(TopLevel tl) {
|
private GlobalVarAccess processExprInTopLevel(TopLevel tl) {
|
||||||
result = processVariable().getAnAccess() and
|
result = processVariable().getAnAccess() and
|
||||||
tl = result.getTopLevel()
|
tl = result.getTopLevel()
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private GlobalVarAccess processExprInNodeModule() {
|
private GlobalVarAccess processExprInNodeModule() {
|
||||||
result = processExprInTopLevel(any(NodeModule m))
|
result = processExprInTopLevel(any(NodeModule m))
|
||||||
@@ -28,7 +28,7 @@ module NodeJSLib {
|
|||||||
* An access to the global `process` variable in a Node.js module, interpreted as
|
* An access to the global `process` variable in a Node.js module, interpreted as
|
||||||
* an import of the `process` module.
|
* an import of the `process` module.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class ImplicitProcessImport extends DataFlow::ModuleImportNode::Range {
|
private class ImplicitProcessImport extends DataFlow::ModuleImportNode::Range {
|
||||||
ImplicitProcessImport() { this = DataFlow::exprNode(processExprInNodeModule()) }
|
ImplicitProcessImport() { this = DataFlow::exprNode(processExprInNodeModule()) }
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Subclass `PropertyProjection` to refine the behavior of the analysis on existing property projections.
|
* Subclass `PropertyProjection` to refine the behavior of the analysis on existing property projections.
|
||||||
* Subclass `CustomPropertyProjection` to introduce new kinds of property projections.
|
* Subclass `CustomPropertyProjection` to introduce new kinds of property projections.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides predicates for working with templating libraries.
|
* Provides predicates for working with templating libraries.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ private module ClosureLibraryUri {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class QueryStringStringification extends DataFlow::SummarizedCallable {
|
private class QueryStringStringification extends DataFlow::SummarizedCallable {
|
||||||
QueryStringStringification() { this = "query-string stringification" }
|
QueryStringStringification() { this = "query-string stringification" }
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ private class ThreatModelSourceFromDataExtension extends ThreatModelSource::Rang
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private class SummarizedCallableFromModel extends DataFlow::SummarizedCallable {
|
private class SummarizedCallableFromModel extends DataFlow::SummarizedCallable {
|
||||||
string type;
|
string type;
|
||||||
string path;
|
string path;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Defines extensible predicates for contributing library models from data extensions.
|
* Defines extensible predicates for contributing library models from data extensions.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Location = JS::Location;
|
|||||||
* The model generator must explicitly generate the step between `(package)` and `(package).foo`, for example.
|
* The model generator must explicitly generate the step between `(package)` and `(package).foo`, for example.
|
||||||
*/
|
*/
|
||||||
bindingset[rawType]
|
bindingset[rawType]
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
predicate parseTypeString(string rawType, string package, string qualifiedName) {
|
predicate parseTypeString(string rawType, string package, string qualifiedName) {
|
||||||
exists(string regexp |
|
exists(string regexp |
|
||||||
regexp = "('[^']+'|[^.]+)(.*)" and
|
regexp = "('[^']+'|[^.]+)(.*)" and
|
||||||
@@ -56,7 +56,7 @@ predicate parseTypeString(string rawType, string package, string qualifiedName)
|
|||||||
/**
|
/**
|
||||||
* Holds if models describing `package` may be relevant for the analysis of this database.
|
* Holds if models describing `package` may be relevant for the analysis of this database.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
predicate isPackageUsed(string package) {
|
predicate isPackageUsed(string package) {
|
||||||
package = "global"
|
package = "global"
|
||||||
or
|
or
|
||||||
@@ -70,7 +70,7 @@ predicate isPackageUsed(string package) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bindingset[type]
|
bindingset[type]
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
predicate isTypeUsed(string type) {
|
predicate isTypeUsed(string type) {
|
||||||
exists(string package |
|
exists(string package |
|
||||||
parseTypeString(type, package, _) and
|
parseTypeString(type, package, _) and
|
||||||
@@ -82,10 +82,10 @@ predicate isTypeUsed(string type) {
|
|||||||
* Holds if `type` can be obtained from an instance of `otherType` due to
|
* Holds if `type` can be obtained from an instance of `otherType` due to
|
||||||
* language semantics modeled by `getExtraNodeFromType`.
|
* language semantics modeled by `getExtraNodeFromType`.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
predicate hasImplicitTypeModel(string type, string otherType) { none() }
|
predicate hasImplicitTypeModel(string type, string otherType) { none() }
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate parseRelevantTypeString(string rawType, string package, string qualifiedName) {
|
private predicate parseRelevantTypeString(string rawType, string package, string qualifiedName) {
|
||||||
isRelevantFullPath(rawType, _) and
|
isRelevantFullPath(rawType, _) and
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Provides classes for working with basic blocks, and predicates for computing
|
* Provides classes for working with basic blocks, and predicates for computing
|
||||||
* liveness information for local variables.
|
* liveness information for local variables.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
import javascript
|
import javascript
|
||||||
@@ -320,7 +320,7 @@ module Public {
|
|||||||
/**
|
/**
|
||||||
* Holds if this basic block strictly dominates `bb`.
|
* Holds if this basic block strictly dominates `bb`.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
predicate strictlyDominates(ReachableBasicBlock bb) { this = immediateDominator+(bb) }
|
predicate strictlyDominates(ReachableBasicBlock bb) { this = immediateDominator+(bb) }
|
||||||
|
|
||||||
@@ -329,14 +329,14 @@ module Public {
|
|||||||
*
|
*
|
||||||
* This predicate is reflexive: each reachable basic block dominates itself.
|
* This predicate is reflexive: each reachable basic block dominates itself.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
predicate dominates(ReachableBasicBlock bb) { this = immediateDominator*(bb) }
|
predicate dominates(ReachableBasicBlock bb) { this = immediateDominator*(bb) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this basic block strictly post-dominates `bb`.
|
* Holds if this basic block strictly post-dominates `bb`.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
predicate strictlyPostDominates(ReachableBasicBlock bb) { this = immediatePostDominator+(bb) }
|
predicate strictlyPostDominates(ReachableBasicBlock bb) { this = immediatePostDominator+(bb) }
|
||||||
|
|
||||||
@@ -345,7 +345,7 @@ module Public {
|
|||||||
*
|
*
|
||||||
* This predicate is reflexive: each reachable basic block post-dominates itself.
|
* This predicate is reflexive: each reachable basic block post-dominates itself.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
predicate postDominates(ReachableBasicBlock bb) { this = immediatePostDominator*(bb) }
|
predicate postDominates(ReachableBasicBlock bb) { this = immediatePostDominator*(bb) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ module Stages {
|
|||||||
/**
|
/**
|
||||||
* The `ast` stage.
|
* The `ast` stage.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
cached
|
cached
|
||||||
module Ast {
|
module Ast {
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +85,7 @@ module Stages {
|
|||||||
/**
|
/**
|
||||||
* The `basicblocks` stage.
|
* The `basicblocks` stage.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
cached
|
cached
|
||||||
module BasicBlocks {
|
module BasicBlocks {
|
||||||
/**
|
/**
|
||||||
@@ -112,7 +112,7 @@ module Stages {
|
|||||||
/**
|
/**
|
||||||
* The part of data flow computed before flow summary nodes.
|
* The part of data flow computed before flow summary nodes.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
cached
|
cached
|
||||||
module EarlyDataFlowStage {
|
module EarlyDataFlowStage {
|
||||||
/**
|
/**
|
||||||
@@ -137,7 +137,7 @@ module Stages {
|
|||||||
/**
|
/**
|
||||||
* The `dataflow` stage.
|
* The `dataflow` stage.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
cached
|
cached
|
||||||
module DataFlowStage {
|
module DataFlowStage {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ private import javascript
|
|||||||
private import OverlayXml
|
private import OverlayXml
|
||||||
|
|
||||||
/** Holds if the database is an overlay. */
|
/** Holds if the database is an overlay. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private predicate isOverlay() { databaseMetadata("isOverlay", "true") }
|
private predicate isOverlay() { databaseMetadata("isOverlay", "true") }
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private string getFileFromEntity(@locatable node) {
|
private string getFileFromEntity(@locatable node) {
|
||||||
exists(@location loc |
|
exists(@location loc |
|
||||||
hasLocation(node, loc)
|
hasLocation(node, loc)
|
||||||
@@ -19,11 +19,11 @@ private string getFileFromEntity(@locatable node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if `file` was changed or deleted in the overlay. */
|
/** Holds if `file` was changed or deleted in the overlay. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private predicate discardFile(string file) { isOverlay() and overlayChangedFiles(file) }
|
private predicate discardFile(string file) { isOverlay() and overlayChangedFiles(file) }
|
||||||
|
|
||||||
/** Holds if `node` is in the `file` and is part of the overlay base database. */
|
/** Holds if `node` is in the `file` and is part of the overlay base database. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private predicate discardableEntity(string file, @locatable node) {
|
private predicate discardableEntity(string file, @locatable node) {
|
||||||
not isOverlay() and file = getFileFromEntity(node)
|
not isOverlay() and file = getFileFromEntity(node)
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ private predicate discardEntity(@locatable node) {
|
|||||||
exists(string file | discardableEntity(file, node) and discardFile(file))
|
exists(string file | discardableEntity(file, node) and discardFile(file))
|
||||||
}
|
}
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private string getFileFromLocation(@location loc) {
|
private string getFileFromLocation(@location loc) {
|
||||||
exists(@file file |
|
exists(@file file |
|
||||||
locations_default(loc, file, _, _, _, _) and
|
locations_default(loc, file, _, _, _, _) and
|
||||||
@@ -43,7 +43,7 @@ private string getFileFromLocation(@location loc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if `loc` is in the `file` and is part of the overlay base database. */
|
/** Holds if `loc` is in the `file` and is part of the overlay base database. */
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
private predicate discardableLocation(string file, @location node) {
|
private predicate discardableLocation(string file, @location node) {
|
||||||
not isOverlay() and file = getFileFromLocation(node)
|
not isOverlay() and file = getFileFromLocation(node)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Provides predicates and classes for relating nodes to their
|
* Provides predicates and classes for relating nodes to their
|
||||||
* enclosing `StmtContainer`.
|
* enclosing `StmtContainer`.
|
||||||
*/
|
*/
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
module;
|
module;
|
||||||
|
|
||||||
private import javascript
|
private import javascript
|
||||||
@@ -48,7 +48,7 @@ class NodeInStmtContainer extends Locatable, @node_in_stmt_container {
|
|||||||
/**
|
/**
|
||||||
* Gets the function or toplevel to which this node belongs.
|
* Gets the function or toplevel to which this node belongs.
|
||||||
*/
|
*/
|
||||||
overlay[caller]
|
overlay[caller?]
|
||||||
pragma[inline]
|
pragma[inline]
|
||||||
final StmtContainer getContainer() { result = getStmtContainer(this) }
|
final StmtContainer getContainer() { result = getStmtContainer(this) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import javascript
|
import javascript
|
||||||
import semmle.javascript.dataflow.FlowSummary
|
import semmle.javascript.dataflow.FlowSummary
|
||||||
|
|
||||||
overlay[local]
|
overlay[local?]
|
||||||
class MkSummary extends SummarizedCallable {
|
class MkSummary extends SummarizedCallable {
|
||||||
private CallExpr mkSummary;
|
private CallExpr mkSummary;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user