directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hendy Irawan (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DIRSHARED-143) Provide helper method to escape characters to be used in LDAP Filter literal
Date Sat, 03 Nov 2012 08:56:12 GMT

    [ https://issues.apache.org/jira/browse/DIRSHARED-143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13489970#comment-13489970
] 

Hendy Irawan commented on DIRSHARED-143:
----------------------------------------

(cn=acm*) -> should we escape '*', and produce a (cn=acm\2a) filter ? What if the user
intention was to match every cn starting with 'acm' ?

(&(cn=my)(cn\3Dtest)) -> should we escape the filter to (&cn=my\29\28cn\3Dtest\29)
?

The above is not how to use the methods. User does not input a filter string, it inputs values
to match.

For example, usage in Java would be:

{code}
String filter = "(&(cn=*" + LdapEncoder.filterEncode(searchText) + "*)(uid=*" + LdapEncoder.filterEncode(searchText)
+ "*))";
{code}

searchText is provided by user input.

A JDBC/JPA-style query escaping would be even more awesome, but the simplest helper methods
are already useful.

public static String escapeFilterValue(String value) would be cool, it's the same functionality
as Spring LDAP's LdapEncoder.filterEncode(), is this correct ?
                
> Provide helper method to escape characters to be used in LDAP Filter literal
> ----------------------------------------------------------------------------
>
>                 Key: DIRSHARED-143
>                 URL: https://issues.apache.org/jira/browse/DIRSHARED-143
>             Project: Directory Shared
>          Issue Type: Improvement
>    Affects Versions: 1.0.0-M13
>            Reporter: Hendy Irawan
>
> In order to prevent malicious injection, user-provided input must be escaped (the 5 restricted
characters) before being put in LDAP filter.
> Provide a helper static method to make it convenient and available as public API.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message