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 olm session proliferation #6535

Merged
merged 2 commits into from
Jul 15, 2022

Conversation

BillCarsonFr
Copy link
Member

@BillCarsonFr BillCarsonFr commented Jul 13, 2022

Type of change

  • Bugfix

Content

When a to_device olm message cannot be decrypted (BAD_ENCRYPTED_MESSAGE), the sending devices was marked as wedged (ratchet got desync).
In order to fix it, the SDK will automatically try to refresh the session with this device by creating a new session and sending a new dummy prekey message.
This unwedging mechanism can only be done once per hour.

The issue is that when a device was marked as wedged it was never removed later. Meaning that if the app stayed on for long, a new olm session will be created every hour. This could explain the proliferation of olm sessions noticed in some logs:
Fixes #6534

Motivation and context

Screenshots / GIFs

Tests

Can be tested by commenting out persisting olm sessions in the code, then force discard session and send messages. Kill/Restart the sending device will then restore an old ratchet version causing a desync.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes has been tested on an Android device or Android emulator with API 21
  • Pull request is based on the develop branch
  • You've made a self review of your PR

@BillCarsonFr BillCarsonFr requested review from a team and yostyle and removed request for a team July 13, 2022 09:59
Copy link
Contributor

@yostyle yostyle left a comment

Choose a reason for hiding this comment

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

LGTM
please just fix the lint issue

@BillCarsonFr BillCarsonFr force-pushed the feature/bca/crypto_olm_proliferation branch from 2ffb006 to e8bd7ea Compare July 15, 2022 12:17
@BillCarsonFr BillCarsonFr enabled auto-merge July 15, 2022 12:42
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

87.5% 87.5% Coverage
0.0% 0.0% Duplication

@BillCarsonFr BillCarsonFr merged commit 90c177c into develop Jul 15, 2022
@BillCarsonFr BillCarsonFr deleted the feature/bca/crypto_olm_proliferation branch July 15, 2022 14:03
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.

Proliferation of olm session
2 participants