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: archive decryption fail #5076

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

igor-sirotin
Copy link
Contributor

Closes status-im/status-desktop#13105

➡️ Pro Tip: review by commits.

The problem was that we kept trying to decrypt the archives in a loop, though we obviously didn't have hash ratchet keys for it (for the archives themselves, not the messages inside). The fix is to postpone the next attempt import attempt. If we don't have the key for this archive, we don't have all the further ones as well.

I also wrote a test that ensures that the the archive protocol works properly for the community channel-level encryption.

@status-im-auto
Copy link
Member

status-im-auto commented Apr 18, 2024

Jenkins Builds

Click to see older builds (36)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 1c44746 #1 2024-04-18 17:10:45 ~3 min linux 📦zip
✔️ 1c44746 #1 2024-04-18 17:12:18 ~5 min ios 📦zip
✔️ 1c44746 #1 2024-04-18 17:12:32 ~5 min android 📦aar
✔️ 1c44746 #1 2024-04-18 17:48:22 ~41 min tests 📄log
✖️ b18626c #2 2024-04-19 10:55:11 ~1 min tests 📄log
✔️ b18626c #2 2024-04-19 10:58:27 ~4 min linux 📦zip
✔️ b18626c #2 2024-04-19 10:59:10 ~5 min ios 📦zip
✔️ b18626c #2 2024-04-19 10:59:39 ~5 min android 📦aar
✔️ e45af80 #3 2024-04-19 11:04:11 ~1 min android 📦aar
✔️ e45af80 #3 2024-04-19 11:06:11 ~3 min ios 📦zip
✔️ e45af80 #3 2024-04-19 11:06:44 ~4 min linux 📦zip
✔️ e45af80 #3 2024-04-19 11:44:07 ~41 min tests 📄log
✖️ 340656b #4 2024-04-19 16:21:44 ~55 sec tests 📄log
✔️ 340656b #4 2024-04-19 16:23:05 ~2 min linux 📦zip
✔️ 340656b #4 2024-04-19 16:24:03 ~3 min ios 📦zip
✔️ 340656b #4 2024-04-19 16:26:18 ~5 min android 📦aar
9f18f00 #5 2024-05-08 18:52:27 ~31 sec ios 📄log
9f18f00 #5 2024-05-08 18:52:28 ~32 sec android 📄log
✖️ 9f18f00 #5 2024-05-08 18:52:55 ~56 sec tests 📄log
9f18f00 #5 2024-05-08 18:53:15 ~1 min linux 📄log
2ab63b9 #6 2024-05-08 18:56:21 ~24 sec ios 📄log
2ab63b9 #6 2024-05-08 18:56:28 ~31 sec linux 📄log
2ab63b9 #6 2024-05-08 18:56:28 ~32 sec android 📄log
✖️ 2ab63b9 #6 2024-05-08 18:58:10 ~2 min tests 📄log
8d6bcd4 #7 2024-05-08 18:57:06 ~25 sec ios 📄log
8d6bcd4 #7 2024-05-08 18:57:13 ~27 sec android 📄log
8d6bcd4 #7 2024-05-08 18:57:22 ~37 sec linux 📄log
✖️ 8d6bcd4 #7 2024-05-08 18:59:31 ~1 min tests 📄log
✔️ 9156126 #8 2024-05-08 21:58:53 ~3 min linux 📦zip
✔️ 9156126 #8 2024-05-08 21:59:31 ~3 min ios 📦zip
✔️ 9156126 #8 2024-05-08 22:00:26 ~4 min android 📦aar
✖️ 9156126 #8 2024-05-08 22:33:00 ~37 min tests 📄log
✔️ 390506f #9 2024-05-08 23:33:08 ~1 min android 📦aar
✔️ 390506f #9 2024-05-08 23:34:35 ~3 min ios 📦zip
✔️ 390506f #9 2024-05-08 23:35:21 ~3 min linux 📦zip
✖️ 390506f #9 2024-05-09 00:07:42 ~36 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 138505d #10 2024-05-20 13:45:51 ~4 min linux 📦zip
✔️ 138505d #10 2024-05-20 13:47:05 ~5 min android 📦aar
✔️ 138505d #10 2024-05-20 13:47:46 ~5 min ios 📦zip
✖️ 138505d #10 2024-05-20 14:19:54 ~38 min tests 📄log

Copy link
Member

@jrainville jrainville 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! Nice find and test

Copy link
Contributor

@osmaczko osmaczko left a comment

Choose a reason for hiding this comment

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

Very nice test indeed! And a good candidate for -count=1000 👮

@igor-sirotin igor-sirotin force-pushed the fix/archive-decryption-fail branch 2 times, most recently from b18626c to e45af80 Compare April 19, 2024 11:02
@igor-sirotin
Copy link
Contributor Author

And a good candidate for -count=1000 👮

😬

communities_messenger_token_permissions_test.go:1837: 
     Error Trace:	/Users/igorsirotin/Repositories/Status/status-desktop/vendor/status-go/protocol/communities_messenger_token_permissions_test.go:1837
     Error:      	"[]" should have 1 item(s), but has 0
     Test:       	TestMessengerCommunitiesTokenPermissionsSuite/TestImportDecryptedArchiveMessages

@igor-sirotin
Copy link
Contributor Author

So I have 2 main reasons for the test flakiness:

  1. user can't post in community
    Owner sends an unencrypted message because of the members reevaluation race condition.
    Then Bob is able to decrypt the message, but finds the empty members list (because he doesn't have permissions to read channel members)
    Fixed here: Community members reevaluation fixes #5117

  2. failed to decrypt hash {"error": "cipher: message authentication failed"}
    This one is still unobvious. But will be easier to investigate with the changes made.

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.

Infinite importing message archive
4 participants