Skip to content

escape username in ldap cn/uid bind dn construction - #2639

Merged
leonelcamara merged 2 commits into
web2py:masterfrom
madib06ops:ldap-dn-escape
Jul 2, 2026
Merged

leonelcamara merged 2 commits into
web2py:masterfrom
madib06ops:ldap-dn-escape

Conversation

@madib06ops

Copy link
Copy Markdown
Contributor

The cn and uid login modes in ldap_auth.py build the bind DN by concatenating the raw login username (cn=<username>,<basedn> / uid=<username>,<basedn>) and hand it to simple_bind_s. The search filters here already go through escape_filter_chars, but the DN does not, so a username containing DN metacharacters like a comma or equals sign (e.g. admin,ou=Admins) rewrites the RDN structure of the bind DN instead of being treated as a single value. Escape the username with ldap.dn.escape_dn_chars at the three DN-building sites so it stays one RDN component.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.39%. Comparing base (951c326) to head (23a0cab).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2639      +/-   ##
==========================================
- Coverage   50.40%   50.39%   -0.02%     
==========================================
  Files          42       42              
  Lines       15489    15489              
  Branches     3404     3404              
==========================================
- Hits         7807     7805       -2     
- Misses       6656     6657       +1     
- Partials     1026     1027       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@leonelcamara
leonelcamara merged commit b22cf2d into web2py:master Jul 2, 2026
1 check was pending
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.

3 participants