Fix LDAP search to include an optional trailing slash#417
Conversation
PR Compliance Guide 🔍(Compliance updated until commit 538ee27)Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label Previous compliance checksCompliance check up to commit bf8e041
|
|||||||||||||||||||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
|
@qodo-code-review, since GitHub usernames can consist only of alphanumeric characters (or single hyphens), there is no threat of an LDAP-injection attack, and so the complication of adding escapes is unwarranted. And, since the username value is provided by GitHub and not by a user, there should be little likelihood of a malformed query. |
Bala-Sakabattula
left a comment
There was a problem hiding this comment.
LGTM! Thanks @webbnh
User description
When we look a GitHub user up in the RH Rover, we currently expect the URL to omit the trailing slash. However, currently, 5% of associates include the slash (and GitHub doesn't care). So, this PR modifies our search to look for a match either with or without the slash. (Unfortunately, the wildcarding that LDAP provides is well short of generalized regular expressions, so we do it with a conjunction instead.)
Unfortunately, the unit test noticed the change, so I had to update it, too.
PR Type
Bug fix
Description
Modified LDAP search filter to match GitHub URLs with or without trailing slash
Updated filter to use OR clause combining both URL variants
Updated unit test to verify new filter format
Diagram Walkthrough
File Walkthrough
lookup.py
LDAP filter to support optional trailing slashRover_Lookup/lookup.py
variants
rhatSocialURL=Github->https://github.com/usernameORrhatSocialURL=Github->https://github.com/username/test_lookup.py
Update test for new LDAP filter formatRover_Lookup/tests/test_lookup.py