fix(auth): reject login attempts with bare usernames and enforce domain validation#268
Open
Aravinda-HWK wants to merge 2 commits intoLSFLK:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the authentication process to require email-based identities, rejecting bare usernames. It refactors domain validation to compare the login domain against domains derived from the identity provider or organizational units. Integration and unit tests have been updated to enforce these requirements. Feedback was provided regarding a redundant check for an empty email string that can be removed to simplify the code.
Comment on lines
519
to
523
| if email == "" { | ||
| log.Printf("LOGIN: unable to resolve mailbox email from login '%s' and auth id '%s'", username, authResp.ID) | ||
| log.Printf("LOGIN: unable to resolve mailbox email from login '%s'", loginEmail) | ||
| deps.SendResponse(conn, fmt.Sprintf("%s NO [AUTHENTICATIONFAILED] Authentication failed", tag)) | ||
| return | ||
| } |
Contributor
There was a problem hiding this comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Description
This PR is to enforce to send email address when logging in.
🔍 Changes Made
✅ Checklist (Email System)
LOGIN,CAPABILITY,LIST,SELECT,FETCH,LOGOUT).🧪 Testing Instructions
To test the server, use the instructions in the README in the
testdirectory.📷 Screenshots / Logs (if applicable)