Skip to content

feat(config): expose FUSEY_ALLOW_OTHER env var, default true - #24

Merged
tofarr merged 2 commits into
mainfrom
feat/allow-other-env-var
Jul 27, 2026
Merged

tofarr merged 2 commits into
mainfrom
feat/allow-other-env-var

Conversation

@tofarr

@tofarr tofarr commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

fusey currently hardcodes AllowOther: false on the FUSE mount, which means the mount is only accessible to the UID that called mount(2). This breaks sandbox deployments where the fusey daemon runs as root (because the container is privileged and the mounter needs CAP_SYS_ADMIN) while the consumer process — typically an agent-server running as a non-root user — has to read and write files on the mount. With allow_other disabled, the kernel rejects the consumer's VFS operations on the mount before fusey's permission code even runs.

This PR introduces a FUSEY_ALLOW_OTHER env var plumbed into a new Config.AllowOther field, defaulting to true since fusey's typical deployment cannot function without it. Operators who need to restrict access to the mounter's UID can set FUSEY_ALLOW_OTHER=false.

Changes

  • internal/config/config.go — new DefaultAllowOther = true constant, new AllowOther field on Config, Load() parses FUSEY_ALLOW_OTHER via the existing parseBoolEnv helper (accepts Go strconv.ParseBool spellings: true/false/1/0/t/f/T/F/...).
  • cmd/fusey/main.go — AllowOther: false → AllowOther: cfg.AllowOther on the gofs.Mount call in runDaemon.
  • internal/config/config_test.go — extend TestLoadDefaults, TestLoadEnvOverrides, and TestLoadBadValues; new TestLoadAllowOther covering the common true/false spellings.
  • README.md — document FUSEY_ALLOW_OTHER in the env-var table.

Test plan

  • go test ./... (with CGO_ENABLED=0) passes all packages (cmd/fusey, internal/chunks, internal/compaction, internal/config, internal/fuse, internal/index).
  • New tests verify the default is true and that FUSEY_ALLOW_OTHER=false overrides it.
  • Binary smoke-tested: built locally and runs through mustLoadConfig without error when FUSEY_ALLOW_OTHER is unset (i.e. default applies).

Why default true (not false)?

The FUSE default is false, but fusey's only real consumer (the runtime-api sandbox) cannot operate with that default — the consumer is a non-root agent-server and the daemon must run as root to acquire CAP_SYS_ADMIN. Defaulting to false would silently break the sandbox for every deployment that doesn't set the env var. The default-true/opt-out flip matches the principle that the safe-but-useful choice should be the default; the env var is the explicit kill-switch for environments that need it.

Compatibility

Behavior change for existing users who relied on the implicit false default: any user on the host will now be able to access the fusey mount. In practice this is the desired behavior; if anyone has a deployment where fusey mounts are exposed to untrusted users, they should set FUSEY_ALLOW_OTHER=false explicitly. The runtime-api pod topology doesn't expose the mount to other pods, so this is a non-issue for the primary deployment.

Related

Companion change to runtime-api PR #679 (single-privileged-container with su wrapper for the agent-server). Once this lands and is released as v0.0.13, runtime-api can drop the runuser -u openhands step in _mount_fusey_workspace and rely on FUSEY_ALLOW_OTHER=true for kernel-level access.

fusey previously hardcoded `AllowOther: false` on the FUSE mount, which
meant the mount was only accessible to the UID that called `mount(2)`.
This broke sandbox deployments where the fusey daemon runs as root
(because the container is privileged and the mounter needs CAP_SYS_ADMIN)
while the consumer process — typically an agent-server running as a
non-root user — has to read and write files on the mount. With
`allow_other` disabled, the kernel rejects the consumer's VFS
operations on the mount before fusey's permission code even runs.

Introduce a `FUSEY_ALLOW_OTHER` env var (parsed via the existing
`parseBoolEnv` helper, so accepts Go's `strconv.ParseBool` spellings:
`true`/`false`/`1`/`0`/`t`/`f`/`T`/`F`/etc.) plumbed into a new
`Config.AllowOther` field. Default it to `true` since fusey's typical
deployment cannot function without it; `FUSEY_ALLOW_OTHER=false` opts
back into the FUSE default for environments where access must be
restricted to the mounter's UID.

- internal/config: `DefaultAllowOther = true`, `Config.AllowOther`,
  `Load()` reads `FUSEY_ALLOW_OTHER`.
- cmd/fusey: `AllowOther: false` → `AllowOther: cfg.AllowOther` on the
  `gofs.Mount` call.
- internal/config: extend `TestLoadDefaults`, `TestLoadEnvOverrides`,
  and `TestLoadBadValues`; add `TestLoadAllowOther` covering the common
  true/false spellings.
- README.md: document `FUSEY_ALLOW_OTHER` in the env-var table.

Tested: `go test ./...` (CGO_ENABLED=0) passes all packages.

Co-authored-by: openhands <openhands@all-hands.dev>
The previous commit introduced the FUSEY_ALLOW_OTHER env var and plumbed
it through Config.AllowOther to the FUSE mount. This commit makes the
formal mount specification aware of the new configuration knob so the
spec stays the source of truth (per AGENTS.md §"Key design decisions"
#1, "Specs before code").

mount.qnt changes:

  - Preamble: add a new "Configuration (resolved from environment
    variables at startup)" section between "Mount log" and "CLI dispatch
    surface". It documents FUSEY_ALLOW_OTHER alongside the existing
    CLI-surface section, including:
      * what the option does (allow_other mount, default true, kernel
        default is false)
      * why fusey defaults to true (consumer UID != daemon UID in the
        typical runtime-api sandbox)
      * an explicit scope note: this spec does NOT model the lifecycle
        differently based on ALLOW_OTHER; the option is consumed at the
        DaemonStarting → DaemonReady transition and either succeeds
        (fsAccessible = true with that option in effect) or fails
        (daemonMountFails, which covers the /etc/fuse.conf case where
        the kernel refuses allow_other).

  - Module body: add `const ALLOW_OTHER: bool` to the new Constants
    section. Modeled as a constant rather than a state variable
    because the value is read once from the environment at startup
    and never changes during the daemon's lifetime. A spec is a
    single-configuration slice; quint verifies invariants under each
    value of ALLOW_OTHER.

  - No new actions or invariants: the lifecycle state machine does
    not branch on ALLOW_OTHER, and adding a no-op invariant like
    `allowOtherIsConfigurationOnly = true` would be a tautology.
    Existing invariants (fsAccessibleIffDaemonReady,
    pidFileExistsWhileReachable, indexFlushedOnStop, ...) hold under
    both ALLOW_OTHER = true and ALLOW_OTHER = false.

Note on spec validation: the spec file has a pre-existing parse error
against the current Quint release (the multi-assignment init action
syntax is not accepted by quint >= 0.32). This is unrelated to the
present change — the same parse error exists on origin/main at
specs/mount.qnt:122. Tracking that as a separate concern; the spec
is not currently exercised by CI (.github/workflows/ci.yml runs only
go vet + go test).

Co-authored-by: openhands <openhands@all-hands.dev>
@tofarr
tofarr marked this pull request as ready for review July 27, 2026 14:32
@tofarr
tofarr merged commit 78cd28d into main Jul 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants