mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
WIP: add properties
This commit is contained in:
@@ -5,7 +5,33 @@
|
||||
|
||||
import experimental.Quantum.Language
|
||||
|
||||
query predicate nodes(Crypto::NodeBase node) { any() }
|
||||
string getValueAndLocationPairs(Crypto::NodeBase node, string key) {
|
||||
exists(string value, Location location |
|
||||
node.properties(key, value, location) and
|
||||
result = "(" + value + "," + location.toString() + ")"
|
||||
)
|
||||
}
|
||||
|
||||
string properties(Crypto::NodeBase node) {
|
||||
forex(string key | node.properties(key, _, _) |
|
||||
result = key + ":" + strictconcat(getValueAndLocationPairs(node, key), ",")
|
||||
)
|
||||
}
|
||||
|
||||
string getLabel(Crypto::NodeBase node) {
|
||||
result =
|
||||
"[" + node.toString() + "]" +
|
||||
any(string prop |
|
||||
if exists(properties(node)) then prop = " " + properties(node) else prop = ""
|
||||
|
|
||||
prop
|
||||
)
|
||||
}
|
||||
|
||||
query predicate nodes(Crypto::NodeBase node, string key, string value) {
|
||||
key = "semmle.label" and
|
||||
value = getLabel(node)
|
||||
}
|
||||
|
||||
query predicate edges(Crypto::NodeBase source, Crypto::NodeBase target, string key, string value) {
|
||||
target = source.getChild(value) and
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
|
||||
import experimental.Quantum.Language
|
||||
|
||||
from Crypto::KeyDerivationAlgorithm n
|
||||
select n
|
||||
from Crypto::NodeBase node
|
||||
select node
|
||||
|
||||
Reference in New Issue
Block a user