Commit graph

2 commits

Author SHA1 Message Date
Johannes Millan
c86e369369
fix(security): restrict renderer-supplied filesystem IPC paths (#8223)
* fix(security): canonicalize file-path-guard and restrict FILE_SYNC_* to outside userData

file-path-guard now canonicalizes via fs.realpathSync.native (deepest existing
ancestor) before the path.relative check, so symlinks and case-insensitive / 8.3
filesystem aliases can't bypass containment — this also hardens the existing
backup-dir (GHSA-x937) check, which was purely lexical and bypassable on macOS.

Adds assertPathOutside and applies it to every FILE_SYNC_* handler and
READ_LOCAL_IMAGE_AS_DATA_URL in local-file-sync.ts, so the renderer (untrusted
plugin/XSS) can no longer read/write/delete/list/inline files inside the app's
private dir (userData: settings/grants/db) while user-chosen sync folders still
work.

* fix(security): validate clipboard image basePath, fileName and copy source

ipc-handler-wrapper now uses isPathInsideDir containment (not a bare startsWith,
which accepted a sibling like <userData>-evil) and rejects any fileName that is
not a plain image basename or imageId containing separators/.. — closing the
clipboard grant-file forgery (fileName='simpleSettings'). CLIPBOARD_COPY_IMAGE_FILE
now requires an image-extension source. The supported-image-extension allowlist
is consolidated into a single SUPPORTED_IMAGE_EXTENSIONS in mime-type-mapping.
2026-06-09 18:16:22 +02:00
Pue-Tsuâ
9a9e31f36a
Adding Ctrl-V pasting function from clipboard. (#5998)
* docs(clipboard): Added the plan to guide AI implementation.

* feat(clipboard): Changed requirement to reflect the fact that some functions can't be done in browsers.

* feat(clipboard): Added Ctrl-v pasting functionality from clipboard.

- Storing image in IndexedDB in browser, and storing image in userdata path in Electron.
- Added image resizing in markdown.

* docs(clipboard): Removed requirement file since it's implemented.

* feat(clipboard): Added clipboard images management in settings.

* feat(tests): Enhance focus mode and inline markdown tests with mock store and actions

* feat(clipboard): Add electron-only annotation to findImageFile function

* feat(clipboard): Prevent memory leaks by revoking cached blob URLs on image deletion

* feat(clipboard): Improve paste handling by tracking current placeholder and cleaning up old progress

* Merge branch 'master' into feat/clipboard-files

* feat(marked-options): Refactor renderer methods and add hooks for image sizing syntax

* feat(clipboard): Added feature that pasted image will be added to task attachment.

* revert: Revert the change of lock file from last merge.

* revert: Removed unwanted changes.

* refactor(clipboard): Cleaned up code that seems not necessary.

* feat(clipboard): Handle storage quota exceeded error and update messages

* feat(clipboard): Implement validated IPC handlers for clipboard image operations

* feat(clipboard): Add error handling for clipboard image URL resolution

* feat(clipboard): Refactor file operations to use async fs promises

* feat(clipboard): Integrate ClipboardPasteHandlerService for improved paste handling

* feat(clipboard): Rename resolveUrl to resolveIndexedDbUrl for clarity and update references

* feat(clipboard): Add defaultPath option to showOpenDialog for improved user experience

* feat(clipboard): Implement getDefaultClipboardImagesPath utility for consistent image path retrieval

* feat(clipboard): Refactor MIME type handling to use centralized mapping for improved maintainability

* feat(clipboard): Add computed property to toggle markdown parsing based on formatting settings

* revert: Removed unwanted changes.

* revert: Removed unwanted chagnes.

* revert: Removed unwanted chagnes.

* fix(clipboard-images-cfg): remove debug log from selectImagePath method

* refactor(paste-handler): update currentPlaceholder to use getter/setter methods

* fix(docs): correct formatting and improve clarity in multiple wiki pages

* fix: update dialog handling in initLocalFileSyncAdapter for type safety

* revert: Revert space change.

* fix(inline-markdown): ensure model is set to an empty string instead of undefined

* fix(tests): update clipboard images section locator to use collapsible title
2026-02-04 15:46:51 +01:00