Repository navigation
Replace tmpfs with bind mounts for .thvignore directory overlays to fix tmpcopyup - #1765
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1765 +/- ##
==========================================
+ Coverage 40.55% 40.70% +0.14%
==========================================
Files 184 184
Lines 21309 21420 +111
==========================================
+ Hits 8642 8718 +76
- Misses 12018 12042 +24
- Partials 649 660 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collaborator
…ix tmpcopyup Signed-off-by: Juan Antonio Osorio <[email protected]>
JAORMX
force-pushed
the
fix-thvignore-tmpcopyup
branch
from
September 8, 2025 08:42
c611147 to
afd3ac4
Compare
dmjb
approved these changes
Sep 8, 2025
yrobla
approved these changes
Sep 8, 2025
3 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
When using
.thvignoreto exclude sensitive directories (like.ssh/) from MCP server containers, the current implementation uses tmpfs mounts with thetmpcopyupoption. This causes a critical security issue where the original directory contents are copied into the tmpfs overlay, defeating the purpose of ignoring these paths and potentially exposing secrets to MCP servers.Root Cause
The
tmpcopyupbehavior in Docker/Podman automatically copies the contents of the original directory into the tmpfs mount when it's created. This means that even though we're trying to hide.ssh/by overlaying it with tmpfs, the SSH keys and other sensitive files are still accessible inside the container.Solution
This PR replaces tmpfs-based directory overlays with bind-mounted empty directories:
Key Changes:
Modified
pkg/ignore/processor.go:Type: "tmpfs"toType: "bind"createEmptyDirectory()method to create unique empty directories for each overlay0750for securityUpdated
pkg/container/docker/client.go:addIgnoreOverlays()andconvertMounts()Enhanced tests:
TestGetOverlayMountsto verify all mounts are bind typeTestProcessorCleanupto verify artifact cleanupBenefits
Testing
Backward Compatibility
No changes to CLI flags or user-facing behavior. The implementation change is transparent to users while fixing the underlying security issue.