Skip to content

Commit bbcfbd7

Browse files
committed
Apply suggestion from code review
1 parent 7b2192d commit bbcfbd7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

java/ql/src/Security/CWE/CWE-90/LdapInjection.qhelp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ is likely to be able to run malicious LDAP queries.</p>
1111
<recommendation>
1212
<p>If user input must be included in an LDAP query, it should be escaped to
1313
avoid a malicious user providing special characters that change the meaning
14-
of the query. If possible build the LDAP query (or search filter / DN) using your
15-
framework helper methods to avoid string concatenation, or escape user input
16-
using the right LDAP encoding method, for example encodeForLDAP from OWASP ESAPI,
17-
LdapEncoder from Spring LDAP or Filter.encodeValue from UnboundID library.</p>
14+
of the query. If possible build the LDAP query using framework helper methods, for example
15+
from Spring's <code>LdapQueryBuilder</code> and <code>LdapNameBuilder</code>,
16+
instead of string concatenation. Alternatively, escape user input using an appropriate
17+
LDAP encoding method, for example: <code>encodeForLDAP</code> or </code>encodeForDN</code>
18+
from OWASP ESAPI, <code>LdapEncoder.filterEncode</code> or <code>LdapEncoder.nameEncode</code>
19+
from Spring LDAP, or <code>Filter.encodeValue</code> from UnboundID library.</p>
1820
</recommendation>
1921

2022
<example>

0 commit comments

Comments
 (0)