[GH-ISSUE #34] Some users in LDAP can be without groups #5

Closed
opened 2026-03-02 03:44:33 +03:00 by kerem · 2 comments
Owner

Originally created by @iamtio on GitHub (Jun 23, 2021).
Original GitHub issue: https://github.com/dignajar/another-ldap-auth/issues/34

Hello everyone.
Some users in LDAP can be without groups. In that case app returns 500
I think it should return another status, not 500
Docker image: dignajar/another-ldap-auth:2.2.1

Stacktrace:
[2021-06-23 10:35:31,561] ERROR in app: Exception on / [GET] Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2070, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1515, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1513, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1499, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/usr/local/lib/python3.9/site-packages/flask_httpauth.py", line 161, in decorated user = self.authenticate(auth, password) File "/usr/local/lib/python3.9/site-packages/flask_httpauth.py", line 238, in authenticate return self.verify_password_callback(username, client_password) File "/home/aldap/main.py", line 202, in login validGroups, matchedGroups, adGroups = aldap.validateGroups(username, matchingGroups) File "/home/aldap/aldap.py", line 104, in validateGroups adGroups.extend(element['memberOf']) KeyError: 'memberOf'

Originally created by @iamtio on GitHub (Jun 23, 2021). Original GitHub issue: https://github.com/dignajar/another-ldap-auth/issues/34 Hello everyone. Some users in LDAP can be without groups. In that case app returns 500 I think it should return another status, not 500 Docker image: **dignajar/another-ldap-auth:2.2.1** Stacktrace: `[2021-06-23 10:35:31,561] ERROR in app: Exception on / [GET] Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2070, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1515, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1513, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1499, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/usr/local/lib/python3.9/site-packages/flask_httpauth.py", line 161, in decorated user = self.authenticate(auth, password) File "/usr/local/lib/python3.9/site-packages/flask_httpauth.py", line 238, in authenticate return self.verify_password_callback(username, client_password) File "/home/aldap/main.py", line 202, in login validGroups, matchedGroups, adGroups = aldap.validateGroups(username, matchingGroups) File "/home/aldap/aldap.py", line 104, in validateGroups adGroups.extend(element['memberOf']) KeyError: 'memberOf' `
kerem 2026-03-02 03:44:33 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@dignajar commented on GitHub (Jun 23, 2021):

Hi,
If the user doesn't have a group and you specified an Allowed-Group we have to return 401 (Unauthorized)

thank for reported the bug

<!-- gh-comment-id:866851702 --> @dignajar commented on GitHub (Jun 23, 2021): Hi, If the user doesn't have a group and you specified an `Allowed-Group` we have to return 401 (Unauthorized) thank for reported the bug
Author
Owner

@dignajar commented on GitHub (Jun 25, 2021):

Fixed in v2.3

<!-- gh-comment-id:868506366 --> @dignajar commented on GitHub (Jun 25, 2021): Fixed in v2.3
Sign in to join this conversation.
No labels
bug
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/another-ldap-auth#5
No description provided.