[GH-ISSUE #8416] [Issue]: Sandboxed Mari commands fail with MacPorts Node (/opt/local/lib not readable) #8349

Closed
opened 2026-11-07 16:42:23 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @stochasticbrainrot on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8416

Originally assigned to: @SpicyMarinara on GitHub.

Summary

On macOS with Node installed through MacPorts, every sandboxed command Professor Mari runs fails at startup. The Seatbelt sandbox doesn't allow reads from /opt/local/lib, where MacPorts Node's linked libraries live. This affects workspace shell commands and mari db transform.

Expected behavior

Sandboxed commands start normally with MacPorts Node, as they already do with Homebrew Node.

Actual behavior

Node exits before running anything because the dynamic linker can't load its libraries:

dyld: Library not loaded: /opt/local/lib/libz.1.dylib

Steps to reproduce

  1. On macOS, install Node through MacPorts (sudo port install nodejs24) so that node is /opt/local/bin/node.
  2. Run Marinara Engine from source with that Node.
  3. Have Professor Mari run certain workspace shell commands such as 'mari'
  4. The command fails with the dyld error above.

Environment

  • Marinara Engine version: 2.5.1 5a209a3 (staging; still present on origin/staging as of 2026-10-28)
  • Install type: source
  • OS + version: macOS 27.2
  • Browser or app shell: N/A (server-side)
  • Node: v24.21.0 from MacPorts (/opt/local/bin/node)

Logs, screenshots, or video

otool -L /opt/local/bin/node shows Node is linked against MacPorts libraries, for example /opt/local/lib/libz.1.dylib and /opt/local/lib/libicui18n.78.dylib.

To reproduce outside the app, run sandbox-exec -p <profile> /opt/local/bin/node -v using the profile from buildMacosWorkspaceShellProfile(). It fails with the dyld error above.

Additional context

Cause: macosReadRoots() in packages/server/src/services/professor-mari/workspace-shell-sandbox.ts (around line 689) lists the folders the macOS sandbox may read. It includes Homebrew's whole prefix (/opt/homebrew) and /usr/local. For MacPorts it covers only the Node binary's own folder (/opt/local/bin, via dirname(process.execPath)) and PATH entries, never /opt/local/lib.

Suggested fix: add the MacPorts prefix next to Homebrew's:

    "/opt/homebrew",
    "/opt/local", // MacPorts: Node links against dylibs in /opt/local/lib
    "/usr/local",
  • Read access only; write rules are unchanged.
  • uniqueExistingPaths skips the folder on machines without MacPorts, so their profile doesn't change.
  • Using the whole prefix matches how Homebrew is handled, since MacPorts tools also read /opt/local/share and /opt/local/etc.
  • Both sandboxed paths go through spawnWorkspaceSandboxedProcess, so this one change covers the Professor Mari shell and mari db transform.
  • Linux bubblewrap isn't affected.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @stochasticbrainrot on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8416 Originally assigned to: @SpicyMarinara on GitHub. ## Summary On macOS with Node installed through MacPorts, every sandboxed command Professor Mari runs fails at startup. The Seatbelt sandbox doesn't allow reads from `/opt/local/lib`, where MacPorts Node's linked libraries live. This affects workspace shell commands and `mari db transform`. ## Expected behavior Sandboxed commands start normally with MacPorts Node, as they already do with Homebrew Node. ## Actual behavior Node exits before running anything because the dynamic linker can't load its libraries: ``` dyld: Library not loaded: /opt/local/lib/libz.1.dylib ``` ## Steps to reproduce 1. On macOS, install Node through MacPorts (`sudo port install nodejs24`) so that `node` is `/opt/local/bin/node`. 2. Run Marinara Engine from source with that Node. 3. Have Professor Mari run certain workspace shell commands such as 'mari' 4. The command fails with the dyld error above. ## Environment - Marinara Engine version: 2.5.1 5a209a3 (`staging`; still present on `origin/staging` as of 2026-10-28) - Install type: source - OS + version: macOS 27.2 - Browser or app shell: N/A (server-side) - Node: v24.21.0 from MacPorts (`/opt/local/bin/node`) ## Logs, screenshots, or video `otool -L /opt/local/bin/node` shows Node is linked against MacPorts libraries, for example `/opt/local/lib/libz.1.dylib` and `/opt/local/lib/libicui18n.78.dylib`. To reproduce outside the app, run `sandbox-exec -p <profile> /opt/local/bin/node -v` using the profile from `buildMacosWorkspaceShellProfile()`. It fails with the dyld error above. ## Additional context **Cause:** `macosReadRoots()` in `packages/server/src/services/professor-mari/workspace-shell-sandbox.ts` (around line 689) lists the folders the macOS sandbox may read. It includes Homebrew's whole prefix (`/opt/homebrew`) and `/usr/local`. For MacPorts it covers only the Node binary's own folder (`/opt/local/bin`, via `dirname(process.execPath)`) and `PATH` entries, never `/opt/local/lib`. **Suggested fix:** add the MacPorts prefix next to Homebrew's: ```ts "/opt/homebrew", "/opt/local", // MacPorts: Node links against dylibs in /opt/local/lib "/usr/local", ``` - Read access only; write rules are unchanged. - `uniqueExistingPaths` skips the folder on machines without MacPorts, so their profile doesn't change. - Using the whole prefix matches how Homebrew is handled, since MacPorts tools also read `/opt/local/share` and `/opt/local/etc`. - Both sandboxed paths go through `spawnWorkspaceSandboxedProcess`, so this one change covers the Professor Mari shell and `mari db transform`. - Linux bubblewrap isn't affected. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-11-07 16:42:23 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Oct 28, 2026):

I am taking this fix as @SpicyMarinara (Codex). I will verify the shared macOS sandbox read roots and both affected command paths, add the MacPorts prefix using the existing Homebrew pattern, and run the focused sandbox regressions before preparing a PR against staging.

<!-- gh-comment-id:6479850887 --> @SpicyMarinara commented on GitHub (Oct 28, 2026): I am taking this fix as @SpicyMarinara (Codex). I will verify the shared macOS sandbox read roots and both affected command paths, add the MacPorts prefix using the existing Homebrew pattern, and run the focused sandbox regressions before preparing a PR against staging.
Author
Owner

@SpicyMarinara commented on GitHub (Oct 28, 2026):

Addressed.

<!-- gh-comment-id:6480219869 --> @SpicyMarinara commented on GitHub (Oct 28, 2026): Addressed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8349
No description provided.