Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix comments #1300

Closed
wants to merge 1 commit into from
Closed

fix: fix comments #1300

wants to merge 1 commit into from

Conversation

timotheeg
Copy link
Contributor

Problem

Incorrect comment says prefix, when it should say suffix 🤦

Solution

Fix comment

@timotheeg timotheeg requested a review from a team April 13, 2024 02:01
@@ -166,13 +166,13 @@ class UsersService {
const whitelistDomains = whitelistEntries.map((entry) => entry.email)
const hasMatchDomain =
whitelistDomains.filter((domain) => {
// if domain is really just a domain (does not include a @ OR starts with a @), we can do a prefix match
// if domain is really just a domain (does not include a @ OR starts with a @), we can do a suffix match
if (/^@|^[^@]+$/.test(domain)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but we could flip the condition to use a simpler regexp (didn't think of it during incident yesterday 😑🤦)

// if domain a full email address (it has content before the @), we can ONLY do exact match on it
if (/^.+@/.test(domain)) {
    return normalizedEmail === domain
}

// otherwise we can do a suffix match
return normalizedEmail.endsWith(domain)

@timotheeg
Copy link
Contributor Author

timotheeg commented Apr 13, 2024

Closing PR. Superseeded by #1301

@timotheeg timotheeg closed this Apr 13, 2024
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.

1 participant