harivansh-afk opened issue getcompanion-ai/computer-host#6

harivansh-afk
Thu, 09 Apr 2026 04:29:02 +0000

6#stores guest data in overly-permissive host paths#

Several host-side paths that can contain guest secrets are created with permissive 0755 directories and 0644 files.

Why this matters:

CreateMachine clones the writable system disk image using cloneFile, which creates the disk image as 0644 (internal/daemon/create.go:65-79, internal/daemon/files.go:47-90).

That same writable system image is then modified to include guest identity and, when provided, guest-config.json with login webhook configuration and bearer token data (internal/daemon/files.go:262-295).

Snapshot directories are also created with 0755, and snapshot files are moved or copied without tightening permissions (internal/daemon/snapshot.go:60-63, internal/daemon/snapshot.go:369-387).

Artifact and state directories are broadly created as 0755, and JSON/state temp files use 0644 (internal/daemon/daemon.go:60-61, internal/store/file_store.go:385-444).

Impact:

On a multi-user host, local users can read machine disk images and snapshot material that may contain authorized keys, webhook bearer tokens, guest filesystem data, and guest memory contents.

This breaks the expected isolation boundary for a host daemon that is managing guest workloads.

Expected behavior:

Machine disks, snapshots, and state directories and files should default to owner-only permissions unless there is an explicit sharing requirement.

Suggested follow-up:

Tighten directories to 0700 or 0750 as appropriate.

Tighten files to 0600 unless they are intentionally public.

Add tests that stat created paths and enforce the expected modes for system disks, snapshot files, and persisted state.