diff --git a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll index 3d180ad2c3b..f48f7b96dea 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll +++ b/javascript/ql/experimental/adaptivethreatmodeling/lib/experimental/adaptivethreatmodeling/EndpointFeatures.qll @@ -231,6 +231,7 @@ private newtype TEndpointFeature = TCalleeAccessPathWithStructuralInfo() or TEnclosingFunctionBody() or TFileImports() or + TCalleeImports() or TCalleeFlexibleAccessPath() or TInputAccessPathFromCallee() or TInputArgumentIndex() @@ -411,7 +412,21 @@ class EnclosingFunctionBody extends EndpointFeature, TEnclosingFunctionBody { } } -/** The feature for the imports defined in the file containing an endpoint. */ +/** + * The feature for the imports defined in the file containing an endpoint. + * + * ### Example + * + * ```javascript + * import { findOne } from 'mongoose'; + * import * as _ from 'lodash'; + * const pg = require('pg'); + * + * // ... + * ``` + * + * In this file, all endpoints will have the value `lodash mongoose pg` for the feature `fileImports`. + */ class FileImports extends EndpointFeature, TFileImports { override string getName() { result = "fileImports" } @@ -425,6 +440,28 @@ class FileImports extends EndpointFeature, TFileImports { } } +class CalleeImports extends EndpointFeature, TCalleeImports { + override string getName() { result = "calleeImports" } + + override string getValue(DataFlow::Node endpoint) { + not result = SyntacticUtilities::getUnknownSymbol() and + exists(DataFlow::InvokeNode invk | + ( + invk.getAnArgument() = endpoint or + SyntacticUtilities::getANestedInitializerValue(invk.getAnArgument() + .asExpr() + .getUnderlyingValue()).flow() = endpoint + ) and + result = + concat(string importPath | + importPath = SyntacticUtilities::getCalleeImportPath(invk.getCalleeNode()) + | + importPath, " " order by importPath + ) + ) + } +} + /** * Syntactic utilities for feature value computation. */ @@ -476,6 +513,31 @@ private module SyntacticUtilities { else result = getUnknownSymbol() } + /** + * Gets the imported package path that this node depends on, if any. + * + * Otherwise, returns '?'. + * + * XXX Be careful with using this in your features, as it might teach the model + * a fixed list of "dangerous" libraries that could lead to bad generalization. + */ + string getCalleeImportPath(DataFlow::Node node) { + exists(DataFlow::Node src | src = node.getALocalSource() | + if src instanceof DataFlow::ModuleImportNode + then result = src.(DataFlow::ModuleImportNode).getPath() + else + if src instanceof DataFlow::PropRead + then result = getCalleeImportPath(src.(DataFlow::PropRead).getBase()) + else + if src instanceof DataFlow::InvokeNode + then result = getCalleeImportPath(src.(DataFlow::InvokeNode).getCalleeNode()) + else + if src.asExpr() instanceof AwaitExpr + then result = getCalleeImportPath(src.asExpr().(AwaitExpr).getOperand().flow()) + else result = getUnknownSymbol() + ) + } + /** * Computes a simple access path for a node. * diff --git a/javascript/ql/experimental/adaptivethreatmodeling/test/generic_feature_testing/FeatureValue.expected b/javascript/ql/experimental/adaptivethreatmodeling/test/generic_feature_testing/FeatureValue.expected index cfc8c21f761..bb897cbaeb5 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/test/generic_feature_testing/FeatureValue.expected +++ b/javascript/ql/experimental/adaptivethreatmodeling/test/generic_feature_testing/FeatureValue.expected @@ -5,123 +5,154 @@ | test.html:2:61:2:68 | endpoint | calleeAccessPathWithStructuralInfo | | | test.html:2:61:2:68 | endpoint | calleeName | item | | test.html:2:61:2:68 | endpoint | fileImports | | -| test.js:2:7:2:14 | endpoint | CalleeFlexibleAccessPath | f | -| test.js:2:7:2:14 | endpoint | InputArgumentIndex | 0 | -| test.js:2:7:2:14 | endpoint | argumentIndex | 0 | -| test.js:2:7:2:14 | endpoint | calleeAccessPath | | -| test.js:2:7:2:14 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:2:7:2:14 | endpoint | calleeName | f | -| test.js:2:7:2:14 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:2:7:2:14 | endpoint | enclosingFunctionName | | -| test.js:2:7:2:14 | endpoint | fileImports | foo | -| test.js:3:11:3:18 | endpoint | CalleeFlexibleAccessPath | f | -| test.js:3:11:3:18 | endpoint | InputAccessPathFromCallee | 0.p | -| test.js:3:11:3:18 | endpoint | InputArgumentIndex | 0 | -| test.js:3:11:3:18 | endpoint | calleeAccessPath | | -| test.js:3:11:3:18 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:3:11:3:18 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:3:11:3:18 | endpoint | enclosingFunctionName | | -| test.js:3:11:3:18 | endpoint | fileImports | foo | -| test.js:4:15:4:22 | endpoint | CalleeFlexibleAccessPath | f | -| test.js:4:15:4:22 | endpoint | InputAccessPathFromCallee | 0.p.q | -| test.js:4:15:4:22 | endpoint | InputArgumentIndex | 0 | -| test.js:4:15:4:22 | endpoint | calleeAccessPath | | -| test.js:4:15:4:22 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:4:15:4:22 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:4:15:4:22 | endpoint | enclosingFunctionName | | -| test.js:4:15:4:22 | endpoint | fileImports | foo | -| test.js:5:9:5:16 | endpoint | CalleeFlexibleAccessPath | o.m | -| test.js:5:9:5:16 | endpoint | InputArgumentIndex | 0 | -| test.js:5:9:5:16 | endpoint | argumentIndex | 0 | -| test.js:5:9:5:16 | endpoint | calleeAccessPath | | -| test.js:5:9:5:16 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:5:9:5:16 | endpoint | calleeName | m | -| test.js:5:9:5:16 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:5:9:5:16 | endpoint | enclosingFunctionName | | -| test.js:5:9:5:16 | endpoint | fileImports | foo | -| test.js:5:9:5:16 | endpoint | receiverName | o | -| test.js:6:13:6:20 | endpoint | CalleeFlexibleAccessPath | o.m | -| test.js:6:13:6:20 | endpoint | InputAccessPathFromCallee | 0.p | -| test.js:6:13:6:20 | endpoint | InputArgumentIndex | 0 | -| test.js:6:13:6:20 | endpoint | calleeAccessPath | | -| test.js:6:13:6:20 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:6:13:6:20 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:6:13:6:20 | endpoint | enclosingFunctionName | | -| test.js:6:13:6:20 | endpoint | fileImports | foo | -| test.js:7:17:7:24 | endpoint | CalleeFlexibleAccessPath | o.m | -| test.js:7:17:7:24 | endpoint | InputAccessPathFromCallee | 0.p.q | -| test.js:7:17:7:24 | endpoint | InputArgumentIndex | 0 | -| test.js:7:17:7:24 | endpoint | calleeAccessPath | | -| test.js:7:17:7:24 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:7:17:7:24 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:7:17:7:24 | endpoint | enclosingFunctionName | | -| test.js:7:17:7:24 | endpoint | fileImports | foo | -| test.js:8:11:8:18 | endpoint | CalleeFlexibleAccessPath | F | -| test.js:8:11:8:18 | endpoint | InputArgumentIndex | 0 | -| test.js:8:11:8:18 | endpoint | calleeAccessPath | | -| test.js:8:11:8:18 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:8:11:8:18 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:8:11:8:18 | endpoint | enclosingFunctionName | | -| test.js:8:11:8:18 | endpoint | fileImports | foo | -| test.js:9:17:9:24 | endpoint | CalleeFlexibleAccessPath | o.m().m().m | -| test.js:9:17:9:24 | endpoint | InputArgumentIndex | 0 | -| test.js:9:17:9:24 | endpoint | argumentIndex | 0 | -| test.js:9:17:9:24 | endpoint | calleeAccessPath | | -| test.js:9:17:9:24 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:9:17:9:24 | endpoint | calleeName | m | -| test.js:9:17:9:24 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:9:17:9:24 | endpoint | enclosingFunctionName | | -| test.js:9:17:9:24 | endpoint | fileImports | foo | -| test.js:10:9:10:16 | endpoint | CalleeFlexibleAccessPath | f() | -| test.js:10:9:10:16 | endpoint | InputArgumentIndex | 0 | -| test.js:10:9:10:16 | endpoint | argumentIndex | 0 | -| test.js:10:9:10:16 | endpoint | calleeAccessPath | | -| test.js:10:9:10:16 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:10:9:10:16 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:10:9:10:16 | endpoint | enclosingFunctionName | | -| test.js:10:9:10:16 | endpoint | fileImports | foo | -| test.js:11:12:11:19 | endpoint | CalleeFlexibleAccessPath | o.?.m | -| test.js:11:12:11:19 | endpoint | InputArgumentIndex | 0 | -| test.js:11:12:11:19 | endpoint | argumentIndex | 0 | -| test.js:11:12:11:19 | endpoint | calleeAccessPath | | -| test.js:11:12:11:19 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:11:12:11:19 | endpoint | calleeName | m | -| test.js:11:12:11:19 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:11:12:11:19 | endpoint | enclosingFunctionName | | -| test.js:11:12:11:19 | endpoint | fileImports | foo | -| test.js:12:16:12:23 | endpoint | CalleeFlexibleAccessPath | o.m.?.p.m | -| test.js:12:16:12:23 | endpoint | InputArgumentIndex | 0 | -| test.js:12:16:12:23 | endpoint | argumentIndex | 0 | -| test.js:12:16:12:23 | endpoint | calleeAccessPath | | -| test.js:12:16:12:23 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:12:16:12:23 | endpoint | calleeName | m | -| test.js:12:16:12:23 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:12:16:12:23 | endpoint | enclosingFunctionName | | -| test.js:12:16:12:23 | endpoint | fileImports | foo | -| test.js:13:15:13:22 | endpoint | CalleeFlexibleAccessPath | (await p) | -| test.js:13:15:13:22 | endpoint | InputArgumentIndex | 0 | -| test.js:13:15:13:22 | endpoint | argumentIndex | 0 | -| test.js:13:15:13:22 | endpoint | calleeAccessPath | | -| test.js:13:15:13:22 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:13:15:13:22 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:13:15:13:22 | endpoint | enclosingFunctionName | | -| test.js:13:15:13:22 | endpoint | fileImports | foo | -| test.js:14:27:14:34 | endpoint | CalleeFlexibleAccessPath | import(!).bar.baz | -| test.js:14:27:14:34 | endpoint | InputArgumentIndex | 0 | -| test.js:14:27:14:34 | endpoint | argumentIndex | 0 | -| test.js:14:27:14:34 | endpoint | calleeAccessPath | foo bar baz | -| test.js:14:27:14:34 | endpoint | calleeAccessPathWithStructuralInfo | foo member bar member baz instanceorreturn | -| test.js:14:27:14:34 | endpoint | calleeApiName | foo | -| test.js:14:27:14:34 | endpoint | calleeName | baz | -| test.js:14:27:14:34 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:14:27:14:34 | endpoint | enclosingFunctionName | | -| test.js:14:27:14:34 | endpoint | fileImports | foo | -| test.js:16:13:16:20 | endpoint | CalleeFlexibleAccessPath | bar | -| test.js:16:13:16:20 | endpoint | InputArgumentIndex | 0 | -| test.js:16:13:16:20 | endpoint | argumentIndex | 0 | -| test.js:16:13:16:20 | endpoint | calleeAccessPath | | -| test.js:16:13:16:20 | endpoint | calleeAccessPathWithStructuralInfo | | -| test.js:16:13:16:20 | endpoint | calleeName | bar | -| test.js:16:13:16:20 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint | -| test.js:16:13:16:20 | endpoint | enclosingFunctionName | | -| test.js:16:13:16:20 | endpoint | fileImports | foo | +| test.js:6:7:6:14 | endpoint | CalleeFlexibleAccessPath | f | +| test.js:6:7:6:14 | endpoint | InputArgumentIndex | 0 | +| test.js:6:7:6:14 | endpoint | argumentIndex | 0 | +| test.js:6:7:6:14 | endpoint | calleeAccessPath | lib3 | +| test.js:6:7:6:14 | endpoint | calleeAccessPathWithStructuralInfo | lib3 instanceorreturn | +| test.js:6:7:6:14 | endpoint | calleeApiName | lib3 | +| test.js:6:7:6:14 | endpoint | calleeImports | lib3 | +| test.js:6:7:6:14 | endpoint | calleeName | f | +| test.js:6:7:6:14 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:6:7:6:14 | endpoint | enclosingFunctionName | | +| test.js:6:7:6:14 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:7:11:7:18 | endpoint | CalleeFlexibleAccessPath | f | +| test.js:7:11:7:18 | endpoint | InputAccessPathFromCallee | 0.p | +| test.js:7:11:7:18 | endpoint | InputArgumentIndex | 0 | +| test.js:7:11:7:18 | endpoint | calleeAccessPath | | +| test.js:7:11:7:18 | endpoint | calleeAccessPathWithStructuralInfo | | +| test.js:7:11:7:18 | endpoint | calleeImports | lib3 | +| test.js:7:11:7:18 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:7:11:7:18 | endpoint | enclosingFunctionName | | +| test.js:7:11:7:18 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:8:15:8:22 | endpoint | CalleeFlexibleAccessPath | f | +| test.js:8:15:8:22 | endpoint | InputAccessPathFromCallee | 0.p.q | +| test.js:8:15:8:22 | endpoint | InputArgumentIndex | 0 | +| test.js:8:15:8:22 | endpoint | calleeAccessPath | | +| test.js:8:15:8:22 | endpoint | calleeAccessPathWithStructuralInfo | | +| test.js:8:15:8:22 | endpoint | calleeImports | lib3 | +| test.js:8:15:8:22 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:8:15:8:22 | endpoint | enclosingFunctionName | | +| test.js:8:15:8:22 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:9:9:9:16 | endpoint | CalleeFlexibleAccessPath | o.m | +| test.js:9:9:9:16 | endpoint | InputArgumentIndex | 0 | +| test.js:9:9:9:16 | endpoint | argumentIndex | 0 | +| test.js:9:9:9:16 | endpoint | calleeAccessPath | lib2 m | +| test.js:9:9:9:16 | endpoint | calleeAccessPathWithStructuralInfo | lib2 member m instanceorreturn | +| test.js:9:9:9:16 | endpoint | calleeApiName | lib2 | +| test.js:9:9:9:16 | endpoint | calleeImports | lib2 | +| test.js:9:9:9:16 | endpoint | calleeName | m | +| test.js:9:9:9:16 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:9:9:9:16 | endpoint | enclosingFunctionName | | +| test.js:9:9:9:16 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:9:9:9:16 | endpoint | receiverName | o | +| test.js:10:13:10:20 | endpoint | CalleeFlexibleAccessPath | o.m | +| test.js:10:13:10:20 | endpoint | InputAccessPathFromCallee | 0.p | +| test.js:10:13:10:20 | endpoint | InputArgumentIndex | 0 | +| test.js:10:13:10:20 | endpoint | calleeAccessPath | | +| test.js:10:13:10:20 | endpoint | calleeAccessPathWithStructuralInfo | | +| test.js:10:13:10:20 | endpoint | calleeImports | lib2 | +| test.js:10:13:10:20 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:10:13:10:20 | endpoint | enclosingFunctionName | | +| test.js:10:13:10:20 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:11:17:11:24 | endpoint | CalleeFlexibleAccessPath | o.m | +| test.js:11:17:11:24 | endpoint | InputAccessPathFromCallee | 0.p.q | +| test.js:11:17:11:24 | endpoint | InputArgumentIndex | 0 | +| test.js:11:17:11:24 | endpoint | calleeAccessPath | | +| test.js:11:17:11:24 | endpoint | calleeAccessPathWithStructuralInfo | | +| test.js:11:17:11:24 | endpoint | calleeImports | lib2 | +| test.js:11:17:11:24 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:11:17:11:24 | endpoint | enclosingFunctionName | | +| test.js:11:17:11:24 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:12:11:12:18 | endpoint | CalleeFlexibleAccessPath | F | +| test.js:12:11:12:18 | endpoint | InputArgumentIndex | 0 | +| test.js:12:11:12:18 | endpoint | calleeAccessPath | | +| test.js:12:11:12:18 | endpoint | calleeAccessPathWithStructuralInfo | | +| test.js:12:11:12:18 | endpoint | calleeImports | lib1 | +| test.js:12:11:12:18 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:12:11:12:18 | endpoint | enclosingFunctionName | | +| test.js:12:11:12:18 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:13:17:13:24 | endpoint | CalleeFlexibleAccessPath | o.m().m().m | +| test.js:13:17:13:24 | endpoint | InputArgumentIndex | 0 | +| test.js:13:17:13:24 | endpoint | argumentIndex | 0 | +| test.js:13:17:13:24 | endpoint | calleeAccessPath | lib2 m m m | +| test.js:13:17:13:24 | endpoint | calleeAccessPathWithStructuralInfo | lib2 member m instanceorreturn member m instanceorreturn member m instanceorreturn | +| test.js:13:17:13:24 | endpoint | calleeApiName | lib2 | +| test.js:13:17:13:24 | endpoint | calleeImports | lib2 | +| test.js:13:17:13:24 | endpoint | calleeName | m | +| test.js:13:17:13:24 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:13:17:13:24 | endpoint | enclosingFunctionName | | +| test.js:13:17:13:24 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:14:9:14:16 | endpoint | CalleeFlexibleAccessPath | f() | +| test.js:14:9:14:16 | endpoint | InputArgumentIndex | 0 | +| test.js:14:9:14:16 | endpoint | argumentIndex | 0 | +| test.js:14:9:14:16 | endpoint | calleeAccessPath | lib3 | +| test.js:14:9:14:16 | endpoint | calleeAccessPathWithStructuralInfo | lib3 instanceorreturn instanceorreturn | +| test.js:14:9:14:16 | endpoint | calleeApiName | lib3 | +| test.js:14:9:14:16 | endpoint | calleeImports | lib3 | +| test.js:14:9:14:16 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:14:9:14:16 | endpoint | enclosingFunctionName | | +| test.js:14:9:14:16 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:15:12:15:19 | endpoint | CalleeFlexibleAccessPath | o.?.m | +| test.js:15:12:15:19 | endpoint | InputArgumentIndex | 0 | +| test.js:15:12:15:19 | endpoint | argumentIndex | 0 | +| test.js:15:12:15:19 | endpoint | calleeAccessPath | lib2 m | +| test.js:15:12:15:19 | endpoint | calleeAccessPathWithStructuralInfo | lib2 member member m instanceorreturn | +| test.js:15:12:15:19 | endpoint | calleeApiName | lib2 | +| test.js:15:12:15:19 | endpoint | calleeImports | lib2 | +| test.js:15:12:15:19 | endpoint | calleeName | m | +| test.js:15:12:15:19 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:15:12:15:19 | endpoint | enclosingFunctionName | | +| test.js:15:12:15:19 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:16:16:16:23 | endpoint | CalleeFlexibleAccessPath | o.m.?.p.m | +| test.js:16:16:16:23 | endpoint | InputArgumentIndex | 0 | +| test.js:16:16:16:23 | endpoint | argumentIndex | 0 | +| test.js:16:16:16:23 | endpoint | calleeAccessPath | lib2 m p m | +| test.js:16:16:16:23 | endpoint | calleeAccessPathWithStructuralInfo | lib2 member m member member p member m instanceorreturn | +| test.js:16:16:16:23 | endpoint | calleeApiName | lib2 | +| test.js:16:16:16:23 | endpoint | calleeImports | lib2 | +| test.js:16:16:16:23 | endpoint | calleeName | m | +| test.js:16:16:16:23 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:16:16:16:23 | endpoint | enclosingFunctionName | | +| test.js:16:16:16:23 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:17:15:17:22 | endpoint | CalleeFlexibleAccessPath | (await p) | +| test.js:17:15:17:22 | endpoint | InputArgumentIndex | 0 | +| test.js:17:15:17:22 | endpoint | argumentIndex | 0 | +| test.js:17:15:17:22 | endpoint | calleeAccessPath | lib1 p | +| test.js:17:15:17:22 | endpoint | calleeAccessPathWithStructuralInfo | lib1 member p instanceorreturn | +| test.js:17:15:17:22 | endpoint | calleeApiName | lib1 | +| test.js:17:15:17:22 | endpoint | calleeImports | lib1 | +| test.js:17:15:17:22 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:17:15:17:22 | endpoint | enclosingFunctionName | | +| test.js:17:15:17:22 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:18:27:18:34 | endpoint | CalleeFlexibleAccessPath | import(!).bar.baz | +| test.js:18:27:18:34 | endpoint | InputArgumentIndex | 0 | +| test.js:18:27:18:34 | endpoint | argumentIndex | 0 | +| test.js:18:27:18:34 | endpoint | calleeAccessPath | foo bar baz | +| test.js:18:27:18:34 | endpoint | calleeAccessPathWithStructuralInfo | foo member bar member baz instanceorreturn | +| test.js:18:27:18:34 | endpoint | calleeApiName | foo | +| test.js:18:27:18:34 | endpoint | calleeImports | foo | +| test.js:18:27:18:34 | endpoint | calleeName | baz | +| test.js:18:27:18:34 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:18:27:18:34 | endpoint | enclosingFunctionName | | +| test.js:18:27:18:34 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:20:13:20:20 | endpoint | CalleeFlexibleAccessPath | bar | +| test.js:20:13:20:20 | endpoint | InputArgumentIndex | 0 | +| test.js:20:13:20:20 | endpoint | argumentIndex | 0 | +| test.js:20:13:20:20 | endpoint | calleeAccessPath | lib1 bar | +| test.js:20:13:20:20 | endpoint | calleeAccessPathWithStructuralInfo | lib1 member bar instanceorreturn | +| test.js:20:13:20:20 | endpoint | calleeApiName | lib1 | +| test.js:20:13:20:20 | endpoint | calleeImports | lib1 | +| test.js:20:13:20:20 | endpoint | calleeName | bar | +| test.js:20:13:20:20 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:20:13:20:20 | endpoint | enclosingFunctionName | | +| test.js:20:13:20:20 | endpoint | fileImports | foo lib1 lib2 lib3 | +| test.js:22:21:22:28 | endpoint | InputArgumentIndex | 0 | +| test.js:22:21:22:28 | endpoint | argumentIndex | 0 | +| test.js:22:21:22:28 | endpoint | calleeAccessPath | lib3 | +| test.js:22:21:22:28 | endpoint | calleeAccessPathWithStructuralInfo | lib3 instanceorreturn | +| test.js:22:21:22:28 | endpoint | calleeApiName | lib3 | +| test.js:22:21:22:28 | endpoint | calleeImports | lib2 lib3 | +| test.js:22:21:22:28 | endpoint | enclosingFunctionBody | f endpoint f p endpoint f p q endpoint o m endpoint o m p endpoint o m p q endpoint F endpoint o m m m endpoint f endpoint o x m endpoint o m x p m endpoint p endpoint foo bar baz endpoint foo bar endpoint f f o m endpoint | +| test.js:22:21:22:28 | endpoint | enclosingFunctionName | | +| test.js:22:21:22:28 | endpoint | fileImports | foo lib1 lib2 lib3 | diff --git a/javascript/ql/experimental/adaptivethreatmodeling/test/generic_feature_testing/test.js b/javascript/ql/experimental/adaptivethreatmodeling/test/generic_feature_testing/test.js index f7769703672..ded708d5b9c 100644 --- a/javascript/ql/experimental/adaptivethreatmodeling/test/generic_feature_testing/test.js +++ b/javascript/ql/experimental/adaptivethreatmodeling/test/generic_feature_testing/test.js @@ -1,4 +1,8 @@ -(async function(){ +import { bar, F, p } from 'lib1'; +import * as o from 'lib2'; +const f = require('lib3'); + +(async function () { f(endpoint); f({p: endpoint}); f({p: {q: endpoint}}); @@ -15,4 +19,5 @@ function foo() { bar(endpoint); } -}); \ No newline at end of file + (f() ? f : o.m)(endpoint); +});