All Apps and Add-ons

BUG: UTF-8 reencoding inside sa-ldapsearch ldapfilter

matejkaj
Engager

Hello,
I'd like to report a bug in following plugin:
Splunk Supporting Add-on for Active Directory
If you run a search that yield non-ascii fields and you pass them as parameters into ldapfilter, the search fails with an error.
Example:

| ldapsearch search="(cn=Ůïkëllok Řúxľif)" attrs="distinguishedName"| ldapfilter search="(distinguishedName=$distinguishedName$)" attrs="cn"

The subsequent ldapfilter crashes with following trace:

  File "/opt/splunk/etc/apps/SA-ldapsearch/bin/ldapfilter.py", line 117, in stream
    for entry in entry_generator:
  File "/opt/splunk/etc/apps/SA-ldapsearch/bin/packages/ldap3/extend/standard/PagedSearch.py", line 57, in paged_search_generator
    None if cookie is True else cookie)
  File "/opt/splunk/etc/apps/SA-ldapsearch/bin/packages/ldap3/core/connection.py", line 398, in search
    request = search_operation(search_base, search_filter, search_scope, dereference_aliases, attributes, size_limit, time_limit, types_only, self.server.schema if self.server and self.check_names else None)
  File "/opt/splunk/etc/apps/SA-ldapsearch/bin/packages/ldap3/operation/search.py", line 356, in search_operation
    request['filter'] = build_filter(search_filter, schema)  # parse the searchFilter string and compile it starting from the root node
  File "/opt/splunk/etc/apps/SA-ldapsearch/bin/packages/ldap3/operation/search.py", line 307, in build_filter
    return compile_filter(parse_filter(search_filter, schema).elements[0])
  File "/opt/splunk/etc/apps/SA-ldapsearch/bin/packages/ldap3/operation/search.py", line 215, in parse_filter
    current_node.append(evaluate_match(search_filter[start_pos:end_pos], schema))
  File "/opt/splunk/etc/apps/SA-ldapsearch/bin/packages/ldap3/operation/search.py", line 175, in evaluate_match
    assertion = {'attr': left_part, 'value': validate_assertion_value(schema, left_part, right_part)}
  File "/opt/splunk/etc/apps/SA-ldapsearch/bin/packages/ldap3/protocol/convert.py", line 164, in validate_assertion_value
    validated_value += value[pos].encode('utf-8', errors='ignore')
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc4 in position 0: unexpected end of data

Possible workaround: simply remove ".encode('utf-8', errors='ignore')"

Please fix this issue.
Thanks!

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...