参考:https://sumsec.me/2022/CodeQL-Usage-Tricks.html#CodeQL with SCA
https://www.yuque.com/loulan-b47wt/rc30f7/ll3a4z
实操
import javaimport semmle.code.java.DependencyCountspredicate jarDependencyCount(int total, string entity) {exists(JarFile targetJar, string jarStem |jarStem = targetJar.getStem() andjarStem != "rt"|total =sum(RefType r, RefType dep, int num |r.fromSource() andnot dep.fromSource() anddep.getFile().getParentContainer*() = targetJar andnumDepends(r, dep, num)|num) andentity = jarStem)}from string name, int ndepswhere jarDependencyCount(ndeps, name)select name, ndeps order by ndeps desc

