-
Notifications
You must be signed in to change notification settings - Fork 6
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: Validate other members UserName and DisplayName in E2EI [WPB-10402] #2932
fix: Validate other members UserName and DisplayName in E2EI [WPB-10402] #2932
Conversation
…ers_username_and_displayname_in_e2ei
@@ -114,13 +114,13 @@ internal class FetchMLSVerificationStatusUseCaseImpl( | |||
// check that all identities are valid and name and handle are matching | |||
for ((userId, wireIdentity) in ccIdentity) { | |||
val persistedMemberInfo = dbData.members[userId] | |||
val isUserVerified = wireIdentity.firstOrNull { | |||
val isUserVerified = wireIdentity.none { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
override suspend operator fun invoke(userId: UserId): Boolean = | ||
if (isE2EIEnabledUseCase()) { | ||
mlsConversationRepository.getUserIdentity(userId).fold({ false }, { it.isUserMLSVerified() } | ||
) | ||
val nameHandle = userRepository.getNameAndHandler(userId).getOrNull() | ||
mlsConversationRepository.getUserIdentity(userId).fold({ false }, { it.isUserMLSVerified(nameHandle) }) | ||
} else { | ||
false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion:
override suspend operator fun invoke(userId: UserId): Boolean = isE2EIEnabledUseCase() && userRepository.getNameAndHandler(userId).getOrNull()?.let { nameHandle -> mlsConversationRepository.getUserIdentity(userId).fold( onSuccess = { it.isUserMLSVerified(nameHandle) }, onFailure = { false } ) } ?: false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried even shorter:
override suspend operator fun invoke(userId: UserId): Boolean =
isE2EIEnabledUseCase() && userRepository.getNameAndHandler(userId).flatMap { nameHandle ->
mlsConversationRepository.getUserIdentity(userId).map { it.isUserMLSVerified(nameHandle) }
}.getOrElse(false)
but i don't like it. Yes it's 3 lines instead of 6, but IMO if else
is more readable and easier to understand in that case :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, and one suggestion 🙌
Datadog ReportAll test runs ✅ 2 Total Test Services: 0 Failed, 2 Passed Test Services
|
…ers_username_and_displayname_in_e2ei
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! I just have a tiny suggestion on naming in UserDAO
persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/UserDAO.kt
Outdated
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
What's new in this PR?
Issues
The checking "if user has valid E2EI" was not full in Participants list and UserProfile.
We should also check if users
displayName
andhandle
are the same as in E2EI certificate.Causes (Optional)
Was not implemented.
Solutions
Implement it and add/update tests for new scenarios.