Skip to content

Commit

Permalink
fix(integration): Remove redunant ldap filter escape
Browse files Browse the repository at this point in the history
The fix removes the escape_filter_chars call since we're already using auto_escape=True in the connection initialization. The ldap3 library handles the escaping internally when auto_escape=True is set.
  • Loading branch information
topher-lo committed Jan 4, 2025
1 parent 3dffa62 commit 5c00ef1
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions registry/tracecat_registry/integrations/ldap3.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import ldap3
import orjson
from ldap3.utils.conv import escape_filter_chars
from pydantic import Field

from tracecat_registry import RegistrySecret, registry, secrets
Expand Down Expand Up @@ -106,15 +105,13 @@ def search(
| list[str] = "ALL_ATTRIBUTES",
**kwargs,
) -> list[dict[str, Any]]:
escaped_filter = escape_filter_chars(search_filter) # LDAP injection mitigation

scope = getattr(ldap3, search_scope)
if isinstance(attributes, str):
attributes = getattr(ldap3, attributes)

entries = self.connection.search(
search_base=search_base,
search_filter=escaped_filter,
search_filter=search_filter,
search_scope=scope,
attributes=attributes,
**kwargs,
Expand Down

0 comments on commit 5c00ef1

Please sign in to comment.