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

Private Profile Photos #2151

Merged
merged 13 commits into from
Sep 30, 2021
Merged

Private Profile Photos #2151

merged 13 commits into from
Sep 30, 2021

Conversation

Samyoul
Copy link
Member

@Samyoul Samyoul commented Feb 12, 2021

What has changed?

Settings

I've added a new setting profilePicturesShowTo which has three options for whom should see the user's profile picture:

  • ProfilePicturesShowToContactsOnly - shows only to the user's contacts default
  • ProfilePicturesShowToEveryone - shows their profile image to everyone
  • ProfilePicturesShowToNone - shows their profile image to no-one, even if an image is set.

I've also added functionality that does the following:

On Sending

  • If setting profilePicturesShowTo is set to ProfilePicturesShowToContactsOnly
  • Create an AES encryption key and encrypt all the user's identity image payloads
  • Replace the plain payload with the encrypted payload
  • Encrypt the encryption AES key using ECDH AES encryption for each of the user's contacts
  • Attach all the encrypted encryption AES key payloads to the IdentityImage protobuf
  • Send the protobuf as usual

On Receiving

  • For every ChatIdentity that is received attempt to decrypt any attached IdentityImages
    • loop through all encrypted encryption AES key payloads
    • If a encrypted encryption AES key payload can be decrypted using an ECDH key between sender and recipient
    • attempt to decrypt the encrypted image payload
    • on success replace the encrypted payload with the plain decrypted payload
  • After the decryption process any images that remain encrypted are discarded and not processed any further
  • Otherwise process the images as usual

Why make the change?

In line with offering a privacy first product images and the concerns raised in status-im/status#56 this change was introduced to ensure a user could use profile images without sharing their image with everyone they interacted with on Status if they so choose not to.

@ghost
Copy link

ghost commented Feb 12, 2021

Pull Request Checklist

  • Have you updated the documentation, if impacted (e.g. docs.status.im)?

@status-im-auto
Copy link
Member

status-im-auto commented Feb 12, 2021

Jenkins Builds

Click to see older builds (178)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 033e76f #1 2021-02-12 13:10:26 ~2 min linux 📦zip
✔️ 033e76f #1 2021-02-12 13:12:14 ~4 min ios 📦zip
✔️ 033e76f #1 2021-02-12 13:14:11 ~6 min android 📦aar
✔️ d5be3c5 #2 2021-02-12 15:38:45 ~2 min linux 📦zip
✔️ d5be3c5 #2 2021-02-12 15:38:45 ~2 min ios 📦zip
✔️ d5be3c5 #2 2021-02-12 15:43:51 ~7 min android 📦aar
✔️ c1ccb8f #3 2021-02-15 17:45:16 ~2 min ios 📦zip
✔️ c1ccb8f #3 2021-02-15 17:45:42 ~2 min linux 📦zip
✔️ c1ccb8f #3 2021-02-15 17:48:27 ~5 min android 📦aar
✔️ 4d9fe72 #4 2021-02-16 12:18:54 ~2 min ios 📦zip
✔️ 4d9fe72 #4 2021-02-16 12:21:34 ~6 min android 📦aar
✔️ 4d9fe72 #4 2021-02-16 12:23:12 ~7 min linux 📦zip
✔️ 0c68a8c #5 2021-02-16 16:16:07 ~2 min linux 📦zip
✔️ 0c68a8c #5 2021-02-16 16:18:22 ~4 min ios 📦zip
✔️ 0c68a8c #5 2021-02-16 16:20:21 ~6 min android 📦aar
✔️ e83c4df #6 2021-02-17 23:16:51 ~1 min ios 📦zip
✔️ e83c4df #6 2021-02-17 23:16:57 ~1 min linux 📦zip
✔️ e83c4df #6 2021-02-17 23:21:10 ~5 min android 📦aar
✔️ d0c986c #7 2021-02-18 14:38:32 ~1 min ios 📦zip
✔️ d0c986c #7 2021-02-18 14:39:07 ~2 min linux 📦zip
✔️ d0c986c #7 2021-02-18 14:41:27 ~4 min android 📦aar
✔️ 69541c5 #8 2021-02-18 14:43:53 ~1 min ios 📦zip
✔️ 69541c5 #8 2021-02-18 14:43:56 ~1 min linux 📦zip
✔️ 69541c5 #8 2021-02-18 14:47:06 ~4 min android 📦aar
✔️ dbf1d88 #9 2021-02-18 14:49:57 ~2 min linux 📦zip
✔️ dbf1d88 #9 2021-02-18 14:49:59 ~2 min ios 📦zip
✔️ dbf1d88 #9 2021-02-18 14:53:53 ~5 min android 📦aar
✔️ 7b0751c #10 2021-02-18 15:16:51 ~1 min ios 📦zip
✔️ 7b0751c #10 2021-02-18 15:17:51 ~2 min linux 📦zip
✔️ 7b0751c #10 2021-02-18 15:21:35 ~6 min android 📦aar
✔️ a748542 #11 2021-02-18 15:28:52 ~1 min ios 📦zip
✔️ a748542 #11 2021-02-18 15:29:02 ~1 min linux 📦zip
✔️ a748542 #11 2021-02-18 15:32:24 ~5 min android 📦aar
✔️ 0328607 #12 2021-02-18 15:46:47 ~1 min ios 📦zip
✔️ 0328607 #12 2021-02-18 15:46:59 ~1 min linux 📦zip
✔️ 0328607 #12 2021-02-18 15:51:07 ~6 min android 📦aar
✔️ 5f2a731 #13 2021-02-18 15:48:17 ~1 min ios 📦zip
✔️ 5f2a731 #13 2021-02-18 15:48:48 ~1 min linux 📦zip
✔️ 5f2a731 #13 2021-02-18 15:56:38 ~5 min android 📦aar
✔️ ff8d248 #14 2021-02-19 17:00:19 ~1 min linux 📦zip
✔️ ff8d248 #14 2021-02-19 17:00:42 ~2 min ios 📦zip
✔️ ff8d248 #14 2021-02-19 17:03:35 ~5 min android 📦aar
✔️ 28a87ec #15 2021-02-26 15:11:59 ~1 min linux 📦zip
✔️ 28a87ec #15 2021-02-26 15:13:48 ~3 min ios 📦zip
✔️ 28a87ec #15 2021-02-26 15:15:33 ~5 min android 📦aar
✔️ bb9f1c2 #16 2021-03-01 17:27:39 ~12 min android 📦aar
✔️ bb9f1c2 #16 2021-03-01 17:28:39 ~13 min linux 📦zip
✔️ bb9f1c2 #16 2021-03-01 17:57:23 ~42 min ios 📦zip
319dfce #17 2021-03-04 16:24:42 ~49 sec android 📄log
✔️ 319dfce #17 2021-03-04 16:25:58 ~2 min linux 📦zip
✔️ 319dfce #17 2021-03-04 16:28:48 ~4 min ios 📦zip
319dfce #18 2021-03-04 16:44:22 ~34 sec android 📄log
319dfce #19 2021-03-04 17:01:18 ~11 sec android 📄log
319dfce #20 2021-03-05 08:03:39 ~12 sec android 📄log
319dfce #21 2021-03-05 08:05:20 ~7.2 sec android 📄log
319dfce #22 2021-03-05 08:11:46 ~4.5 sec android 📄log
319dfce #23 2021-03-05 08:33:43 ~4 min android 📄log
319dfce #24 2021-03-05 08:43:31 ~6 min android 📄log
✔️ 319dfce #25 2021-03-05 08:56:05 ~5 min android 📦aar
✔️ a3c27f2 #18 2021-03-21 13:36:18 ~2 min linux 📦zip
✔️ a3c27f2 #18 2021-03-21 13:39:34 ~5 min ios 📦zip
✔️ a3c27f2 #26 2021-03-21 13:40:46 ~6 min android 📦aar
✔️ f0ba3c2 #19 2021-03-22 13:48:05 ~2 min linux 📦zip
✔️ f0ba3c2 #19 2021-03-22 13:49:54 ~4 min ios 📦zip
✔️ f0ba3c2 #27 2021-03-22 13:51:49 ~6 min android 📦aar
✔️ 2422883 #20 2021-03-31 10:59:47 ~1 min linux 📦zip
✔️ 2422883 #20 2021-03-31 11:01:30 ~3 min ios 📦zip
✔️ 2422883 #28 2021-03-31 11:04:09 ~6 min android 📦aar
cfe074d #29 2021-04-19 13:02:06 ~1 min android 📄log
cfe074d #21 2021-04-19 13:03:21 ~3 min linux 📄log
cfe074d #21 2021-04-19 13:03:28 ~3 min ios 📄log
✔️ 9db1b50 #22 2021-04-19 15:59:10 ~2 min linux 📦zip
✔️ 9db1b50 #22 2021-04-19 15:59:25 ~3 min ios 📦zip
✔️ 9db1b50 #30 2021-04-19 16:01:46 ~5 min android 📦aar
✔️ 0b8c8e8 #23 2021-04-19 16:04:54 ~1 min linux 📦zip
✔️ 0b8c8e8 #23 2021-04-19 16:06:37 ~3 min ios 📦zip
✔️ 0b8c8e8 #31 2021-04-19 16:09:27 ~6 min android 📦aar
✔️ 3e249cd #24 2021-04-20 10:01:21 ~1 min ios 📦zip
✔️ 3e249cd #24 2021-04-20 10:01:59 ~2 min linux 📦zip
✔️ 3e249cd #32 2021-04-20 10:04:00 ~4 min android 📦aar
✔️ 45316ef #25 2021-04-27 15:27:53 ~2 min linux 📦zip
✔️ 45316ef #33 2021-04-27 15:32:21 ~7 min android 📦aar
✔️ 99dff9c #26 2021-04-27 15:49:43 ~2 min linux 📦zip
✔️ 99dff9c #26 2021-04-27 15:51:50 ~4 min ios 📦zip
✔️ 99dff9c #34 2021-04-27 15:53:45 ~6 min android 📦aar
28b6b93 #35 2021-06-07 14:41:47 ~10 min android 📄log
28b6b93 #27 2021-06-07 14:41:56 ~10 min ios 📄log
✔️ 28b6b93 #27 2021-06-07 14:44:03 ~13 min linux 📦zip
e67a6da #36 2021-08-09 12:46:24 ~1 min android 📄log
e67a6da #28 2021-08-09 12:47:20 ~2 min ios 📄log
✔️ e67a6da #28 2021-08-09 12:48:00 ~2 min linux 📦zip
✔️ 236acd2 #29 2021-08-10 12:56:05 ~3 min linux 📦zip
✔️ 236acd2 #29 2021-08-10 12:56:21 ~3 min ios 📦zip
✔️ 236acd2 #37 2021-08-10 12:58:57 ~6 min android 📦aar
✔️ a19edfc #30 2021-08-10 13:30:05 ~2 min linux 📦zip
✔️ a19edfc #30 2021-08-10 13:30:48 ~3 min ios 📦zip
✔️ a19edfc #38 2021-08-10 13:35:07 ~7 min android 📦aar
✔️ 195db56 #31 2021-08-10 13:37:39 ~2 min linux 📦zip
✔️ 195db56 #31 2021-08-10 13:38:01 ~2 min ios 📦zip
✔️ 195db56 #39 2021-08-10 13:41:26 ~6 min android 📦aar
✔️ 88826d8 #32 2021-08-17 12:28:56 ~2 min linux 📦zip
✔️ 88826d8 #32 2021-08-17 12:29:29 ~3 min ios 📦zip
✔️ 88826d8 #40 2021-08-17 12:33:28 ~7 min android 📦aar
✔️ c69c265 #33 2021-08-18 13:18:36 ~2 min linux 📦zip
✔️ c69c265 #33 2021-08-18 13:19:04 ~3 min ios 📦zip
✔️ c69c265 #41 2021-08-18 13:21:18 ~5 min android 📦aar
✔️ 0bf68dd #34 2021-08-21 23:11:54 ~2 min linux 📦zip
✔️ 0bf68dd #34 2021-08-21 23:12:03 ~2 min ios 📦zip
✔️ 0bf68dd #42 2021-08-21 23:14:35 ~4 min android 📦aar
✔️ 25aa6bd #35 2021-08-27 12:48:34 ~2 min linux 📦zip
✔️ 25aa6bd #35 2021-08-27 12:49:01 ~3 min ios 📦zip
✔️ 25aa6bd #43 2021-08-27 12:51:55 ~5 min android 📦aar
✔️ d94d44c #36 2021-09-01 10:40:33 ~2 min linux 📦zip
✔️ d94d44c #36 2021-09-01 10:40:52 ~2 min ios 📦zip
✔️ d94d44c #44 2021-09-01 10:45:00 ~6 min android 📦aar
✔️ 09fbc16 #37 2021-09-01 12:24:44 ~1 min ios 📦zip
✔️ 09fbc16 #37 2021-09-01 12:25:12 ~2 min linux 📦zip
✔️ 09fbc16 #45 2021-09-01 12:27:42 ~4 min android 📦aar
✔️ 43c3657 #38 2021-09-01 12:31:06 ~1 min ios 📦zip
✔️ 43c3657 #38 2021-09-01 12:31:21 ~2 min linux 📦zip
✔️ 43c3657 #46 2021-09-01 12:35:31 ~6 min android 📦aar
✔️ f07b89c #39 2021-09-01 12:57:37 ~1 min linux 📦zip
✔️ f07b89c #39 2021-09-01 12:57:55 ~2 min ios 📦zip
✔️ f07b89c #47 2021-09-01 13:00:26 ~4 min android 📦aar
✔️ 8215932 #40 2021-09-01 13:37:17 ~2 min linux 📦zip
✔️ 8215932 #40 2021-09-01 13:37:18 ~2 min ios 📦zip
✔️ 8215932 #48 2021-09-01 13:39:48 ~5 min android 📦aar
✔️ ff980f4 #41 2021-09-08 13:18:45 ~3 min linux 📦zip
✔️ ff980f4 #41 2021-09-08 13:19:17 ~3 min ios 📦zip
✔️ ff980f4 #49 2021-09-08 13:23:38 ~7 min android 📦aar
✔️ 8774ed8 #42 2021-09-14 11:15:34 ~2 min linux 📦zip
✔️ 8774ed8 #42 2021-09-14 11:16:06 ~3 min ios 📦zip
✔️ 8774ed8 #50 2021-09-14 11:19:32 ~6 min android 📦aar
aac30bf #51 2021-09-21 15:17:19 ~2 min android 📄log
aac30bf #43 2021-09-21 15:17:23 ~2 min ios 📄log
aac30bf #43 2021-09-21 15:17:52 ~2 min linux 📄log
✔️ 0b6a7a4 #44 2021-09-21 15:23:58 ~6 min ios 📦zip
✔️ 0b6a7a4 #44 2021-09-21 15:26:06 ~8 min linux 📦zip
✔️ 0b6a7a4 #52 2021-09-21 15:29:33 ~11 min android 📦aar
✔️ 4f4dc02 #45 2021-09-21 22:10:30 ~2 min ios 📦zip
✔️ 4f4dc02 #45 2021-09-21 22:10:44 ~2 min linux 📦zip
✔️ 4f4dc02 #53 2021-09-21 22:13:40 ~5 min android 📦aar
✔️ 4165126 #46 2021-09-21 22:18:16 ~1 min ios 📦zip
✔️ 4165126 #46 2021-09-21 22:18:38 ~1 min linux 📦zip
✔️ 4165126 #54 2021-09-21 22:20:58 ~4 min android 📦aar
✔️ 44658d4 #47 2021-09-21 22:20:05 ~1 min ios 📦zip
✔️ 44658d4 #47 2021-09-21 22:21:04 ~2 min linux 📦zip
✔️ 851f5c0 #48 2021-09-21 22:22:36 ~2 min ios 📦zip
✔️ 851f5c0 #48 2021-09-21 22:23:17 ~2 min linux 📦zip
✔️ 851f5c0 #55 2021-09-21 22:25:37 ~4 min android 📦aar
✔️ 2244c91 #49 2021-09-21 22:33:12 ~1 min ios 📦zip
✔️ 2244c91 #56 2021-09-21 22:36:27 ~5 min android 📦aar
✔️ 2244c91 #49 2021-09-21 22:36:37 ~5 min linux 📦zip
✔️ ed4b5ab #50 2021-09-21 22:36:24 ~3 min ios 📦zip
✔️ 0f78952 #51 2021-09-21 22:38:16 ~1 min ios 📦zip
✔️ 0f78952 #50 2021-09-21 22:39:25 ~2 min linux 📦zip
✔️ 0f78952 #57 2021-09-21 22:40:34 ~4 min android 📦aar
✔️ 02ea1af #51 2021-09-22 09:36:52 ~2 min linux 📦zip
✔️ 02ea1af #52 2021-09-22 09:38:58 ~4 min ios 📦zip
✔️ 02ea1af #58 2021-09-22 09:39:25 ~4 min android 📦aar
✔️ ed3d376 #53 2021-09-24 21:28:00 ~2 min ios 📦zip
✔️ ed3d376 #52 2021-09-24 21:28:00 ~2 min linux 📦zip
✔️ ed3d376 #59 2021-09-24 21:30:24 ~5 min android 📦aar
✔️ 01d97d6 #53 2021-09-24 21:29:43 ~1 min linux 📦zip
✔️ 01d97d6 #54 2021-09-24 21:29:45 ~1 min ios 📦zip
✔️ 01d97d6 #60 2021-09-24 21:34:17 ~3 min android 📦aar
✔️ 47e8f4b #54 2021-09-24 21:32:21 ~1 min linux 📦zip
✔️ 47e8f4b #55 2021-09-24 21:32:40 ~1 min ios 📦zip
✔️ 47e8f4b #61 2021-09-24 21:38:46 ~4 min android 📦aar
✔️ e1bf444 #55 2021-09-27 11:18:24 ~2 min linux 📦zip
✔️ e1bf444 #56 2021-09-27 11:20:07 ~3 min ios 📦zip
✔️ e1bf444 #62 2021-09-27 11:23:41 ~7 min android 📦aar
✔️ 325ced0 #57 2021-09-29 08:24:07 ~2 min ios 📦zip
✔️ 325ced0 #56 2021-09-29 08:24:19 ~2 min linux 📦zip
✔️ 325ced0 #63 2021-09-29 08:28:32 ~6 min android 📦aar
✔️ 181e494 #57 2021-09-29 08:36:34 ~2 min linux 📦zip
✔️ 181e494 #58 2021-09-29 08:38:05 ~3 min ios 📦zip
✔️ 181e494 #64 2021-09-29 08:39:04 ~5 min android 📦aar
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ d25b281 #58 2021-09-29 14:57:21 ~3 min linux 📦zip
✔️ d25b281 #59 2021-09-29 15:01:04 ~6 min ios 📦zip
✔️ d25b281 #65 2021-09-29 15:01:58 ~7 min android 📦aar
✔️ a73aaab #60 2021-09-30 11:52:56 ~2 min ios 📦zip
✔️ a73aaab #59 2021-09-30 11:53:09 ~2 min linux 📦zip
✔️ a73aaab #66 2021-09-30 11:55:39 ~5 min android 📦aar

@Samyoul Samyoul self-assigned this Feb 15, 2021
@Samyoul Samyoul marked this pull request as ready for review February 18, 2021 15:36
Copy link
Contributor

@cammellos cammellos left a comment

Choose a reason for hiding this comment

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

Looks good to me, the only question I have, what happens to old client if they receive an encrypted image?
If they drop it/don't display it, it's all fine, if they show some garbled picture then we might want to use a separate field for the encrypted image in protobuf.

@Samyoul
Copy link
Member Author

Samyoul commented Feb 19, 2021

Looks good to me, the only question I have, what happens to old client if they receive an encrypted image?

Excellent point. So the image payload is passed by the HandleChatIdentity func to images.GetPayloadDataURI() and would almost 100% get a image format not supported error which would trigger a logger.Warn("failed to handle ChatIdentity", zap.Error(err)) and set allMessagesProcessed to false. Which I think is safe behaviour.


Although that would trigger for any image payload that is encrypted on the ChatIdentity. At the moment a ChatIdentity only has a total of 2 potential image payloads (thumbnail and large), but in the future this may not be the case (some maybe encrypted and other not ... maybe).

I've also realised that a single image parsing error would cause all of the attached images to be rejected, I've added a TODO to this functionality I'll address it in another PR.

Also I've realised that a single IdentityImage parse failure would result in the entire ChatIdentity parse to fail, that needs addressing also.

@Samyoul Samyoul force-pushed the feature/private-profile-photos branch 2 times, most recently from bb9f1c2 to 319dfce Compare March 4, 2021 16:23
@Samyoul Samyoul force-pushed the feature/private-profile-photos branch from 319dfce to a3c27f2 Compare March 21, 2021 13:34
@Samyoul Samyoul force-pushed the feature/private-profile-photos branch from f0ba3c2 to 2422883 Compare March 31, 2021 10:57
@Samyoul
Copy link
Member Author

Samyoul commented Apr 15, 2021

Awaiting a successful manual test of status-im/status-mobile#11768 before merge of this PR

@Samyoul Samyoul force-pushed the feature/private-profile-photos branch 2 times, most recently from 0b8c8e8 to 3e249cd Compare April 20, 2021 09:59
@Samyoul Samyoul force-pushed the feature/private-profile-photos branch from 3e249cd to 45316ef Compare April 27, 2021 15:24
@Samyoul Samyoul force-pushed the feature/private-profile-photos branch from 99dff9c to 28b6b93 Compare June 7, 2021 14:30
@ghost
Copy link

ghost commented Aug 5, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@ghost ghost added the stale label Aug 5, 2021
@Samyoul Samyoul force-pushed the feature/private-profile-photos branch from 28b6b93 to e67a6da Compare August 9, 2021 12:45
@ghost ghost removed the stale label Aug 9, 2021
@Samyoul Samyoul force-pushed the feature/private-profile-photos branch 2 times, most recently from 195db56 to 88826d8 Compare August 17, 2021 12:25
@Samyoul Samyoul force-pushed the feature/private-profile-photos branch 2 times, most recently from c69c265 to 0bf68dd Compare August 21, 2021 23:09
@Samyoul Samyoul force-pushed the feature/private-profile-photos branch 3 times, most recently from 43c3657 to f07b89c Compare September 1, 2021 12:55
@Samyoul Samyoul force-pushed the feature/private-profile-photos branch 3 times, most recently from 2244c91 to ed4b5ab Compare September 21, 2021 22:31
@Samyoul Samyoul requested review from cammellos and removed request for vkjr September 21, 2021 22:32
@Samyoul Samyoul force-pushed the feature/private-profile-photos branch from ed4b5ab to 0f78952 Compare September 21, 2021 22:34
Copy link
Contributor

@cammellos cammellos left a comment

Choose a reason for hiding this comment

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

looks good, just some extra logs

protocol/messenger.go Outdated Show resolved Hide resolved
@Samyoul Samyoul force-pushed the feature/private-profile-photos branch 5 times, most recently from 47e8f4b to e1bf444 Compare September 27, 2021 11:16
@cammellos cammellos force-pushed the feature/private-profile-photos branch from 325ced0 to 181e494 Compare September 29, 2021 08:33
@cammellos cammellos force-pushed the feature/private-profile-photos branch from d25b281 to a73aaab Compare September 30, 2021 11:50
@cammellos cammellos merged commit 51493d6 into develop Sep 30, 2021
@cammellos cammellos deleted the feature/private-profile-photos branch September 30, 2021 12:02
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.

3 participants