Skip to content

Fix seatbelt sandbox symlink handling for rules - #60

Open
joshvoigts wants to merge 1 commit into
afshinm:mainfrom
joshvoigts:user-symlink-fix
Open

Fix seatbelt sandbox symlink handling for rules#60
joshvoigts wants to merge 1 commit into
afshinm:mainfrom
joshvoigts:user-symlink-fix

Conversation

@joshvoigts

@joshvoigts joshvoigts commented Jul 14, 2026

Copy link
Copy Markdown

Problem: When a file like ~/.gitconfig is a symlink (e.g., pointing into a Dropbox folder), the seatbelt sandbox's path normalization was resolving through symlinks via canonicalize(). This meant the path written into the sandbox policy would be the target path rather than the symlink path the user specified, causing the rule to not match correctly.

Changes:

  • Preserve symlinks for allow rules: normalize_path_for_sandbox now uses canonicalize_preserving_symlinks instead of canonicalize(), so symlink paths stay as-is when written into the seatbelt policy. This means a user-specified path like ~/.gitconfig (a symlink) remains that way in the policy and matches correctly.
  • Fully resolve symlinks for deny rules: canonicalize_glob_static_prefix_for_sandbox (used for deny rules) continues to use canonicalize() to resolve through symlinks. This ensures the deny regex matches the actual target regardless of how the user refers to it.
  • FileSystemAccessMode::None fallback: Fix due to an upstream change.

Additional thoughts
Not sure if it would be worth opening a PR upstream as well...

@joshvoigts joshvoigts changed the title Fix seatbelt sandbox symlink handling for allow rules Fix seatbelt sandbox symlink handling for rules Jul 14, 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.

1 participant