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: mls client init [WPB-15022] #3178

Merged
merged 5 commits into from
Dec 16, 2024
Merged

Conversation

Garzas
Copy link
Contributor

@Garzas Garzas commented Dec 16, 2024

BugWPB-15022 [Android] MLS client is created, but not registered once mls keys are available on the backend


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

There is scenario when mls client can be created when mls feature config is disabled

Causes (Optional)

Before enabling MLS on feature config backend can change cipherSuiteTag causing encryption problems when user can already use some default cipherSuiteTag if he created MLS client earlier.

Solutions

  • introduced MLSFailure.Disabled
  • secured MLS client initialization when MLS feature flag is disabled
  • changed order of fetching MLS public keys to avoid fetching them when MLS is disabled by feature config
  • secured MLSKeyPackageCountUseCase to not fetch key package count when MLS is disabled by feature config
  • ignoring inserting MLS conversations when MLS is disabled or getting MLS client fails

Copy link
Contributor

github-actions bot commented Dec 16, 2024

Test Results

3 343 tests  +3   3 236 ✅ +3   5m 55s ⏱️ +22s
  572 suites ±0     107 💤 ±0 
  572 files   ±0       0 ❌ ±0 

Results for commit de391f4. ± Comparison against base commit 4b88fac.

♻️ This comment has been updated with latest results.

selfTeamIdProvider().getOrNull(),
val mlsGroupState = conversation.groupId?.let { mlsGroupState(idMapper.fromGroupIDEntity(it), originatedFromEvent) }
// if group state is left, then we don't want to persist the conversation
if (mlsGroupState?.fold({ true }, { false }) != true) {
Copy link
Member

Choose a reason for hiding this comment

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

Can't we use isRight() instead of fold()?

Suggested change
if (mlsGroupState?.fold({ true }, { false }) != true) {
if (mlsGroupState?.isRight()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know why but tests where failing when I was using is left or right

Copy link
Contributor

@yamilmedina yamilmedina left a comment

Choose a reason for hiding this comment

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

👏 Nicely done stepping up for this issue ! I just left a small suggestion.

@codecov-commenter
Copy link

codecov-commenter commented Dec 16, 2024

Codecov Report

Attention: Patch coverage is 77.35849% with 12 lines in your changes missing coverage. Please review.

Project coverage is 54.14%. Comparing base (4b88fac) to head (de391f4).

Files with missing lines Patch % Lines
.../logic/data/conversation/ConversationRepository.kt 66.66% 2 Missing and 6 partials ⚠️
...om/wire/kalium/logic/feature/client/ClientScope.kt 0.00% 3 Missing ⚠️
...r/conversation/message/MLSMessageFailureHandler.kt 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##           release/candidate    #3178   +/-   ##
==================================================
  Coverage              54.14%   54.14%           
==================================================
  Files                   1250     1250           
  Lines                  36458    36477   +19     
  Branches                3689     3696    +7     
==================================================
+ Hits                   19740    19751   +11     
- Misses                 15294    15298    +4     
- Partials                1424     1428    +4     
Files with missing lines Coverage Δ
...onMain/kotlin/com/wire/kalium/logic/CoreFailure.kt 32.53% <ø> (ø)
...wire/kalium/logic/data/client/MLSClientProvider.kt 21.56% <100.00%> (+2.37%) ⬆️
...gic/data/conversation/MLSConversationRepository.kt 83.89% <100.00%> (+0.13%) ⬆️
...ture/client/IsAllowedToRegisterMLSClientUseCase.kt 100.00% <100.00%> (ø)
...ic/feature/keypackage/MLSKeyPackageCountUseCase.kt 71.87% <100.00%> (+5.20%) ⬆️
...r/conversation/message/MLSMessageFailureHandler.kt 33.33% <0.00%> (-2.39%) ⬇️
...om/wire/kalium/logic/feature/client/ClientScope.kt 0.00% <0.00%> (ø)
.../logic/data/conversation/ConversationRepository.kt 61.75% <66.66%> (-0.63%) ⬇️

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b88fac...de391f4. Read the comment docs.

@Garzas Garzas requested a review from typfel December 16, 2024 13:35
@datadog-wireapp
Copy link

datadog-wireapp bot commented Dec 16, 2024

Datadog Report

Branch report: fix/mls-client-init
Commit report: 2c62c9c
Test service: kalium-jvm

✅ 0 Failed, 3236 Passed, 107 Skipped, 1m 1.13s Total Time

@Garzas Garzas enabled auto-merge December 16, 2024 13:59
@Garzas Garzas added this pull request to the merge queue Dec 16, 2024
Merged via the queue into release/candidate with commit da1e7eb Dec 16, 2024
21 checks passed
@Garzas Garzas deleted the fix/mls-client-init branch December 16, 2024 15:09
github-actions bot pushed a commit that referenced this pull request Dec 16, 2024
* fix: secure mls client creation with is mls enabled

* fix: dont persist mls conversations when mls is disabled

* review improvements
github-merge-queue bot pushed a commit that referenced this pull request Dec 17, 2024
* fix: secure mls client creation with is mls enabled

* fix: dont persist mls conversations when mls is disabled

* review improvements

Co-authored-by: Jakub Żerko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants