Repository navigation
feat(claude-desktop): add Cowork as an opt-in through flatpak overrides - #1562
Merged
jing2uo merged 1 commit intoNov 26, 2026
Merged
Conversation
Cowork needs QEMU, /dev/kvm and the host's OVMF and virtiofsd, which the sandbox can't reach, so it stays off by default. With three overrides (--device=all, --filesystem=host-os:ro, --talk-name=org.freedesktop.Flatpak) the wrapper preloads a small shim that points the app's fixed-path checks at /run/host, runs the app's own helper on the host through flatpak-spawn, and connects the app to it. Without the overrides nothing is loaded and the app starts as before. The app tree is not modified. COWORK.md has the setup and says plainly that the last override ends the sandbox. flatpark.yml declares injected-code and host-command.
Collaborator
Review: #1562 — Cowork opt-in for
|
| # | Phase | Check | Tier | Verdict | Evidence |
|---|---|---|---|---|---|
| 0 | Safety | Static-only, isolated dir | ★ | ✅ | The .deb was fetched as bytes into a scratch dir. Only cowork-linux-helper was extracted (--no-same-owner --no-same-permissions) and read with file/readelf/strings. Nothing was executed. |
| 1.1 | Scope | Classification | ★ | ✅ | Change to an existing app. 7 files, all under registry/com.anthropic.ClaudeDesktop/ |
| 1.2 | Scope | High-scrutiny surface | ★ | ✅ | No .github/, scripts/ or config/ changes. resolve-update.sh and the update: block are unchanged. The managed extra-data block is untouched. |
| 1.3 | Scope | De-listed | ★ | ➖ | Not a new app |
| 2.1 | Provenance | Submitter | ★ | ✅ | ajithakdev, account from 2022-06, 16 public repos, maintains claude-desktop-rpm (64★). Did the groundwork in #1405. |
| 2.2 | Provenance | Source repo | ★ | ➖ | Payload unchanged: same official downloads.claude.ai .deb as main |
| 2.3 | Provenance | Commit identity | ★ | ✅ | One commit. The author email is a normal address on the same login. |
| 2.4 | Provenance | Timeline | ★ | ✅ | The approach was agreed in #1405 before this PR was opened |
| 2.5 | Provenance | Trust tier | ★ | ✅ | Established / unknown-plausible |
| 2.6 | Provenance | Artifact tier | ★ | ✅ | Tier 2 (proprietary, policy.proprietary: true) |
| 3.1 | Manifest | Source types | ★ | ✅ | The new cowork module has two local type: file sources: cowork-shim.c and cowork-host-helper. Extra-data is unchanged: sha256 + size. |
| 3.1b | Manifest | Remote bytes in /app |
★ | ✅ | None. The shim is compiled from an in-repo .c file, like com.getupnote.UpNote/fake-getpid.c and com.schwab.thinkorswim/chromium-no-sandbox.c. |
| 3.2 | Manifest | finish-args escape perms | ★ | ✅ | No change to finish-args. The new --talk-name=org.freedesktop.Flatpak / --device=all / --filesystem=host-os:ro grants exist only as a user flatpak override, so dangerous_permissions: [] is correct. |
| 3.3 | Manifest | policy: honest |
★ | ✅ | proprietary: true is correct. dangerous_permissions matches what the manifest grants. |
| 3.4 | Manifest | build-commands / injected code | ★ | ✅ | cc -shared … cowork-shim.c -ldl plus two install lines. The vendor tree is not touched (apply_extra.sh is unchanged). The injected code is disclosed in plain words in the metainfo, as required for a proprietary app. |
| 3.4b | Manifest | packaging: declared |
★ | 👤 | injected-code + host-command, en + zh-Hans, accurate. node scripts/audit-descriptor.mjs registry/com.anthropic.ClaudeDesktop/flatpark.yml → exit 0. But see finding 1: the badge comes out as Reduced isolation, not Modified. |
| 3.5 | Manifest | Source URLs genuine | ★ | ✅ | Unchanged, downloads.claude.ai |
| 3.6 | Manifest | app-id | ★ | ✅ | Unchanged |
| 3.7 | Manifest | update.command |
★ | ✅ | Unchanged (./resolve-update.sh) |
| 3.8 | Manifest | Download host | ★ | ✅ | Vendor domain |
| 3.9 | Manifest | Optional caps opt-in | ★ | ✅ | This is the model case: the broad grants are documented as a flatpak override in the metainfo and COWORK.md, and none are pre-granted. |
| 3.10 | Manifest | What was tested | ★ | ✅ | Fedora 45 x86_64, built from the branch, checked with and without the overrides (/proc/<pid>/maps, VM boot, portal folder mount, shell). Debian/Ubuntu and arm64 are listed as untested. |
| 3.11 | Manifest | Screenshot | ★ | ➖ | Unchanged |
| 4.1 | Runtime | Packaging fetch-and-exec | ★ | ✅ | None added. The ~1.4 GB VM image is downloaded by the unmodified app into its own data dir, which is upstream behaviour. |
| 4.2 | Runtime | Resolver reviewed | ★ | ➖ | Unchanged |
| 4.3 | Runtime | Endpoints / fs×net | ★ | ✅ | No change by default. With the opt-in, the app can run any command on the host. COWORK.md, the metainfo and the host-command entry all say so plainly. |
| 5.1 | Artifact | sha256 == pin | ★ | ✅ | amd64: 7e381601…38cf8, size 191718584, matches the manifest |
| 5.2 | Artifact | Inspected | ★ | ✅ | 139 entries. Only one has ../: the symlink usr/bin/claude-desktop -> ../lib/claude-desktop/claude-desktop, which stays inside the tree and is dropped by apply_extra. Setuid chrome-sandbox (zypak replaces it; Flatpak strips setuid). postinst/postrm are never run. |
| 5.3 | Artifact | Tier 1 only | 1 | ➖ | Tier 2 |
| 5.4 | Artifact | Shipped == official | ★ | ✅ | Payload and apply_extra.sh are unchanged from main, and the vendor tree is unmodified |
| 5.5 | Artifact | Bundled runtimes | ★ | ✅ | resources/cowork-linux-helper is a statically linked Go ELF (no NEEDED, no RPATH/RUNPATH), so it runs on any host without host libraries |
| 5.6 | Artifact | IOC scan | ★ | ✅ | The shim and host script contain no network calls, no persistence and no hard-coded IPs. The host script only builds a bwrap command line and execs the vendor helper. |
| 6.1 | Compliance | Purpose | ★ | ✅ | Official Anthropic client |
| 6.2 | Compliance | Non-FOSS ok | ★ | ✅ | — |
| 7.1 | Verdict | Overall | ★ | 👤 | NEEDS-HUMAN: the badge decision (finding 1) and CI approval |
| 7.2 | Verdict | Hard-fail triggers | ★ | ✅ | None |
| 7.3 | Verdict | Reviewer recommends only | ★ | ✅ | A maintainer merges |
What was read, file by file
claude-desktop-wrapper: Before the app starts, it checks/dev/kvm,/run/host/usrand an exact lineorg.freedesktop.Flatpak=talkin/.flatpak-info. If any of the three is missing,ZYPAK_LD_PRELOADstays unset, so a default install runs the same code path as today. Prepending to an existingZYPAK_LD_PRELOADis correct.cowork-shim.c: Reviewed every hook.access/faccessat: only for the five fixed prefixes, rewritten to/run/host<path>. A path too long for the buffer falls back to the original.connect: only for anAF_UNIXpath equal to$XDG_RUNTIME_DIR/claude-cowork-vm.sock, rewritten into the shared per-app runtime dir.execve/execvp/execvpe: only for a basename of/cowork-linux-helper, swapped to/app/bin/cowork-host-helper.- Everything else passes through to
RTLD_NEXT. No state, no I/O.
cowork-host-helper:- Rewrites only the exact
-socketvalue. - Reads
app-pathfrom/.flatpak-info. - Runs
flatpak-spawn --host --watch-bus→sh→bwrap. The bwrap root binds the host's top-level dirs and/run/*, plus/run/user/$UID/docat/run/flatpak/docand the deploy dir read-only at/app. - Nothing is written on the host outside the runtime dir. The rotation of the helper's arguments behind the bwrap options is correct.
- Binding the root document view rather than
by-app/<id>is wider, but on the host side the process is already unsandboxed, so it adds nothing.
- Rewrites only the exact
com.anthropic.ClaudeDesktop.yml: The newcoworkmodule comes before the app module. The comments match the code.metainfo.xml/COWORK.md/flatpark.yml: Accurate and plain about what the overrides give up. The zh-Hans text matches the English.
Findings
- 👤 The site badge will be "Reduced isolation" for everyone, not "Modified".
site/tools/enrich.mjs:455-465mapshost-command→reducedand takes the highest level. The audit requires that entry here, becausecowork-host-helpercontainsflatpak-spawn(scripts/audit-descriptor.mjs:409). So a default install, which can't run host commands at all, gets the red badge. Thepackaging:texts do say "Only for Cowork, which is off by default", so the per-item list is honest, but the headline badge isn't. This is the maintainer's call:- (a) accept the badge as it is;
- (b) go docs-only, as you offered;
- (c) add an opt-in marker to
packaging:entries so the badge shows the default level. That is a separate infra change on our side, not something for this PR.
- Link COWORK.md from the metainfo. "Setup steps … are in COWORK.md in FlatPark's registry" can't be followed from a software centre. Please use the full URL:
https://github.com/flatpark/flatpark/blob/main/registry/com.anthropic.ClaudeDesktop/COWORK.md. - Undo without
--reset. Both COWORK.md and the metainfo use--resetand warn that it removes other overrides, then tell users to edit the override file by hand. The targeted form does the same job without either problem:flatpak override --user --nodevice=all --nofilesystem=host-os --no-talk-name=org.freedesktop.Flatpak com.anthropic.ClaudeDesktop. With that, the wrapper's check fails and the shim stops loading.--device=drifrom the manifest is not affected. - Observation: the helper's environment.
flatpak-spawn --hostdoesn't pass the sandbox environment through, only--env=values. The helper readsXDG_RUNTIME_DIR, which has the same value on the host, andCOWORK_VM_ACCEL(seen instrings). If the app or a user setsCOWORK_VM_ACCELfor the helper, it is lost on the way. This doesn't block anything, since your test passed. A one-line--env=COWORK_VM_ACCEL=…pass-through when it is set would close the gap. - Nit:
bwrapon the host. COWORK.md saysbwrap"comes with Flatpak". That's true where Flatpak depends on thebubblewrappackage (Fedora, Debian, Arch). A Flatpak built with its bundled bwrap installs it asflatpak-bwrapunder libexec, not asbwraponPATH. A one-linecommand -v bwrapin the setup steps would catch that early. Hosts where AppArmor restricts unprivileged user namespaces (Ubuntu 24.04+) are untested too. The PR already says so.
Reproduce
git fetch origin pull/1562/head:pr-1562 && git worktree add ../pr1562 pr-1562
cd ../pr1562 && node scripts/audit-descriptor.mjs registry/com.anthropic.ClaudeDesktop/flatpark.yml # exit 0
curl -sSfLO https://downloads.claude.ai/claude-desktop/apt/stable/pool/main/c/claude-desktop/claude-desktop_6.28899.6_amd64.deb
sha256sum claude-desktop_6.28899.6_amd64.deb; dpkg-deb -c claude-desktop_6.28899.6_amd64.deb | grep -E 'cowork|virtiofsd|^-..s'
dpkg-deb --fsys-tarfile claude-desktop_6.28899.6_amd64.deb | tar -x --no-same-owner --no-same-permissions ./usr/lib/claude-desktop/resources/cowork-linux-helper
file usr/lib/claude-desktop/resources/cowork-linux-helper # statically linked
grep -n -A10 'PACKAGING_KINDS = {' site/tools/enrich.mjsNot covered
- Nothing was built or run, so the Fedora test record above is the evidence that it works.
- The arm64
.debwas not re-hashed. Its pin is unchanged frommain. - No host other than Fedora was tried.
- The app's own Cowork code and the VM image it downloads were not audited.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows up on #1405: Cowork as an opt-in for com.anthropic.ClaudeDesktop, as agreed there.
What
Claude (
com.anthropic.ClaudeDesktop). Cowork stays off by default. A user who wants it adds three overrides; without them the package behaves exactly as it does today. The steps are inregistry/com.anthropic.ClaudeDesktop/COWORK.md, next to the package.Sandbox
Default
finish-argsare unchanged. The opt-in, documented in the metainfo and COWORK.md:--device=all:/dev/kvmand/dev/vhost-vsock.--filesystem=host-os:ro: the host's/usrat/run/host/usr, where QEMU, OVMF and virtiofsd are.--talk-name=org.freedesktop.Flatpak: the Cowork helper has to run on the host. This lets the app run any host command, so once it's on the app is no longer really sandboxed. The metainfo and COWORK.md both say that in plain words.Since none of this is granted by the manifest,
dangerous_permissionsstays empty.flatpark.ymldeclaresinjected-codeandhost-commandunderpackaging:, and both entries say they only apply after the opt-in.node scripts/audit-descriptor.mjspasses.How the launcher gets past the fixed-path checks
The app decides Cowork is available with plain
fs.accesscalls in the main process, against fixed paths:/usr/bin/qemu-system-x86_64(-aarch64on arm64),/usr/share/OVMF/OVMF_CODE_4M.fdorOVMF_CODE.fd(/usr/share/AAVMF/AAVMF_CODE.fdon arm64), and/usr/libexec/virtiofsdor/usr/bin/virtiofsd. In the sandbox/usris the runtime, and Flatpak won't mount over it. I checked 6.28899.6 for an override (environment variable or setting) and found none. Its fuses blockNODE_OPTIONSand the inspector, and asar integrity is on, so there's no JS-side route either. The app tree stays unmodified, as before.What's left is a small preload (
cowork-shim.c, about 100 lines, built in its own module). The wrapper sets it throughZYPAK_LD_PRELOAD(zypak overwritesLD_PRELOAD), and only when all three overrides are present:/dev/kvmexists,/run/host/usrexists, and/.flatpak-infohasorg.freedesktop.Flatpak=talk. Otherwise it's never loaded. It hooks three things and leaves everything else alone:access/faccessaton those path prefixes go to/run/host+ path. The host's real files answer the check. Fedora's relative OVMF links resolve there too.execve/execvp/execvpeof.../cowork-linux-helperstart/app/bin/cowork-host-helperinstead. That script runs the same, unmodified helper on the host withflatpak-spawn --host --watch-bus, inside a hostbwrapthat binds the host's top-level directories, the app at/appand/run/user/$UID/docat/run/flatpak/doc. That way the paths the app passes to the helper (/app/extra/...and document-portal folders) still resolve. The firmware path the app passes is a real host path, so the helper uses it as it is.connect()to$XDG_RUNTIME_DIR/claude-cowork-vm.sockgoes to$XDG_RUNTIME_DIR/app/$FLATPAK_ID/claude-cowork-vm.sock, the part of the runtime dir the sandbox and the host share. The host script rewrites the helper's-socketargument to the same path.Tested
Fedora 45, x86_64, GNOME. Package built from this branch with flatpak-builder (app 6.28899.6), installed
--user./proc/<pid>/maps). The app logsworkspace VM not supported (status=unsupported), same as the current package.guest ready. A Cowork task on a folder picked through the portal (/run/flatpak/doc/.../Documents) mounted it (failedMounts=0) and ranls -lain the VM, with owners and dates shown.On 2026-11-21 the same approach also ran end to end on 5.11492.5 (VM boot, folder mount, shell), with the overrides passed by hand.
Things to weigh
.cfile means the audit counts the package asinjected-code, so I expect the site to show the "Modified" level for everyone, even though nothing loads without the opt-in. If you'd rather keep the default listing at its current level, the alternative is a docs-only recipe where users build the shim themselves. I'm happy to switch to that.--resetremoves every override for the app. COWORK.md also explains how to remove only these three.~/.var/app/com.anthropic.ClaudeDesktopbefore it unpacks the VM image. That's the app's own check, and COWORK.md mentions it.