Skip to content

Commit 9a73c36

Browse files
committed
add support for libraryPathDependencies in qlpacks
1 parent ade2061 commit 9a73c36

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ql/src/codeql_ql/ast/Ast.qll

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2309,6 +2309,8 @@ module YAML {
23092309
)
23102310
}
23112311

2312+
YAMLListItem getListItem() { toQL(result).getParent() = yamle }
2313+
23122314
/** Gets the value of this YAML entry. */
23132315
YAMLValue getValue() {
23142316
exists(QL::YamlKeyvaluepair pair |
@@ -2421,7 +2423,7 @@ module YAML {
24212423
deps.getLocation().getFile() = file and entry.getLocation().getFile() = file
24222424
|
24232425
deps.isRoot() and
2424-
deps.getKey().getQualifiedName() = "dependencies" and
2426+
deps.getKey().getQualifiedName() = ["dependencies", "libraryPathDependencies"] and
24252427
entry.getLocation().getStartLine() = 1 + deps.getLocation().getStartLine() and
24262428
entry.getLocation().getStartColumn() > deps.getLocation().getStartColumn()
24272429
)
@@ -2436,8 +2438,11 @@ module YAML {
24362438

24372439
predicate hasDependency(string name, string version) {
24382440
exists(YAMLEntry entry | this.isADependency(entry) |
2439-
entry.getKey().getQualifiedName() = name and
2441+
entry.getKey().getQualifiedName().trim() = name and
24402442
entry.getValue().getValue() = version
2443+
or
2444+
name = entry.getListItem().getValue().getValue().trim() and
2445+
version = "\"*\""
24412446
)
24422447
}
24432448

@@ -2459,7 +2464,7 @@ module YAML {
24592464
*/
24602465
QLPack getADependency() {
24612466
exists(string name | this.hasDependency(name, _) |
2462-
result.getName().replaceAll("-", "/") = name
2467+
result.getName().replaceAll("-", "/") = name.replaceAll("-", "/")
24632468
)
24642469
}
24652470

0 commit comments

Comments
 (0)