fix: security hardening across IPC, spawn, and debug logging#3
Open
djdanielsson wants to merge 1 commit into
Open
fix: security hardening across IPC, spawn, and debug logging#3djdanielsson wants to merge 1 commit into
djdanielsson wants to merge 1 commit into
Conversation
- Eliminate Windows command injection by replacing shell:true with cmd.exe /c array form in executeBw() - Redact sharedSecret and userKeyB64 from debug log output - Add 10 MB max message size guard on IPC socket to prevent memory exhaustion from a rogue server - Log when BWBIO_IPC_SOCKET_PATH override is active - Document AES-CBC and RSA-OAEP-SHA1 protocol compatibility rationale - Run npm audit fix to resolve 6 dependency vulnerabilities Made-with: Cursor
djdanielsson
force-pushed
the
fix/security-hardening
branch
from
April 4, 2026 02:13
58413a1 to
152e5b0
Compare
Author
|
I used some Claude security skills to run some security audits and these were the findings and fixes for them, some seemed useful so I decided to open a PR. |
|
Important PR, actually, for such things as password manager wrappers |
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
Security audit and code review identified 3 vulnerabilities and 3 verification items. This PR remediates all of them.
Findings & Fixes
[VULN-001] Command Injection on Windows — High severity (FIXED)
src/main.ts—executeBw()spawn()was called withshell: trueand arguments joined into a single string, allowing shell metacharacter injection on Windowsspawn(process.env.ComSpec ?? "cmd.exe", ["/c", getBwPath(), ...args])— passes arguments as an array tocmd.exe /c, preserving.cmdwrapper resolution without injection risk[VULN-002] AES-CBC Usage Undocumented — Medium severity (DOCUMENTED)
src/session-storage.ts—encryptWithSessionKey()[VULN-003] RSA-OAEP SHA-1 Undocumented — Medium severity (DOCUMENTED)
src/ipc/native-messaging-client.ts—handleSetupEncryption()[VERIFY-001] IPC Message Size Unbounded (FIXED)
src/ipc/ipc-socket.service.ts—processIncomingData()[VERIFY-002] Socket Path Override Not Logged (MITIGATED)
src/ipc/ipc-socket.service.ts—getSocketCandidates()BWBIO_IPC_SOCKET_PATHenv var silently overrides the socket path[VERIFY-003] Debug Logging Exposes Secrets (FIXED)
src/ipc/native-messaging-client.ts—handleMessage()andprocessDecryptedMessage()BWBIO_DEBUG=true) logged full message contents includinguserKeyB64(user encryption key) andsharedSecret(IPC channel key)const { sensitiveField: _, ...safeMessage } = message)Dependency Vulnerabilities (FIXED)
npm audit fixresolving 6 of 8 devDependency vulnerabilities (handlebars, lodash-es, rollup, undici, picomatch, tar). Remaining 2 are bundled inside npm itself and await an npm release. None affect runtime — the project has zero runtime dependencies.Test plan
npm run typecheckpassesnpm run lintpasses (no new errors insrc/)npm test— all 40 unit tests passcmd.exe /cspawn works for.cmdwrappersBWBIO_DEBUG=trueto verify secrets are redacted from logsMade with Cursor