fix: remove plaintext postMessage fallback in DWeb Connect wallet#79
Open
LiranCohen wants to merge 2 commits into
Open
fix: remove plaintext postMessage fallback in DWeb Connect wallet#79LiranCohen wants to merge 2 commits into
LiranCohen wants to merge 2 commits into
Conversation
Require ECDH-encrypted channel for all DWeb Connect authorization responses. Previously the wallet fell back to sending delegate private keys as plaintext postMessage when the dapp didn't provide an ephemeral public key or when encryption failed. - Deny connection with error if dapp does not send ephemeralPublicKey - Remove try/catch plaintext fallback around encryptPostMessagePayload - Notify dapp of connection failure via error response instead of sending unencrypted key material Companion to enboxorg/enbox#887 (dapp-side fix). Addresses enboxorg/enbox#886.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses enboxorg/enbox#886 (wallet side). Companion to enboxorg/enbox#887 (dapp-side fix).
Removes both plaintext
postMessagefallback paths in the DWeb Connect wallet page, which previously sent delegate private keys, permission grants, and decryption keys unencrypted when the dapp didn't provide an ECDH ephemeral key or when encryption failed.Changes
src/features/connect/DWebConnectPage.tsxephemeralPublicKey, the wallet now sends an{ error: 'encryption_required' }response and shows an error — no private keys leave the wallettry/catcharoundencryptPostMessagePayload()no longer falls back to plaintext. If encryption fails, the error propagates to the outer catch which sends{ error: 'connection_failed' }and shows the error UIWhat was exposed (before this fix)
When either fallback fired, the following were sent as a plain JS object via
postMessage:delegateDid.privateKeysdelegateDecryptionKeysgrantsconnectedDid