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

One time keys upload can try to upload the same key again #3721

Closed
manuroe opened this issue Oct 5, 2020 · 3 comments
Closed

One time keys upload can try to upload the same key again #3721

manuroe opened this issue Oct 5, 2020 · 3 comments
Labels
A-E2EE P1 T-Defect Something isn't working: bugs, crashes, hangs and other reported problems
Milestone

Comments

@manuroe
Copy link
Member

manuroe commented Oct 5, 2020

There is probably a bad management of network errors when uploading them.

The server answers:

{
    errcode = "M_UNKNOWN";
    error = "One time key signed_curve25519:AAABVQ already exists. Old key: ...."
}

The application is then stuck in this configuration and cannot upload new keys.
The error even pops up as a modal if you clear the cache from app settings.

@manuroe manuroe added this to the Sprint 32 milestone Oct 5, 2020
@manuroe
Copy link
Member Author

manuroe commented Oct 7, 2020

This is not a network management error. I don't know the reason of this error yet but it leads to UISIs.

The reason is that the SDK keeps trying to upload its local OTKs and getting the same error until the existing OTK published on the server is consumed. Then, the upload succeeds and an OTK with an already used ID is published on the server.
The next device that will try to establish a session with this device will fail with a OLM error BAD_MESSAGE_KEY_ID.

@manuroe manuroe added T-Defect Something isn't working: bugs, crashes, hangs and other reported problems A-E2EE P1 labels Oct 7, 2020
manuroe added a commit to matrix-org/matrix-ios-sdk that referenced this issue Oct 8, 2020
This is a mitigation for element-hq/element-ios#3721. But it does not fix the root issue.
@manuroe
Copy link
Member Author

manuroe commented Oct 8, 2020

This issue is a bit hard to reproduce outside a real usage for severals days. The quickest way I found is to:

  1. Hack those methods:
- (void)markOneTimeKeysAsPublished
{
    [olmAccount markOneTimeKeysAsPublished];

    //[store storeAccount:olmAccount];
}

- (void)generateOneTimeKeys:(NSUInteger)numKeys
{
    [olmAccount generateOneTimeKeys:1];

    //[store storeAccount:olmAccount];
}
  1. Log on a new device
  2. Restart the app

As we upload only 1 OTK at the time, at the step #3, we will try to upload a key with an existing id.

manuroe added a commit to matrix-org/matrix-ios-sdk that referenced this issue Oct 8, 2020
This is a mitigation for element-hq/element-ios#3721. But it does not fix the root issue.
@manuroe
Copy link
Member Author

manuroe commented Oct 9, 2020

Should be fixed by the merged PR.

@manuroe manuroe closed this as completed Oct 9, 2020
giomfo referenced this issue in tchapgouv/tchap-ios Nov 17, 2020
To get "E2EE: One time keys upload can try to upload the same key again" (vector-im#3721)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-E2EE P1 T-Defect Something isn't working: bugs, crashes, hangs and other reported problems
Projects
None yet
Development

No branches or pull requests

1 participant