#5529·lima

Mounts: make some file names read-only for the guest (e.g. .git)

Author: sylvinusCreated Sep 23, 2026Updated Sep 27, 2026
Labelsstatus/needs-careful-security-reviewstatus/needs-design-consensus

Description

I'm using Lima successfully (great project!!!) with https://github.com/sylvinus/agent-vm to run AI agents in VMs with writable project mounts.

However I have one important outstanding issue: the agent can write .git/hooks/* or .git/config (e.g. core.fsmonitor). Those run on the host the next time I use git in the project, so a malicious agent could actually escape the VM.

Mounting the project read-only isn't an option, since the agent needs to edit the working tree and I want to review/contribute to the diff in real time with my editor of choice.

So I'm proposing a sshfs.readonlyNames list for reverse-sshfs mounts:

    mountType: "reverse-sshfs"
    mounts:
    - location: "~/my-project"
      writable: true
      sshfs:
        sftpDriver: "builtin"
        readonlyNames: [".git"]

Any path with a component matching one of these names is read-only for the guest, at any depth. It is enforced on the host by the builtin SFTP server, so it still holds if the guest is compromised. This needs the builtin server to only serve the mounted directory, which is lima-vm/sshocker#6.

I have a working implementation (sshocker + Lima) and will open PRs. Hoping this can be merged and useful to others!!