Skip to content

fix: restrict shell.openPath IPC to known session directories#50

Merged
AlexPeppas merged 1 commit intomasterfrom
fix/restrict-open-path
Apr 4, 2026
Merged

fix: restrict shell.openPath IPC to known session directories#50
AlexPeppas merged 1 commit intomasterfrom
fix/restrict-open-path

Conversation

@johnkozaris
Copy link
Copy Markdown
Collaborator

Summary

Security fix — the SHELL_OPEN_PATH IPC handler passed arbitrary renderer-supplied paths to Electron's shell.openPath(), which opens files/URLs using the OS default handler. A compromised renderer could exploit this to execute arbitrary applications, scripts, or URL schemes.

  • Now validates the path is a known session working directory from sessionManager.list()
  • Verifies the resolved path is an existing directory (not a file, symlink, or executable)
  • Rejects anything else with an explicit error

The only call site is ExplorerPanel.tsx which opens a session's cwd in Finder/Explorer — this behavior is preserved.

Closes #49

Test plan

  • Right-click a session group in the Explorer panel → "Open in Finder" still works
  • Verify that calling window.agentPlex.openPath('/Applications') from DevTools is rejected
  • Verify that calling window.agentPlex.openPath('/path/to/some/executable') is rejected
  • Verify that calling window.agentPlex.openPath('https://evil.com') is rejected

The SHELL_OPEN_PATH handler passed arbitrary renderer-supplied paths
to Electron's shell.openPath(), which opens files/URLs with the OS
default handler. A compromised renderer could use this to execute
arbitrary applications.

Now validates that the resolved path is:
1. A known session working directory
2. An existing directory on disk

Closes #49
@johnkozaris johnkozaris requested a review from AlexPeppas April 2, 2026 14:58
@AlexPeppas AlexPeppas merged commit c261689 into master Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: shell.openPath IPC handler accepts arbitrary paths

2 participants