|
| 1 | +/** |
| 2 | + * Provides default sources, sinks and sanitizers for detecting |
| 3 | + * improper LDAP authentication, as well as extension points for adding your own |
| 4 | + */ |
| 5 | + |
| 6 | +private import codeql.ruby.Concepts |
| 7 | +private import codeql.ruby.DataFlow |
| 8 | +private import codeql.ruby.dataflow.BarrierGuards |
| 9 | +private import codeql.ruby.dataflow.RemoteFlowSources |
| 10 | + |
| 11 | +/** |
| 12 | + * Provides default sources, sinks and sanitizers for detecting |
| 13 | + * improper LDAP authentication, as well as extension points for adding your own |
| 14 | + */ |
| 15 | +module ImproperLdapAuth { |
| 16 | + /** A data flow source for improper LDAP authentication vulnerabilities */ |
| 17 | + abstract class Source extends DataFlow::Node { } |
| 18 | + |
| 19 | + /** A data flow sink for improper LDAP authentication vulnerabilities */ |
| 20 | + abstract class Sink extends DataFlow::Node { } |
| 21 | + |
| 22 | + /** A sanitizer for improper LDAP authentication vulnerabilities. */ |
| 23 | + abstract class Sanitizer extends DataFlow::Node { } |
| 24 | + |
| 25 | + /** |
| 26 | + * A source of remote user input, considered as a flow source. |
| 27 | + */ |
| 28 | + private class RemoteFlowSourceAsSource extends Source, RemoteFlowSource { } |
| 29 | + |
| 30 | + /** |
| 31 | + * An LDAP query execution considered as a flow sink. |
| 32 | + */ |
| 33 | + private class LdapBindAsSink extends Sink { |
| 34 | + LdapBindAsSink() { this = any(LdapBind l).getPassword() } |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * A comparison with a constant string, considered as a sanitizer-guard. |
| 39 | + */ |
| 40 | + private class StringConstCompareAsSanitizerGuard extends Sanitizer, StringConstCompareBarrier { } |
| 41 | + |
| 42 | + /** |
| 43 | + * An inclusion check against an array of constant strings, considered as a |
| 44 | + * sanitizer-guard. |
| 45 | + */ |
| 46 | + private class StringConstArrayInclusionCallAsSanitizer extends Sanitizer, |
| 47 | + StringConstArrayInclusionCallBarrier |
| 48 | + { } |
| 49 | +} |
0 commit comments