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: suppress buffer error for mls decrypt transaction [WPB-16233] #3305

Merged
merged 4 commits into from
Feb 21, 2025

Conversation

Garzas
Copy link
Contributor

@Garzas Garzas commented Feb 21, 2025

BugWPB-16233 [Android] Catch and suppress buffer errors inside transaction


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

  • When receiving out-of-order commits (e.g., when a client is missing a preceding commit), the MLS client was throwing a BufferedFutureMessage exception instead of buffering and persisting the message.
  • This led to transactions always rolling back and no buffered messages actually being saved.

Causes

  • The code did not properly detect or handle MlsException.BufferedFutureMessage (wrapped in CoreCryptoException.Mls) within the transactional decryption flow.
  • As a result, any out-of-order commit triggered a rollback, preventing buffering logic from persisting the messages that should be processed later.

Solutions

  • Updated the decryptMessage flow to wrap calls in a transactional API and specifically catch BufferedFutureMessage exceptions, allowing the transaction to commit and the message to be buffered rather than rolled back.
  • Added tests verifying that out-of-order commits no longer throw exceptions and that previously buffered commits are eventually flushed once the missing epoch is processed.

Copy link
Contributor

github-actions bot commented Feb 21, 2025

Test Results

3 367 tests   3 257 ✅  5m 32s ⏱️
  572 suites    110 💤
  572 files        0 ❌

Results for commit a955880.

♻️ This comment has been updated with latest results.

@Garzas Garzas requested a review from typfel February 21, 2025 12:44
@datadog-wireapp
Copy link

datadog-wireapp bot commented Feb 21, 2025

Datadog Report

Branch report: fix/suppress-mls-buffer-error
Commit report: 4546218
Test service: kalium-jvm

✅ 0 Failed, 3257 Passed, 110 Skipped, 1m 3.27s Total Time

Copy link
Member

@MohamadJaara MohamadJaara left a comment

Choose a reason for hiding this comment

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

LGTM

@Garzas Garzas enabled auto-merge February 21, 2025 13:13
@MohamadJaara MohamadJaara added this pull request to the merge queue Feb 21, 2025
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (release/candidate@7baa25a). Learn more about missing BASE report.

Additional details and impacted files
@@                 Coverage Diff                  @@
##             release/candidate    #3305   +/-   ##
====================================================
  Coverage                     ?   54.54%           
====================================================
  Files                        ?     1252           
  Lines                        ?    36684           
  Branches                     ?     3740           
====================================================
  Hits                         ?    20008           
  Misses                       ?    15253           
  Partials                     ?     1423           

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 7baa25a...a955880. Read the comment docs.

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 21, 2025
@MohamadJaara MohamadJaara merged commit 58cc378 into release/candidate Feb 21, 2025
20 checks passed
@MohamadJaara MohamadJaara deleted the fix/suppress-mls-buffer-error branch February 21, 2025 13:55
github-actions bot pushed a commit that referenced this pull request Feb 21, 2025
…3305)

* fix: suppress buffer error for mls decrypt transaction

* detekt fix

* error check fix

* detekt fix
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