Skip to content

fix: disable Electron SUID sandbox for obsidian headless wrapper - #1433

Merged
shunkakinoki merged 1 commit into
mainfrom
fix/obsidian-sandbox
Apr 11, 2026
Merged

fix: disable Electron SUID sandbox for obsidian headless wrapper#1433
shunkakinoki merged 1 commit into
mainfrom
fix/obsidian-sandbox

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Apr 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add --no-sandbox to the obsidian headless wrapper to fix SUID sandbox crash on NixOS
  • The Nix store cannot provide root-owned setuid binaries, so chrome-sandbox always fails
  • Safe for this use case since the wrapper runs headless CLI commands, not untrusted web content

Test plan

  • Run obsidian CLI on kyber and verify it no longer crashes with SUID sandbox error
  • Verify obsidian --help and vault commands work under xvfb-run

Summary by cubic

Disable Electron SUID sandbox in the Obsidian headless wrapper to stop crashes on NixOS. Adds --no-sandbox to the obsidian call under xvfb-run, which is safe for our headless CLI usage.

Written for commit 8c60e55. Summary will update on new commits.

Copilot AI review requested due to automatic review settings April 11, 2026 15:52
@mesa-dot-dev

mesa-dot-dev Bot commented Apr 11, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Apr 11, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b0f8eaf8-852b-4aa7-aaf2-9ba486e22e13

📥 Commits

Reviewing files that changed from the base of the PR and between 5819b8f and 8c60e55.

📒 Files selected for processing (1)
  • home-manager/modules/obsidian/obsidian-headless.sh

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Updated Obsidian launch configuration to disable sandbox mode for improved system compatibility and execution stability.

Walkthrough

A shell script was modified to pass an additional --no-sandbox argument to the Obsidian binary during invocation. The change replaces a single line with another, preserving the overall execution flow through xvfb-run.

Changes

Cohort / File(s) Summary
Obsidian Headless Configuration
home-manager/modules/obsidian/obsidian-headless.sh
Added --no-sandbox flag to Obsidian binary invocation for expanded execution options.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A sandbox? No thanks! the Obsidian said,
With one little flag, restrictions have fled,
Notes flow more freely through headless displays,
A simple tweak brightens the vault's many days. ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/obsidian-sandbox

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mesa-dot-dev

mesa-dot-dev Bot commented Apr 11, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Disable Electron SUID sandbox for the obsidian headless wrapper to fix SUID sandbox crash on NixOS.

What changed?

  • Added --no-sandbox to the obsidian headless wrapper. This addresses SUID sandbox crashes on NixOS, where the Nix store's inability to provide root-owned setuid binaries causes chrome-sandbox to fail. The change is safe as the wrapper executes headless CLI commands, not untrusted web content.

Description generated by Mesa. Update settings

@shunkakinoki
shunkakinoki merged commit 45f16cd into main Apr 11, 2026
34 of 35 checks passed
@shunkakinoki
shunkakinoki deleted the fix/obsidian-sandbox branch April 11, 2026 15:53

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the obsidian-headless.sh script to include the --no-sandbox flag when executing Obsidian. The review feedback recommends using the more targeted --disable-setuid-sandbox flag instead of disabling the entire sandbox, which improves security while still addressing the specific SUID-related crashes in Nix environments.

@@ -1,2 +1,2 @@
#!/usr/bin/env bash
exec @xvfbRun@/bin/xvfb-run -a @obsidian@/bin/obsidian "$@"
exec @xvfbRun@/bin/xvfb-run -a @obsidian@/bin/obsidian --no-sandbox "$@"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The --no-sandbox flag disables all security sandboxing in Electron. Since the pull request description identifies the SUID sandbox as the specific cause of the crash (due to Nix store limitations), using --disable-setuid-sandbox is a more targeted approach. This allows the kernel-based namespace sandbox to remain active if the host system supports it, maintaining a better security posture while still resolving the SUID-related crash.

Suggested change
exec @xvfbRun@/bin/xvfb-run -a @obsidian@/bin/obsidian --no-sandbox "$@"
exec @xvfbRun@/bin/xvfb-run -a @obsidian@/bin/obsidian --disable-setuid-sandbox "$@"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Obsidian headless CLI wrapper to avoid Electron’s SUID sandbox crash on NixOS by passing an explicit sandbox-disabling flag.

Changes:

  • Add --no-sandbox to the obsidian invocation inside the xvfb-run wrapper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,2 +1,2 @@
#!/usr/bin/env bash
exec @xvfbRun@/bin/xvfb-run -a @obsidian@/bin/obsidian "$@"
exec @xvfbRun@/bin/xvfb-run -a @obsidian@/bin/obsidian --no-sandbox "$@"

Copilot AI Apr 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using --no-sandbox fully disables Chromium/Electron sandboxing, which is a significant security reduction even in headless mode (e.g., malicious plugins/vault content could gain more privileges). If the intent is only to avoid the failing SUID sandbox on NixOS, consider switching to --disable-setuid-sandbox (or gating --no-sandbox behind an env var/host check) so other sandbox mechanisms can still apply where available.

Suggested change
exec @xvfbRun@/bin/xvfb-run -a @obsidian@/bin/obsidian --no-sandbox "$@"
exec @xvfbRun@/bin/xvfb-run -a @obsidian@/bin/obsidian --disable-setuid-sandbox "$@"

Copilot uses AI. Check for mistakes.
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.

2 participants