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

Support misconfigured room encryption #4726

Merged
merged 11 commits into from
Jan 11, 2022

Conversation

BillCarsonFr
Copy link
Member

@BillCarsonFr BillCarsonFr commented Dec 15, 2021

Fixes #4711

Better handlind of misconfigured encryption in room.
More details here element-hq/element-meta#69

When encryption is misconfigured the text composer will be disabled to deny sending (would fail anyhow)

Admin would have a button in settings to restore encryption

image

@BillCarsonFr BillCarsonFr force-pushed the feature/bca/proper_encryption_state branch from b861fba to 4bc0d07 Compare December 15, 2021 16:01
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

LGTM, some small remarks.

@@ -43,9 +43,23 @@ sealed interface SendMode {
data class Voice(val text: String) : SendMode
}

sealed class CanSendStatus {
Copy link
Member

Choose a reason for hiding this comment

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

We can use sealed interface now.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

obeservePowerLevels()
}

private fun obeservePowerLevels() {
Copy link
Member

Choose a reason for hiding this comment

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

small typo here.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@@ -959,6 +959,7 @@
<string name="room_delete_unsent_messages">Delete unsent messages</string>
<string name="room_message_file_not_found">File not found</string>
<string name="room_do_not_have_permission_to_post">You do not have permission to post to this room.</string>
<string name="room_unsupported_e2e_algorithm">Encryption has been misconfigured. You can\'t send messages, please contact an admin to restore the room to a valid state.</string>
Copy link
Member

Choose a reason for hiding this comment

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

Do we show this message even when the user IS an admin?
If yes, we could probably add a way to open the settings in this case.

Copy link
Member Author

Choose a reason for hiding this comment

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

added

Copy link
Member

Choose a reason for hiding this comment

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

You added a way to open the setting, but maybe also update the message for admins to:
Encryption has been misconfigured. You can\'t send messages. Click to open the settings to restore the room to a valid state.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@github-actions
Copy link

github-actions bot commented Dec 15, 2021

Unit Test Results

  66 files  ±0    66 suites  ±0   58s ⏱️ -3s
135 tests ±0  135 ✔️ ±0  0 💤 ±0  0 ±0 
418 runs  ±0  418 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 60ae416. ± Comparison against base commit 3251463.

♻️ This comment has been updated with latest results.

@BillCarsonFr
Copy link
Member Author

@amshakal Could you please review and provide copy/icons updates. Idealy a link to a figma in element-hq/element-meta#69

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

Thanks for the update. LGTM!

Just a small though, which should happen rarely: will it be possible to use the quick reply from a notification to send a message to a mis-configured room?

-> Maybe block the send message API at the SDK level and not only on the UI ?

@bmarty bmarty requested a review from amshakal December 30, 2021 11:44
@@ -2795,8 +2797,11 @@
<string name="room_profile_not_encrypted_subtitle">Messages in this room are not end-to-end encrypted.</string>
<string name="direct_room_profile_not_encrypted_subtitle">Messages here are not end-to-end encrypted.</string>
<string name="room_profile_encrypted_subtitle">Messages in this room are end-to-end encrypted.\n\nYour messages are secured with locks and only you and the recipient have the unique keys to unlock them.</string>
<string name="room_profile_encrypted_misconfigured_subtitle">Encryption has been misconfigured. Please contact an admin to restore the room to a valid state.</string>
Copy link
Member

Choose a reason for hiding this comment

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

Please contact an admin to restore the room to a valid state should not be displayed if the user is actually an admin.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

@@ -2795,8 +2797,11 @@
<string name="room_profile_not_encrypted_subtitle">Messages in this room are not end-to-end encrypted.</string>
<string name="direct_room_profile_not_encrypted_subtitle">Messages here are not end-to-end encrypted.</string>
<string name="room_profile_encrypted_subtitle">Messages in this room are end-to-end encrypted.\n\nYour messages are secured with locks and only you and the recipient have the unique keys to unlock them.</string>
<string name="room_profile_encrypted_misconfigured_subtitle">Encryption has been misconfigured. Please contact an admin to restore the room to a valid state.</string>
<string name="direct_room_profile_encrypted_misconfigured_subtitle">Encryption has been misconfigured. Please contact an admin to restore room.</string>
Copy link
Member

Choose a reason for hiding this comment

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

Same remark

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

@BillCarsonFr BillCarsonFr force-pushed the feature/bca/proper_encryption_state branch from 0a31de7 to 3f780cf Compare January 3, 2022 08:15
@amshakal
Copy link

amshakal commented Jan 3, 2022

Linked to design: element-hq/element-meta#69

@BillCarsonFr
Copy link
Member Author

Thanks for the update. LGTM!

Just a small though, which should happen rarely: will it be possible to use the quick reply from a notification to send a message to a mis-configured room?

-> Maybe block the send message API at the SDK level and not only on the UI ?

The sending will fail at SDK level with an unable to encrypt error. But I'll look if I can disable the quick reply action if room is missconfigured

@bmarty
Copy link
Member

bmarty commented Jan 7, 2022

Please also fix:

❌ Error: 'New Vector Ltd' detected 1 time, in file './matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/RoomEncryptionAlgorithm.kt', at line 2.
Rule: "The Matrix.org Foundation C.I.C." copyright is required on this file, and not "New Vector Ltd"

@BillCarsonFr BillCarsonFr force-pushed the feature/bca/proper_encryption_state branch from c56c264 to f326710 Compare January 7, 2022 16:04
@github-actions
Copy link

github-actions bot commented Jan 7, 2022

Ktlint Results

👍 ✅ 👍

@BillCarsonFr
Copy link
Member Author

RoomEncryptionAlgorithm

Fixed

@BillCarsonFr BillCarsonFr force-pushed the feature/bca/proper_encryption_state branch from 9b61fca to d999bfb Compare January 10, 2022 08:40
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

Just a last remark about database migration.

@@ -413,5 +415,29 @@ internal class RealmSessionStoreMigration @Inject constructor(
chunkEntities.deleteAllFromRealm()
}
}

realm.schema.get("RoomSummaryEntity")
Copy link
Member

Choose a reason for hiding this comment

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

Please add a migrateTo21() fun to avoid breaking database for people using latest develop version

Copy link
Member Author

Choose a reason for hiding this comment

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

Done + rebase

Copy link
Member

Choose a reason for hiding this comment

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

Thanks

@BillCarsonFr BillCarsonFr force-pushed the feature/bca/proper_encryption_state branch from 4dd7b4d to dc6030f Compare January 11, 2022 13:56
@BillCarsonFr BillCarsonFr force-pushed the feature/bca/proper_encryption_state branch from dc6030f to 60ae416 Compare January 11, 2022 14:14
@amshakal
Copy link

Can someone post screenshots? I can review it then :)

@bmarty bmarty merged commit 67bdf4b into develop Jan 11, 2022
@bmarty bmarty deleted the feature/bca/proper_encryption_state branch January 11, 2022 15:47
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.

Better handling of misconfigured room encryption
3 participants