Skip to content

Bypassing authentication flow by manually creating a local Django user may cause duplicate users to be created #9

@sjkingo

Description

@sjkingo

LDAP specifies in rfc4518 that whitespace is normalised in search and binds such that requesting cn=@@@sam may return cn=sam as the user (replace @ with a space).

This behaviour is squashed by the patch in #7 by using the ldap_user.username attribute instead of the user's input, however an edge case still exists if a local Django user is created without applying the correct normalisation (assuming an LDAP user sam exists):

  1. Create local Django user @@@sam (replace @ with a space - that is, sam prefixed with 3 spaces)
  2. Log in as @@@sam
  3. A new user sam is created as this is the user returned by LDAP

There are now duplicates in the local Django database as @@@sam and sam, even though they refer to the same user.
#7 fixes the case-normalisation issue by always using the LDAP's username to create the local user, however if an admin bypasses the usual authentication flow and manually creates a new user in Django, this edge case may be hit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions