add getValue() method

This commit is contained in:
Maiky
2023-08-10 00:39:35 +02:00
parent e60fa6f1a7
commit 97f8d1fca9

View File

@@ -45,10 +45,7 @@ module NetLdap {
NetLdapConnection() { this in [ldap().getAnInstantiation(), ldap().getAMethodCall("open")] }
predicate usesSsl() {
[
this.getKeywordArgument("encryption"), this.getAMethodCall("encryption").getArgument(0),
this.getAMethodCall("encryption").getKeywordArgument("method")
].getConstantValue().isStringlikeValue("simple_tls")
getValue(this, "encryption").getConstantValue().isStringlikeValue("simple_tls")
}
DataFlow::Node getAuthValue(string arg) {
@@ -88,13 +85,7 @@ module NetLdap {
NetLdapBind() { this = l.getAMethodCall("bind") }
override DataFlow::Node getHost() {
result =
[
l.getKeywordArgument("host"), l.getAMethodCall("host").getArgument(0),
l.getAMethodCall("host").getKeywordArgument("method")
]
}
override DataFlow::Node getHost() { result = getValue(l, "host") }
override DataFlow::Node getPassword() {
result = l.getAuthValue("password") or
@@ -103,4 +94,13 @@ module NetLdap {
override predicate usesSsl() { l.usesSsl() }
}
/** LDAP Attribute value */
DataFlow::Node getValue(NetLdapConnection l, string attr) {
result =
[
l.getKeywordArgument(attr), l.getAMethodCall(attr).getArgument(0),
l.getAMethodCall(attr).getKeywordArgument(attr)
]
}
}