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(PublicSessionKeyStore): Include nodeId in scope #306

Merged
merged 1 commit into from
Dec 17, 2023

Conversation

gnarea
Copy link
Member

@gnarea gnarea commented Dec 17, 2023

No description provided.

@gnarea gnarea added the automerge Allow kodiak to automerge commit when all checks pass label Dec 17, 2023
@kodiakhq kodiakhq bot merged commit 1af4853 into master Dec 17, 2023
11 checks passed
@kodiakhq kodiakhq bot deleted the session-key-store-nodeid branch December 17, 2023 16:12
Copy link

🎉 This PR is included in version 1.68.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

gnarea added a commit to relaycorp/awala-keystore-file-jvm that referenced this pull request Dec 17, 2023
kodiakhq bot pushed a commit to relaycorp/awala-keystore-file-jvm that referenced this pull request Dec 17, 2023
gnarea added a commit to relaycorp/awala-endpoint-android that referenced this pull request Dec 18, 2023
…e third-party endpoint

Due to bugs in the key stores (relaycorp/awala-jvm#306, relaycorp/awala-jvm#310), we were accidentally reusing the same session keys, which the third-party endpoint rightfully refused.

This PR will integrate the two breaking changes above, plus one additional change needed to make this work.

A consequence of this change is that **we'll now need to pass the linked first-party endpoint when importing and deleting a third-party endpoint**, so that we know which session keys to delete in case the same third-party endpoint is used by another first-party endpoint.

# TODO

- [ ] Pass first-party endpoint to every function call inside `ThirdPartyEndpoint.delete()`:

  https://github.com/relaycorp/awala-endpoint-android/blob/6ecb5345d67bf29033b0e27a02d91e7d1b35c02a/lib/src/main/java/tech/relaycorp/awaladroid/endpoint/ThirdPartyEndpoint.kt#L31-L36

  This should look like this, roughly (untested):

  ```
      public open suspend fun delete(linkedFirstPartyEndpoint: FirstPartyEndpoint) {
          val context = Awala.getContextOrThrow()
          context.privateKeyStore.deleteBoundSessionKeys(linkedFirstPartyEndpoint.nodeId, nodeId)
          context.sessionPublicKeyStore.delete(linkedFirstPartyEndpoint.nodeId, nodeId)
          context.channelManager.delete(linkedFirstPartyEndpoint, this)
      }
  ```
- Replace `delete(ThirdPartyEndpoint)` in `ChannelManager` with `delete(FirstPartyEndpoint, ThirdPartyEndpoint)`, and only delete the items for the given first-/third-party endpoint pair. This change is needed by the previous task.
- Replace `import(ByteArray)` in `PrivateThirdPartyEndpoint` with `import(ByteArray, FirstPartyEndpoint)`, and pass the first-party endpoint to

  https://github.com/relaycorp/awala-endpoint-android/blob/6ecb5345d67bf29033b0e27a02d91e7d1b35c02a/lib/src/main/java/tech/relaycorp/awaladroid/endpoint/ThirdPartyEndpoint.kt#L183
- Replace `import(ByteArray)` in `PublicThirdPartyEndpoint` with `import(ByteArray, FirstPartyEndpoint)`, and pass the first-party endpoint to

  https://github.com/relaycorp/awala-endpoint-android/blob/6ecb5345d67bf29033b0e27a02d91e7d1b35c02a/lib/src/main/java/tech/relaycorp/awaladroid/endpoint/ThirdPartyEndpoint.kt#L249-L252
kodiakhq bot pushed a commit to relaycorp/awala-endpoint-android that referenced this pull request Dec 26, 2023
…e third-party endpoint (#361)

Due to bugs in the key stores (relaycorp/awala-jvm#306, relaycorp/awala-jvm#310), we were accidentally reusing the same session keys, which the third-party endpoint rightfully refused.

This PR will integrate the two breaking changes above, plus one additional change needed to make this work.

A consequence of this change is that **we'll now need to pass the linked first-party endpoint when importing and deleting a third-party endpoint**, so that we know which session keys to delete in case the same third-party endpoint is used by another first-party endpoint.

# TODO

Each of the following require updating the respective test suite.

- [x] Pass first-party endpoint to every function call inside `ThirdPartyEndpoint.delete()`:

  https://github.com/relaycorp/awala-endpoint-android/blob/6ecb5345d67bf29033b0e27a02d91e7d1b35c02a/lib/src/main/java/tech/relaycorp/awaladroid/endpoint/ThirdPartyEndpoint.kt#L31-L36

  This should look like this, roughly (untested):

  ```kotlin
  public open suspend fun delete(linkedFirstPartyEndpoint: FirstPartyEndpoint) {
    val context = Awala.getContextOrThrow()
    context.privateKeyStore.deleteBoundSessionKeys(linkedFirstPartyEndpoint.nodeId, nodeId) 
    context.sessionPublicKeyStore.delete(linkedFirstPartyEndpoint.nodeId, nodeId) 
    context.channelManager.delete(linkedFirstPartyEndpoint, this)
  }
  ```
- [x] Replace `delete(ThirdPartyEndpoint)` in `ChannelManager` with `delete(FirstPartyEndpoint, ThirdPartyEndpoint)`, and only delete the items for the given first-/third-party endpoint pair. This change is needed by the previous task.
- [x] Replace `import(ByteArray)` in `PrivateThirdPartyEndpoint` with `import(ByteArray, FirstPartyEndpoint)`, and pass the first-party endpoint to

  https://github.com/relaycorp/awala-endpoint-android/blob/6ecb5345d67bf29033b0e27a02d91e7d1b35c02a/lib/src/main/java/tech/relaycorp/awaladroid/endpoint/ThirdPartyEndpoint.kt#L183
- [x] Replace `import(ByteArray)` in `PublicThirdPartyEndpoint` with `import(ByteArray, FirstPartyEndpoint)`, and pass the first-party endpoint to

  https://github.com/relaycorp/awala-endpoint-android/blob/6ecb5345d67bf29033b0e27a02d91e7d1b35c02a/lib/src/main/java/tech/relaycorp/awaladroid/endpoint/ThirdPartyEndpoint.kt#L249-L252
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Allow kodiak to automerge commit when all checks pass released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant