Repository navigation
Sandbox renderers and encrypt dictation history - #4
Merged
Merged
Conversation
The preload is CommonJS so sandbox stays on. History is encrypted with safeStorage, can be turned off, and file drops are still left untouched because Electron cannot round-trip CF_HDROP. Co-authored-by: Thana <gotzastory@users.noreply.github.com>
…y-privacy-b956 Co-authored-by: Thana <gotzastory@users.noreply.github.com>
…y-privacy-b956 Co-authored-by: Thana <gotzastory@users.noreply.github.com> # Conflicts: # electron/main.test.ts
Co-authored-by: Thana <gotzastory@users.noreply.github.com>
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 two renderer windows and stops storing dictation history as plaintext.
dist-electron/preload.cjs(format: 'cjs'). Both windows setsandbox: trueexplicitly, withcontextIsolation: trueandnodeIntegration: false. Sandbox is not turned off.will-navigateallows only the app page frompathToFileURL(...)(hash is allowed, a query string is not) and, in dev, the dev-server origin. Other file URLs and other origins are blocked. Dashboard loads use that same file URL.mediapermission only for the widget and denies every other permission, including media for the dashboard. The Settings microphone list may therefore show generic labels until a Windows check confirms howenumerateDevicesbehaves without a dashboard grant.history.jsonis no longer plaintext. The body issafeStorageciphertext with a small magic header. A legacy{entries}file is migrated when encryption is available and left byte-for-byte alone when it is not. If encryption is unavailable, new entries are not written and the user gets one warning:ระบบเข้ารหัสประวัติยังไม่พร้อม จึงไม่บันทึกประวัติลงดิสก์. Ciphertext that cannot be decrypted is not overwritten; Clear history deletes that file. The 500-entry and 4 MB caps still apply to the plaintext payload.saveHistory, default on). History already had ล้างประวัติ. Home and History copy now say the text is encrypted on this PC.This branch does not change
package-lock.json. It does editelectron/main.tsandelectron/main.test.ts, which the app-fix PR also edits. Rebase this branch ontomainafter that PR merges.Clipboard restore
Images are already restored.
pasteAtCursorsnapshotstext/plain,text/html,text/rtf, and anyimage/*viaclipboard.readImage(), thenclipboard.write()puts them back together. Existing tests cover that path. No image-loss path showed up.File drops are not restored, on purpose.
CF_HDROPis standard clipboard format 15 and has no registered name.clipboard.readBuffer('CF_HDROP')callsRegisterClipboardFormat("CF_HDROP"), which is a different format, so it does not read the file list.FileNameWis one UTF-16 path, not the multi-file drop Explorer pastes, andwriteBuffercannot put bytes back onto format 15. Writing either buffer would look like a restore while the real drop is gone. The native host still sets the file flag, and paste refuses to touch the clipboard.electron/pasteText.test.tsasserts a file drop never callswriteText,write, orwriteBuffer.Tests
npm test(165) andnpm run buildpassed. The production build emitsdist-electron/preload.cjsasrequire("electron")/contextBridge, and the main bundle setssandbox: !0withnodeIntegration: !1.Manual Windows check
This needs a packaged build, not just the unit tests:
window.typelessexists in both windows with sandbox on (dictation and the dashboard still load).%APPDATA%/OpenPood/history.jsonand confirm the transcript is not readable as plaintext.media. Confirm whether the chosen device still records.