Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish LDAP Injection fix #562

Merged
merged 1 commit into from Mar 26, 2021
Merged

Polish LDAP Injection fix #562

merged 1 commit into from Mar 26, 2021

Conversation

jorgectf
Copy link
Contributor

Replaces escape_rdn with escape_filter_chars.

@@ -49,7 +49,7 @@ def try_ldap_login(login, password):
s = Server(config.LDAPURI, port=config.LDAPPORT,
use_ssl=False, get_info=ALL)
# 1. connection with service account to find the user uid
uid = useruid(s, escape_rdn(login))
uid = useruid(s, escape_filter_chars(login))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just replaced the function names but I think this one is redundant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is but better to keep it in case someone copy-paste for another project ;) thanks!

Copy link
Contributor Author

@jorgectf jorgectf Mar 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is that, following that flow, login would go through escape_filter_chars twice.

>>> from ldap3.utils.conv import escape_filter_chars
>>> escape_filter_chars("test ()")
'test \\28\\29'
>>> escape_filter_chars(escape_filter_chars("test ()"))
'test \\5c28\\5c29'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd get rid of the one pointed here to maintain what the user has provided in case it's going to be used somewhere else in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elg elg merged commit b81c167 into LibrIT:master Mar 26, 2021
1 check passed
@jorgectf jorgectf deleted the fix-ldap-injection branch March 26, 2021 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants