@@ -449,6 +449,44 @@ module RegexExecution {
449449 }
450450}
451451
452+ /** Provides classes for modeling LDAP-related APIs. */
453+ module LDAP {
454+ /**
455+ * A data-flow node that executes an LDAP query.
456+ *
457+ * Extend this class to refine existing API models. If you want to model new APIs,
458+ * extend `LDAPQuery::Range` instead.
459+ */
460+ class LdapExecution extends DataFlow:: Node {
461+ LdapExecution:: Range range ;
462+
463+ LdapExecution ( ) { this = range }
464+
465+ /** Gets the argument containing the filter string. */
466+ DataFlow:: Node getFilter ( ) { result = range .getFilter ( ) }
467+
468+ /** Gets the argument containing the base DN. */
469+ DataFlow:: Node getBaseDn ( ) { result = range .getBaseDn ( ) }
470+ }
471+
472+ /** Provides classes for modeling new LDAP query execution-related APIs. */
473+ module LdapExecution {
474+ /**
475+ * A data-flow node that executes an LDAP query.
476+ *
477+ * Extend this class to model new APIs. If you want to refine existing API models,
478+ * extend `LDAPQuery` instead.
479+ */
480+ abstract class Range extends DataFlow:: Node {
481+ /** Gets the argument containing the filter string. */
482+ abstract DataFlow:: Node getFilter ( ) ;
483+
484+ /** Gets the argument containing the base DN. */
485+ abstract DataFlow:: Node getBaseDn ( ) ;
486+ }
487+ }
488+ }
489+
452490/**
453491 * A data-flow node that escapes meta-characters, which could be used to prevent
454492 * injection attacks.
@@ -506,8 +544,20 @@ module Escaping {
506544 /** Gets the escape-kind for escaping a string so it can safely be included in HTML. */
507545 string getHtmlKind ( ) { result = "html" }
508546
509- /** Gets the escape-kind for escaping a string so it can safely be included in HTML . */
547+ /** Gets the escape-kind for escaping a string so it can safely be included in a regular expression . */
510548 string getRegexKind ( ) { result = "regex" }
549+
550+ /**
551+ * Gets the escape-kind for escaping a string so it can safely be used as a
552+ * distinguished name (DN) in an LDAP search.
553+ */
554+ string getLdapDnKind ( ) { result = "ldap_dn" }
555+
556+ /**
557+ * Gets the escape-kind for escaping a string so it can safely be used as a
558+ * filter in an LDAP search.
559+ */
560+ string getLdapFilterKind ( ) { result = "ldap_filter" }
511561 // TODO: If adding an XML kind, update the modeling of the `MarkupSafe` PyPI package.
512562 //
513563 // Technically it claims to escape for both HTML and XML, but for now we don't have
@@ -532,6 +582,21 @@ class RegexEscaping extends Escaping {
532582 RegexEscaping ( ) { range .getKind ( ) = Escaping:: getRegexKind ( ) }
533583}
534584
585+ /**
586+ * An escape of a string so it can be safely used as a distinguished name (DN)
587+ * in an LDAP search.
588+ */
589+ class LdapDnEscaping extends Escaping {
590+ LdapDnEscaping ( ) { range .getKind ( ) = Escaping:: getLdapDnKind ( ) }
591+ }
592+
593+ /**
594+ * An escape of a string so it can be safely used as a filter in an LDAP search.
595+ */
596+ class LdapFilterEscaping extends Escaping {
597+ LdapFilterEscaping ( ) { range .getKind ( ) = Escaping:: getLdapFilterKind ( ) }
598+ }
599+
535600/** Provides classes for modeling HTTP-related APIs. */
536601module HTTP {
537602 /** Gets an HTTP verb, in upper case */
0 commit comments