Skip to content

fix: make linux mandatory deny mounts symlink-aware#58

Merged
jy-tan merged 2 commits intomainfrom
linux-mount-symlink
Feb 25, 2026
Merged

fix: make linux mandatory deny mounts symlink-aware#58
jy-tan merged 2 commits intomainfrom
linux-mount-symlink

Conversation

@jy-tan
Copy link
Contributor

@jy-tan jy-tan commented Feb 25, 2026

Summary

Fix Linux sandbox mount behavior for symlinked mandatory deny paths so bubblewrap startup no longer fails when the path is a symlink. Also centralize wildcard-domain network policy logic shared by Linux and macOS.

Changes

  • resolve mandatory deny mount targets through symlinks before mounting in internal/sandbox/linux.go
  • skip unsafe/unresolvable symlink mount targets and preserve explicit denyRead precedence
  • add Linux unit tests for mount-path resolution (regular, symlink, broken symlink) in internal/sandbox/linux_test.go
  • add Linux integration test reproducing issue bubblewrap fails to mount gitconfig if it's a symlink #51 conditions with symlinked ~/.gitconfig
  • extract shared wildcard-domain policy helper to internal/sandbox/network_policy.go
  • update Linux/macOS sandbox code to use the shared wildcard helper
  • move wildcard behavior tests to internal/sandbox/network_policy_test.go

@jy-tan jy-tan changed the title fix: handle symlinked gitconfig mounts on linux fix: make linux mandatory deny mounts symlink-aware Feb 25, 2026
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 6 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="internal/sandbox/linux.go">

<violation number="1" location="internal/sandbox/linux.go:742">
P3: `canMountOver(mountPath)` is always `true` here and can be removed. `resolvePathForMount` already guarantees `fileExists(mountPath)` and that `mountPath` is not a symlink, so both checks inside `canMountOver` are redundant at this call site.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@jy-tan jy-tan merged commit 6ab6975 into main Feb 25, 2026
5 checks passed
@jy-tan jy-tan deleted the linux-mount-symlink branch February 25, 2026 00:52
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