Security review remediation: preload/WebSocket/swap DB hardening + wallet directory fix - #64
Open
Alexsanchez06 wants to merge 5 commits into
Open
Security review remediation: preload/WebSocket/swap DB hardening + wallet directory fix#64Alexsanchez06 wants to merge 5 commits into
Alexsanchez06 wants to merge 5 commits into
Conversation
…d swap DB storage
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
Hardens the wallet's internal WebSocket server, swap transaction storage,
external link handling, and swap currency icon loading, and fixes a Windows
crash on wallet directory creation.
Preload bridge / external links
shell.openExternal(preload and main process) now only allowshttps:targets, closing an
file:///UNC/custom-protocol code-execution vector.WebSocket internal server (
backend.js,src/gateway/gateway.js)127.0.0.1instead of all interfaces.receive()wrapped in try/catch so a malformed frame can't crash the process.maxPayloadraised from 1MB to 50MB — the original cap silently broke largeCSV exports (swap/transaction history).
verifyClientorigin check so a stray local browser tab can't opena connection to the app's internal socket.
gateway.js) now actually reconnects with backoff on anunexpected disconnect, plus an error listener and a
readyStateguard onsend(), instead of silently staying dead.Swap history storage (
swap_db.js)response) are now encrypted at rest via Electron's
safeStorage, with aversion-prefixed marker so existing plaintext rows keep working unchanged.
~/Beldexto a properapp-data folder, with migration; the
-wal/-shmsidecar files now movetogether with the main
.dbfile (previously left behind).rather than after tables are written.
Swap currency icons / CSP (
currencyDropDown.vue,electron-main.js,index.template.html)safeImageSrcand the CSPimg-srcdirective now only allowchangelly.com/quickex.io(with subdomains) instead of any HTTPS host,closing a potential image-based tracking/beacon vector.
Wallet directory creation (
backend.js)Windows
EPERMcrash when the wallet data folder can't be created(e.g. blocked by Controlled Folder Access) is now handled gracefully:
retry, then an explicit user consent prompt that requests a one-time
elevated exemption, falling back to a clean error instead of crashing.
Testing
All touched files pass
node --check.Each fix was reviewed line-by-line against the specific behavior it's
meant to close, not just assumed to work from the diff.