From 9afd360731cadd528427035be0f1538a97247ab6 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Thu, 6 Jan 2022 23:35:28 +0100 Subject: [PATCH 1/3] QL: recognize dependecies of the form: libraryPathDependencies: library-name --- ql/ql/src/codeql_ql/ast/Ast.qll | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ql/ql/src/codeql_ql/ast/Ast.qll b/ql/ql/src/codeql_ql/ast/Ast.qll index 02e04cc8a6e..8b08c18adcd 100644 --- a/ql/ql/src/codeql_ql/ast/Ast.qll +++ b/ql/ql/src/codeql_ql/ast/Ast.qll @@ -2460,6 +2460,9 @@ module YAML { name = entry.getListItem().getValue().getValue().trim() and version = "\"*\"" ) + or + name = getProperty("libraryPathDependencies") and + version = "\"*\"" } /** Gets the database scheme of this qlpack */ From bb94c42a35b4d971e4ad0a4efbb7501d26409a65 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Fri, 7 Jan 2022 15:22:21 +0100 Subject: [PATCH 2/3] explicit this Co-authored-by: Taus --- ql/ql/src/codeql_ql/ast/Ast.qll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ql/ql/src/codeql_ql/ast/Ast.qll b/ql/ql/src/codeql_ql/ast/Ast.qll index 8b08c18adcd..f0821d063fa 100644 --- a/ql/ql/src/codeql_ql/ast/Ast.qll +++ b/ql/ql/src/codeql_ql/ast/Ast.qll @@ -2461,7 +2461,7 @@ module YAML { version = "\"*\"" ) or - name = getProperty("libraryPathDependencies") and + name = this.getProperty("libraryPathDependencies") and version = "\"*\"" } From cc5e9fea77fd16a792f16ef8c2b59c31012ba89c Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Fri, 7 Jan 2022 18:43:37 +0100 Subject: [PATCH 3/3] add test --- ql/ql/test/callgraph/callgraph.expected | 3 +++ ql/ql/test/callgraph/packs/other/OtherThing.qll | 7 +++++++ ql/ql/test/callgraph/packs/other/qlpack.yml | 3 +++ 3 files changed, 13 insertions(+) create mode 100644 ql/ql/test/callgraph/packs/other/OtherThing.qll create mode 100644 ql/ql/test/callgraph/packs/other/qlpack.yml diff --git a/ql/ql/test/callgraph/callgraph.expected b/ql/ql/test/callgraph/callgraph.expected index 33fb31cef9d..ca99880882e 100644 --- a/ql/ql/test/callgraph/callgraph.expected +++ b/ql/ql/test/callgraph/callgraph.expected @@ -18,9 +18,12 @@ getTarget | Overrides.qll:24:39:24:48 | MemberCall | Overrides.qll:22:12:22:44 | ClassPredicate bar | | Overrides.qll:28:3:28:9 | MemberCall | Overrides.qll:6:3:6:29 | ClassPredicate bar | | Overrides.qll:29:3:29:10 | MemberCall | Overrides.qll:8:3:8:41 | ClassPredicate baz | +| packs/other/OtherThing.qll:5:3:5:8 | PredicateCall | packs/lib/LibThing/Foo.qll:1:1:1:30 | ClasslessPredicate foo | +| packs/other/OtherThing.qll:6:3:6:8 | PredicateCall | packs/src/SrcThing.qll:8:1:8:30 | ClasslessPredicate bar | | packs/src/SrcThing.qll:4:3:4:8 | PredicateCall | packs/lib/LibThing/Foo.qll:1:1:1:30 | ClasslessPredicate foo | | packs/src/SrcThing.qll:5:3:5:8 | PredicateCall | packs/src/SrcThing.qll:8:1:8:30 | ClasslessPredicate bar | dependsOn +| packs/other/qlpack.yml:1:1:1:4 | ql-other-pack-thing | packs/src/qlpack.yml:1:1:1:4 | ql-testing-src-pack | | packs/src/qlpack.yml:1:1:1:4 | ql-testing-src-pack | packs/lib/qlpack.yml:1:1:1:4 | ql-testing-lib-pack | exprPredicate | Foo.qll:24:22:24:31 | predicate | Foo.qll:22:3:22:32 | ClasslessPredicate myThing0 | diff --git a/ql/ql/test/callgraph/packs/other/OtherThing.qll b/ql/ql/test/callgraph/packs/other/OtherThing.qll new file mode 100644 index 00000000000..f4a746f2353 --- /dev/null +++ b/ql/ql/test/callgraph/packs/other/OtherThing.qll @@ -0,0 +1,7 @@ +import LibThing.Foo +import SrcThing + +predicate otherThing(int i) { + foo(i) and + bar(i) +} diff --git a/ql/ql/test/callgraph/packs/other/qlpack.yml b/ql/ql/test/callgraph/packs/other/qlpack.yml new file mode 100644 index 00000000000..ffdccbffe0a --- /dev/null +++ b/ql/ql/test/callgraph/packs/other/qlpack.yml @@ -0,0 +1,3 @@ +name: ql-other-pack-thing +version: 0.1.0 +libraryPathDependencies: ql-testing-src-pack \ No newline at end of file