Default host path binds to read-only#520
Open
kgprs wants to merge 3 commits into
Open
Conversation
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.
Summary
:roby defaultMCP_GATEWAY_DOCKER_BIND_ALLOW_WRITABLE_PATHSas a path-scoped override for writable host binds{{paths|volume|into}}profile configWhy This Is Needed
v0.43.0 hardened Docker volume handling so host-path binds must be read-only. That is a good default, but catalog entries such as the Filesystem server use the
volumetemplate helper:With
filesystem.paths=["/Users/user/Documents"], that evaluates to:Before this PR, even when the user explicitly allowed the host root:
MCP_GATEWAY_DOCKER_BIND_ALLOWED_PATHS=/Users/user \ docker mcp gateway run --transport streaming --profile testthe gateway rejected the bind before startup:
This PR preserves the hardening by converting omitted host bind modes to read-only:
Some servers do need write access to user-selected host paths. For that case, the new writable override is explicit and path-scoped:
MCP_GATEWAY_DOCKER_BIND_ALLOW_WRITABLE_PATHS=/Users/user/Documents \ docker mcp gateway run --transport streaming --profile testWhen the bind source is under
MCP_GATEWAY_DOCKER_BIND_ALLOW_WRITABLE_PATHS, an omitted mode becomes writable:Explicit
source:target:rwbinds are also allowed under the configured writable root. Writable roots also count as allowed bind roots, so users do not need to set both env vars for the writable case. Sensitive system and credential paths remain blocked.Validation
go test ./pkg/gateway -run 'TestApplyConfig(VolumeFilter|LongLivedRejectsWritableHostBind|ShortLivedRejectsWritableHostBind)|TestValidateDockerVolumeBinds'go test ./pkg/gatewaygo test ./pkg/evalgo test ./...; local integration tests inpkgfailed before completion with environment/tooling issues includingunknown flag: --gateway-argand MCPinitializeEOF. The directly touched gateway package passed.