-
Notifications
You must be signed in to change notification settings - Fork 1
Support ReadOnly flag on VirtioFSMount #53
Description
Problem
VirtioFSMount currently only has Tag and HostPath fields. There is no way to specify that a mount should be read-only inside the guest.
When ToolHive maps a permission profile's read-only bind mounts to VirtioFSMount entries, the ReadOnly flag from the mount declaration is silently dropped. This means --volume /path:/path:ro mounts become read-write inside the guest VM, which is weaker isolation than the user expects.
Proposed Solution
Add a ReadOnly bool field to VirtioFSMount and plumb it through hypervisor.FilesystemMount so the backend can enforce it. The libkrun virtiofs implementation likely needs to pass this through to the virtiofsd configuration.
type VirtioFSMount struct {
Tag string
HostPath string
ReadOnly bool // new
}Context
Discovered during code review of stacklok/toolhive#4358. No catalog entries currently use read-only mounts, so practical impact is low today, but it is a correctness gap relative to how Docker handles the same permission profile.