WIP: add properties

This commit is contained in:
Nicolas Will
2025-01-28 02:02:06 +01:00
parent 78362341ff
commit e027b0e9a0
5 changed files with 114 additions and 27 deletions

View File

@@ -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

View File

@@ -4,5 +4,5 @@
import experimental.Quantum.Language
from Crypto::KeyDerivationAlgorithm n
select n
from Crypto::NodeBase node
select node