feat(appimage): If necessary, start with --no-sandbox - #9590
Conversation
🦋 Changeset detectedLatest commit: 67c5e5f The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
I would suggest changing the pull request title and changelog entry, as it sounds like you are adding the |
b752196 to
515c227
Compare
d3480ac to
70c2850
Compare
There was a problem hiding this comment.
Pull request overview
This PR improves how AppImages handle the need for --no-sandbox on Linux systems where user namespaces are unavailable. Instead of always hardcoding --no-sandbox in the desktop entry (the previous approach from PR #4496), the new approach dynamically detects at runtime whether user namespaces work, and only adds --no-sandbox when they don't. This addresses users on modern Linux systems (e.g., Ubuntu 24.04) where user namespaces may be available, while still working on restricted environments.
Changes:
- The generated
AppRunshell script (forappimagetoolset1.0.2) now includes runtime logic to detect if user namespaces are unavailable (unshare -Ur true) and conditionally adds--no-sandboxwhen launching the app binary. - The desktop entry
Execfield no longer hardcodes--no-sandboxfor the1.0.2toolset (it still does for the legacy0.0.0toolset to maintain backwards compatibility). - A changeset entry documents the change as a minor feature.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
packages/app-builder-lib/src/targets/appimage/AppImageTarget.ts |
Removes --no-sandbox from the desktop entry Exec field for the 1.0.2 toolset; legacy 0.0.0 toolset retains it |
packages/app-builder-lib/src/targets/appimage/appImageUtil.ts |
Adds shell logic to the generated AppRun script to dynamically detect user namespace availability and conditionally set --no-sandbox |
test/snapshots/linux/linuxPackagerTest.js.snap |
Updates snapshot for 1.0.2 desktop entry to reflect the removed --no-sandbox |
.changeset/dull-carpets-stick.md |
Changeset for the new minor feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Looks like we have some tsc errors. Can you please TAL when you have a chance |
I have not found this to be the case in Kubuntu. I don't know if this is Ubuntu specific but I've used every recent version of Kubuntu and this doesn't match my experience in any of them. Would you happen to have a moment to elaborate this point?
|
|
Just to add, on Kubuntu in Dolphin if you try to launch an
My understanding is Ubuntu will close this route soon in Nautilus. More importantly, I'm skeptical that using |
To be honest, I'm not very familiar with Linux distributions. Prior to this pull request, it wouldn't work if desktop integration wasn't enabled, and if it was enabled, I simply made this behavior more as intended. If you believe the application should not automatically add |
|
Thanks for your reply @sabonerune. Before I make another issue, can you clarify if this behavior is on by default where |
|
@Nantris |
|
Hi folks, attempting to catch up here. What was the resolution and decision? (and/or created issues? CC @Nantris) Need to understand if this PR is an acceptable change before any release is pushed out. |
|
@mmaietta I've not gotten around to making a new issue but did plan to. I'm skeptical of this being activated by default. I see far less issue with it being opt-in. I suspect most developers using |
|
@Nantris Before this pull request |
|
@absidue thank you for the correction - I overlooked that. With that in mind the PR seems unquestionably an improvement over the current code. However if I'm reading the Am I interpreting the code properly that this is only for desktop shortcuts? I don't think it's good security practice to be bypassing it even selectively without being explicitly opt-in. |
|
Lazily created #9659 so further discussion of the use of |
|
@Nantris |
fix #8440
The method in #4496 has the following drawbacks:
The AppImage can be launched without desktop integration.
It also doesn't work when started from the command line.
user namespace should now be available on many Linux systems.
This means that
--no-sandboxis only needed in limited environments.Even in Ubuntu 24.04 or later, starting from file manager bypasses AppArmor restrictions, so
--no-sandboxis not required.https://discourse.ubuntu.com/t/understanding-apparmor-user-namespace-restriction/58007#p-148026-bypassing-apparmor-security-restriction
It's also possible that the user has disabled AppArmor.
This solves these problems by automatically detecting when the user namespace is unavailable and adding
--no-sandboxat runtime.