Remove ro bind mount over protected paths, replace with warning #86
+76
−225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reason
Fixes #85
PR #80 introduced logic to protect sensitive paths (
.git,.bashrc, etc.) by mounting/dev/nullover them. For non-existent paths, it attempted to block their creation by mounting/dev/nullat the first non-existent path component. This approach backfired - instead of preventing file creation, it caused files to be created into the working directory.The fundamental issue: bwrap bind mounts can only protect paths that exist. Trying to preemptively block non-existent paths via mount tricks is fragile and error-prone.
This PR takes a simpler approach: warn users when protected paths cannot be fully protected (non-existent or contain symlinks)
Description
findFirstNonExistentComponentfunction that attempted to block creation of non-existent deny pathsonWarningscallback toLinuxSandboxParamsfor reporting unprotected pathsReferences