Skip to content

[Proposal] flatpark-spawn: one shared extension for apps that need the host's toolchain #1565

Backlog

Description

@jing2uo

What it is

flatpark-spawn (v0.1.0) is a shared Flatpak extension, org.flatpark.Spawn. An app that declares it gets a wrapper around the whole app. When the app, or anything it starts, runs a command, the command runs on the host, so the app uses the host's toolchain as if there were no sandbox:

  • git status runs the host's git, with the user's config and credential helpers. Exit code, output and signals come back as if it were a local child process.
  • node, go, python and anything else in the user's login-shell PATH are found, including ~/.local/bin and mise/asdf/nvm. Project pins apply, because PATH is taken per working directory.
  • When the host and the sandbox both have a command, the host one runs. Commands that only exist in the sandbox, and commands whose arguments point into /app, stay in the sandbox.
  • Terminals work: zsh and fzf, sudo and ssh prompts, editors, Ctrl-C.

It works on any runtime (freedesktop, GNOME, KDE). For an app it takes a few lines in the manifest and one line in the launcher. Exec calls are intercepted with LD_PRELOAD and forwarded through Flatpak's HostCommand. The PTY code and the host-spawn command line come from 1player/host-spawn (MIT-0), and host-spawn still works as a command name.

This breaks the sandbox on purpose

Anything forwarded runs on the host as the user, with everything the user can reach. Narrowing the app's other permissions does not contain it.

We do it on purpose. FlatPark's principle is that users trust FlatPark because they trust the upstream app. A user who would install the app on the host with no restrictions at all doesn't want a sandbox from Flatpak. They want a better way to install and update it, which matters most on distributions without the AUR and on immutable ones. So the goal is that the Flatpak version behaves the same as a host install.

In return:

  • Every FlatPark app that uses the extension is audited as thoroughly as we can. Closed-source apps from well-known vendors can't be audited that way, so for those we only guarantee that the original distribution is not modified.
  • flatpark-spawn itself is open source and auditable. It may have bugs and vulnerabilities, but this layer will never do anything deliberately malicious.
  • The grant is the app's own --talk-name=org.freedesktop.Flatpak, and CI will require an allowlist entry for any app that uses the extension. Users can switch it off with flatpak override --user --no-talk-name=org.freedesktop.Flatpak <app-id>.

Long-term goal

Move every FlatPark app that needs host-command onto this extension. Today about 20 packages each carry their own flatpak-spawn --host shim. Most wrap commands one name at a time, don't see tools installed after the app starts, and miss absolute paths. With the extension there is one implementation to fix and audit, and one behaviour for users.

Status and next steps

  • v0.1.0 is released. Unit tests and an end-to-end matrix on freedesktop 26.08 and GNOME 51 apps pass. I've been using it in a local VS Code build: mise toolchains, zsh with fzf-tab and git all work.
  • In progress: support in this repo for a shared extension with no parent app, and the CI allowlist.
  • Next, I'll publish VS Code using flatpark-spawn as a test repo and invite you to try it. It replaces upstream host-spawn there. Please send problems, ideas and objections.
  • If you'd rather try it with another app, comment here and I'll package that app as a test repo too.

Known limits are in the README. The main ones:

  • Statically linked callers (Go, musl Rust) aren't intercepted, but whatever they run through sh -c still is.
  • The host can't see /app.
  • Ctrl-Z doesn't suspend a forwarded command.
  • Each forwarded command costs about 5 ms.

Why I'm tagging you

Activity

  1. added
    proposal
    on Nov 25, 2026
  2. francoism90 commented on Nov 25, 2026

    @francoism90
    Contributor

    @jing2uo Thanks for looking into this. :)

    A few things to be aware of I think: When you create a Flatpak SDK extension, it doesn't need any host packages. For example with git, you provide the command git/gh/.. using the SDK (/app/tools). It's credentials are than read by the portal or allowed to be read by the extension (~/.git, ~/.gitconfig, etc.) using Flatpaks permission system.

    The same principle can be said for things like go, fish, zsh, ssh, etc. In my work I use devcontainers that provide them to me, I don't need to install any of those tools on the host itself. So I indeed have git/gh/claude, .. again in the devcontainer (I could use SDKs instead), but I don't need to install them on the host itself - which does harden security a bit.

    I'm feeling more for SDK extensions or (dev)containers to be honest, instead of running host commands. Because you indeed break the sandbox. I do understand it may be necessary for certain apps and compilers, but for example my VSCode/Zed talks to Podman over a virtual remote socket connection. You don't talk directly to host podman bin, as this would bypass any security policies. In theory I could even run VSCode over a remote Podman connection like a VPS.

    I don't code with Go and other more low-level languages like C/rust, so I don't know if they indeed need direct host communication.

  3. rhgKc2yp commented on Nov 25, 2026

    @rhgKc2yp
    Contributor

    @jing2uo Thanks for looking into this and for all your work! I might not be the best person to provide feedback, though.

    All my agent-assisted workflows run inside VMs without Flatpak or stored credentials (e.g. GitHub SSH keys). I also occasionally use custom Podman containers with a comprehensive toolchain preinstalled.

    For agents and IDEs, trusting the upstream application alone may not be sufficient. Third-party skills, extensions, and plugins introduce additional trust relationships and expand the attack surface.

    I appreciate the benefits of consolidating the existing shims, but if sandbox isolation is effectively removed, I'd personally prefer a native installation.

  4. jing2uo commented on Nov 26, 2026

    @jing2uo
    CollaboratorAuthor

    @francoism90 @rhgKc2yp Thanks, both of you. You're right, and I hadn't thought this through.

    What I had in mind was to break the Flatpak sandbox completely and use Flatpak only as a package manager. That fits people who would install the app on the host anyway, but plenty of people care about the sandbox and rely on it, and that's a fair thing to want. Plugins, extensions and agent skills make it matter even more, because trusting the upstream app doesn't cover them.

    So I'll change the design of flatpark-spawn instead of making "everything runs on the host" the only mode:

    • Whether it leaves the sandbox at all will be configurable. Keeping the sandbox will be a supported setup, not a broken one.
    • The shim surface will be configurable: which commands, if any, are forwarded to the host, so you can expose only the toolchain you actually need and keep the rest (SDK extensions, devcontainers) inside.

    I'll try to find a balance between "works like a host install" and "stays sandboxed", and post the revised design here before I switch any app to it. If you have a view on what the default should be, or how the configuration should look, I'd like to hear it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions