-
Notifications
You must be signed in to change notification settings - Fork 333
[WPB-10783] Prevent MLS-Legalhold interactions #4245
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
Changes from all commits
3ecfe18
bc76c97
2911b9c
d486f62
8c45862
0dd5e93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Deny requests for a legalhold device for users who are part of any MLS conversations |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -68,6 +68,7 @@ import Polysemy.Input | |||||||||||||||||
| import Polysemy.TinyLog qualified as P | ||||||||||||||||||
| import System.Logger.Class qualified as Log | ||||||||||||||||||
| import Wire.API.Conversation (ConvType (..)) | ||||||||||||||||||
| import Wire.API.Conversation.Protocol | ||||||||||||||||||
| import Wire.API.Conversation.Role | ||||||||||||||||||
| import Wire.API.Error | ||||||||||||||||||
| import Wire.API.Error.Galley | ||||||||||||||||||
|
|
@@ -345,6 +346,7 @@ requestDevice :: | |||||||||||||||||
| Member (ErrorS 'LegalHoldNotEnabled) r, | ||||||||||||||||||
| Member (ErrorS 'LegalHoldServiceBadResponse) r, | ||||||||||||||||||
| Member (ErrorS 'LegalHoldServiceNotRegistered) r, | ||||||||||||||||||
| Member (ErrorS 'MLSLegalholdIncompatible) r, | ||||||||||||||||||
| Member (ErrorS 'NotATeamMember) r, | ||||||||||||||||||
| Member (ErrorS 'NoUserLegalHoldConsent) r, | ||||||||||||||||||
| Member (ErrorS OperationDenied) r, | ||||||||||||||||||
|
|
@@ -392,6 +394,12 @@ requestDevice lzusr tid uid = do | |||||||||||||||||
| lhs@UserLegalHoldDisabled -> RequestDeviceSuccess <$ provisionLHDevice zusr luid lhs | ||||||||||||||||||
| UserLegalHoldNoConsent -> throwS @'NoUserLegalHoldConsent | ||||||||||||||||||
| where | ||||||||||||||||||
| disallowIfMLSUser :: Local UserId -> Sem r () | ||||||||||||||||||
| disallowIfMLSUser luid = do | ||||||||||||||||||
| void $ iterateConversations luid (toRange (Proxy @500)) $ \convs -> do | ||||||||||||||||||
| when (any (\c -> c.convProtocol /= ProtocolProteus) convs) $ do | ||||||||||||||||||
| throwS @'MLSLegalholdIncompatible | ||||||||||||||||||
|
Comment on lines
+398
to
+401
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gonna leave these too, CI took too long, I'm tired today. |
||||||||||||||||||
|
|
||||||||||||||||||
| -- Wire's LH service that galley is usually calling here is idempotent in device creation, | ||||||||||||||||||
| -- ie. it returns the existing device on multiple calls to `/init`, like here: | ||||||||||||||||||
| -- https://github.com/wireapp/legalhold/blob/e0a241162b9dbc841f12fbc57c8a1e1093c7e83a/src/main/java/com/wire/bots/hold/resource/InitiateResource.java#L42 | ||||||||||||||||||
|
|
@@ -401,6 +409,7 @@ requestDevice lzusr tid uid = do | |||||||||||||||||
| -- device at (almost) the same time. | ||||||||||||||||||
| provisionLHDevice :: UserId -> Local UserId -> UserLegalHoldStatus -> Sem r () | ||||||||||||||||||
| provisionLHDevice zusr luid userLHStatus = do | ||||||||||||||||||
| disallowIfMLSUser luid | ||||||||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe a small comment would be nice as well, even though I won't insist on it, the code is already quite clear.
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Took long enough for CI, I think I won't add it. Feel free to create another PR. |
||||||||||||||||||
| (lastPrekey', prekeys) <- requestDeviceFromService luid | ||||||||||||||||||
| -- We don't distinguish the last key here; brig will do so when the device is added | ||||||||||||||||||
| LegalHoldData.insertPendingPrekeys (tUnqualified luid) (unpackLastPrekey lastPrekey' : prekeys) | ||||||||||||||||||
|
|
||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.