Skip to content

Commit f140601

Browse files
committed
Write documentation
1 parent 5787406 commit f140601

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

python/ql/src/experimental/semmle/python/Concepts.qll

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,33 @@ private import semmle.python.dataflow.new.RemoteFlowSources
1414
private import semmle.python.dataflow.new.TaintTracking
1515
private import experimental.semmle.python.Frameworks
1616

17+
/** Provides classes for modeling LDAP bind-related APIs. */
1718
module LDAPBind {
19+
/**
20+
* A data-flow node that collects methods binding a LDAP connection.
21+
*
22+
* Extend this class to model new APIs. If you want to refine existing API models,
23+
* extend `LDAPBind` instead.
24+
*/
1825
abstract class Range extends DataFlow::Node {
26+
/**
27+
* Gets the argument containing the binding expression.
28+
*/
1929
abstract DataFlow::Node getPasswordNode();
2030

31+
/**
32+
* Gets the argument containing the executed query.
33+
*/
2134
abstract DataFlow::Node getQueryNode();
2235
}
2336
}
2437

38+
/**
39+
* A data-flow node that collects methods binding a LDAP connection.
40+
*
41+
* Extend this class to refine existing API models. If you want to model new APIs,
42+
* extend `LDAPBind::Range` instead.
43+
*/
2544
class LDAPBind extends DataFlow::Node {
2645
LDAPBind::Range range;
2746

python/ql/src/experimental/semmle/python/frameworks/Stdlib.qll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,32 @@ private import semmle.python.dataflow.new.RemoteFlowSources
1010
private import experimental.semmle.python.Concepts
1111
private import semmle.python.ApiGraphs
1212

13+
/**
14+
* Provides models for Python's ldap-related libraries.
15+
*/
1316
private module LDAP {
17+
/**
18+
* Provides models for Python's `ldap` library.
19+
*
20+
* See https://www.python-ldap.org/en/python-ldap-3.3.0/index.html
21+
*/
1422
private module LDAP2 {
23+
/**
24+
* List of `ldap` methods used to execute a query.
25+
*
26+
* See https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap.html#functions
27+
*/
1528
private class LDAP2QueryMethods extends string {
1629
LDAP2QueryMethods() {
1730
this in ["search", "search_s", "search_st", "search_ext", "search_ext_s"]
1831
}
1932
}
2033

34+
/**
35+
* A class to find `ldap` methods binding a connection.
36+
*
37+
* See `LDAP2QueryMethods`
38+
*/
2139
class LDAP2Bind extends DataFlow::CallCfgNode, LDAPBind::Range {
2240
DataFlow::Node queryNode;
2341

@@ -46,7 +64,15 @@ private module LDAP {
4664
}
4765
}
4866

67+
/**
68+
* Provides models for Python's `ldap3` library.
69+
*
70+
* See https://pypi.org/project/ldap3/
71+
*/
4972
private module LDAP3 {
73+
/**
74+
* A class to find `ldap3` methods binding a connection.
75+
*/
5076
class LDAP3Bind extends DataFlow::CallCfgNode, LDAPBind::Range {
5177
DataFlow::Node queryNode;
5278

python/ql/src/experimental/semmle/python/security/LDAPImproperAuth.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
/**
2+
* Provides a taint-tracking configuration for detecting LDAP improper authentication vulnerabilities
3+
*/
4+
15
import python
26
import experimental.semmle.python.Concepts
37
import semmle.python.dataflow.new.DataFlow
48
import semmle.python.dataflow.new.TaintTracking
59
import semmle.python.dataflow.new.RemoteFlowSources
610

11+
/**
12+
* A class to find `LDAPBind` methods using an empty password or set as None.
13+
*/
714
class LDAPImproperAuthSink extends DataFlow::Node {
815
LDAPImproperAuthSink() {
916
exists(LDAPBind ldapBind |
@@ -23,6 +30,9 @@ class LDAPImproperAuthSink extends DataFlow::Node {
2330
}
2431
}
2532

33+
/**
34+
* A taint-tracking configuration for detecting LDAP improper authentications.
35+
*/
2636
class LDAPImproperAuthenticationConfig extends TaintTracking::Configuration {
2737
LDAPImproperAuthenticationConfig() { this = "LDAPImproperAuthenticationConfig" }
2838

0 commit comments

Comments
 (0)