- Are you using Flatpaks?
- Are you trusting Flathub?
- Do you bother about the sandboxing and security?
I expect the Flatpak sandbox to protect my ~/ from getting cluttered by applications, not to protect me from any actually malicious software. The post’s premise seems misguided.
YES. I don’t understand this delusion people keep perpetuating. Flatpak has a MILD form of container sandboxing. For a real security sandbox we have Firejails or Bubble wrap.
Flatpak is, at it’s core, a software development and distribution packaging format. NOT a security implementation.
Sandboxing and security are very much features of Flatpak, even if they don’t advertise those to end users. Unfortunately, of the few desktop native applications Linux supports, very few of them actually work right when you sandbox them properly, so they’re underused. Any attempt at sandboxing also sets off the “they’re taking away MY FREEDOM” people on Linux forums, which doesn’t help Flatpak gain any kind of popularity.
A proper packaged Flatpak app should have the same level of security as an application you run in Firejail (or Docker, for that matter). All of this stuff works through the same APIs. Developers just have to enable them for their application.
Even popular Flatpaks actually don’t allow path escapes unless you’ve manually disabled the sandbox with flatseal. Unfortunately, very few Linux developers understand the concept of least privilege, and lots of Linux code has been written with the expectation that all paths are readable and/or writeable, so packagers just disable the security rather than alter the code.
You can plainly see how effective the sandbox will be based on your software store of choice. You can also restrict applications after installation, though that’ll probably break stuff.
It’s pretty funny how Snap manages to provide more security than Flatpak despite being such an objectively worse solution in almost all other aspects.
I always check my flatpak settings post install before running the app and adjust permissions according to need. I mean it does offer more security to me since it’s user installed, I can granularly update permissions and control more or less where and what is can touch.
Alternatives to this are SELinux,AppArmour and firejails which are slightly more inconvenient to use.
To me that is mostly secure,or secure enough.
Well and then there’s some immutable distros which might help overall.
Edit: paragraphs
Yeah, you can lock down Flatpaks quite tightly, but you’ll often need to do it manually, and there’s a good chance something breaks. It’s a bit unfortunate that applications don’t come with stricter permissions (and that you can install Flatpaks through any GUI but need to download an external tool to manage their permissions through the GUI…).
If you apply sensible restrictions and the application doesn’t crash, there’s a definite security benefit. Out of the box, though, most applications can touch your ~/.profile because they ask permission for your home directory, and 30 years of Linux tooling isn’t prepared to move from dotfiles in the home directory to a more manageable alternative.
On my Steam Deck Flatpaks have proven to work very reliably. I don’t understand why distros don’t come with a “user mode apt/pacman/dnf” that can install applications from a nornal repository without root access (I guess Nix, maybe?) but Flatpak solves this problem very well.
If we admit that then an app store where anyone can create an account and upload software becomes extremely problematic. This is especially true wherein clients autoupgrade very quickly.
Step one. Legit package a popular app Step two. Wait for substantial uptake Step three. Mix in some ad or malware and watch a tens of thousands get instantly owned.
Anybody can become a community packager for Debian, Fedora, etc.
Anyone can’t become a packager in 30 seconds in an automated process that they can’ t repeat the 47th time they transmit malware.
The process is identical.
You show up with a package. It gets a basic review. You are granted commit access to your package. You can push changes.
There is slightly more oversight in that another mentor often also has commit access but they can’t and don’t review everything.
I ignored flatpaks long enough, as everything could be installed as packages, without additional GBs of dependencies/libraries/runtimes of flatpaks, that duplicate the system ones. Recently started using immutable system, which assumes flatpaks is primary way to install apps. I found it is incredibly convenient when all your apps put their data in a single place, easier to backup and system looks clean without bunch of shit, apps create where they want.
Yeah, Flatpak was never meant to be a security mechanism. It is a convenient way to add security to userland though.
In addition to own new code, bundled copies of libraries in packages introduces net new attack surface which isn’t patched via the regular distribution security patch process. The image decoding lib that allows remote code execution now exists in flatpaks independently from the one in /lib. Every flatpak vendor that contains it has to build and ship their own patched version of it. This is even more valid for any other libraries flatpaks include that don’t exist on the system. The most widely used Linux OSes come with security patching processes, expectations and sometimes guarantees. This new attack surface breaks those and the solution is security sandboxing. This approach has been proven in mobile app packaging and distribution systems. Android is a great example where apps are not trusted by default and vulnerable ones rarely cause collateral damage on otherwise up-to-date Android systems. This is an objective problem with the out-of-band distribution model allowed by flatpak and snap or any similar system, whether you care about it or not personally. It’s a well understood tradeoff in software development. It has to be addressed as adoption grows or we risk reducing Linux security to the levels of Windows where apps regularly bundle dependencies with no sandboxing whatsoever.
Every Flatpak vendor
So who’s that? Flathub and Fedora, the latter of who automate the Flatpak builds from distro packages anyway.
If you’re using a smaller distro which is not backed by a huge security team then this is probably an advantage of using Flatpak, not a negative.
Can the Fedora Flatpaks be browsed and downloaded for other distros?
Yes. All Flatpak apps can be used on any distro.
I’m using the Fedora Flatpak Firefox on Debian, because Fedora’s Flatpak runtime supports Kerberos authentication, the Flathub runtime doesn’t.
All Flatpaks are portable. There is no reason to use their repo usually though as Flathub often has more up to date, featureful, or upstream maintained versions instead.
Yes, I’m using flatpaks.
Yes, I’m trusting flathub. LOL about people repackaging applications. Wait until they find out the Linux distro they use is a collection of software repackaged by 3rd parties. 😂
Userland hasn’t had any concept of security, so it’s nice people are trying to fix it.
I have a handful of applications from Flathub I trust, but that’s it.
I don’t see Flatpak as a security mechanism and I don’t treat it like one.
This is generally good advice. Would you run the program without a sandbox? No? Then you probably shouldn’t run it inside a sandbox either.
You can never be sure that the program isn’t using a flaw in the sandbox to break out or is just piggybacking onto a whitelisted action that is required for the program’s basic functionality.And if some program requires r/w for your entire home directory and network access then you might as well not use a sandbox in the first place because it can already do everything useful that it needs to do.
There is a subset of only verified apps, if you want to be secure. But then you lack trustworthy unofficial apps like VLC.
flatpak remote-delete flathub ; flatpak remote-add --subset=verified flathub https://dl.flathub.org/repo/flathub.flatpakrepo
Also until every app uses Portals, and until we have a share portal, most apps are basically unrestricted if you compare it to Android.
Linux security to me has always been, don’t download random packages you don’t trust.
Even if you have trust. There can be security vulnerabilites in apps we are using. Flatpak seems to not really help in any way.
And this is why I’ve never taken much of Linuxs user base seriously when they talk about security. Hilariously bad defense strategy.
I’m mostly using Flatpaks on Tumbleweed, I only use the package manager if I can’t find a Flatpak version. Reason for that is that with Flatpak I can precisely know what I manually installed, as Tumbleweed lacks a proper easy way of getting a list of user installed packages
Are you using Flatpaks?
Yes, makes Debian desktop perfect. Rock solid base system, all desktop apps updated to the latest and greatest without pollution.
Are you trusting Flathub?
Yes BUT… there should be a way to have / manage / install Flatpaks offline like AppImages and/or easy and officially supported ways of archiving the repository into something useful and easy to use.
Do you bother about the sandboxing and security?
Too much security already: https://github.com/flathub/org.keepassxc.KeePassXC/issues/29#issuecomment-559476300 A password manger can’t community with a Browser as it is. This makes both useless and kills one of the best use cases for Flatpak.
FWIW I figured out how to get a password manager (Browserpass, not KeePassXC) to communicate with flatpak Chrome if you want some advice on how to get it to work.
But yes, it was way more difficult than it should have been (which is “should work out of the box, just like a regular package”). So if you’re just listing some of the shortcomings of flatpak, never mind.
Point away!
OK, so I looked though my browser history, and here are some relevant pages I found:
- keepassxc-browser Issue 1267
- keepassxc-browser Issue 1631
- keepassxc-browser Issue 1783
- browserpass-native Issue 93
I don’t remember how much I used each one, but eventually I pieced together enough information information to get the Browserpass extension working in the Google Chrome flatpak. But three of those links are KeePassXC, which should be useful for adapting this for your use.
The main file that was having problems was the Browserpass Native Messaging Hosts file in my config directory for the Chrome flatpak,
~/.var/app/com.google.Chrome/config/google-chrome/NativeMessagingHosts/com.github.browserpass.native.json
. Originally it was a symlink to a file at/usr/lib/browserpass/hosts/chromium/com.github.browserpass.native.json
:{ "name": "com.github.browserpass.native", "description": "Browserpass native component for the Chromium extension", "path": "/usr/bin/browserpass-linux64", "type": "stdio", "allowed_origins": [ "chrome-extension://naepdomgkenhinolocfifgehidddafch/" ] }
The call to
/usr/bin/browserpass-linux64
did not see to work for me, so I ended up making a copy of the file in theNativeMessagingHosts
directory and modified it to point to a script in my home mount:wile_e8 NativeMessagingHosts $ diff com.github.browserpass.native.json.orig com.github.browserpass.native.json 4c4 < "path": "/usr/bin/browserpass-linux64", --- > "path": "/home/wile_e8/.config/browserpass/browserpass.sh",
I don’t remember why I picked to do it inside the
~/.config
directory, but it worked so I left it. And here is the script I put at~/.config/browerpass/browserpass.sh
:#!/bin/sh cd ~ /usr/bin/flatpak-spawn --host /usr/bin/browserpass-linux64 2>/tmp/error.log
I don’t remember how I came up with that script, it must be somewhere in the four links at the top.
Finally, I needed to use Flatseal to allow access to the script. In the Google Chrome settings, under “Filesystem->Other files”, I added an entry saying
~/.config/browserpass:ro
. Also modified from the default in Flatseal, I have “Filesystem->All user files” enabled, along with “Socket->D-Bus session bus” and “Socket->D-Bus system bus”. I don’t know how necessary the last three are, but I’m not messing with it now that I have it working.So, that’s what I did to get the Browserpass extension working in the Google Chrome flatpak. You’ll have to modify some things to get it working for KeePassXC, or for Firefox. But that general pattern should work.
Hmm I kind of tried that route before but haven’t gone so far. I’ll check it asap. Thanks!
Keep an eye out, I’ll come back to this. It involves posting config file diffs and a script I wrote, it’ll be a longer post I don’t have the time to write right at this moment.
But yes, the fact that I need to find the time to post all the changes I needed to make to get this to work is part of the problem here.
Flatpak devs: “Let’s make a new portal!”
flatpak create-usb
backs up an app and all dependencies for offline use.Yes, that works really well and whatnot. Totally reliable way of doing it. :P
Because the flatpak components/dependencies of a program can differ depending on the host (for example if you have an NVIDIA card, it will pull some NVIDIA dependencies), so if you export a program from a non-NVIDIA system to the other, it won’t be complete to work reliably on the new system, but the missing parts can be downloaded on the Internet, it’s still reducing the bandwidth requirement.
For anyone interested: https://docs.flatpak.org/en/latest/usb-drives.html and https://dataswamp.org/~solene/2023-01-01-flatpak-export-import.html
Ah Nvidia, very true. I’m not sure a solution can exist for that. Nvidia needs the driver to match the kernel.
- Yes, it’s more convenient for some things
- Enough to use it
- Yes and no
Here is an alternative Piped link(s):
https://piped.video/xtsB38nyKtc
Piped is a privacy-respecting open-source alternative frontend to YouTube.
I’m open-source; check me out at GitHub.
deleted by creator
I write expressions and contribute
Is it possible to learn this power?
As someone who struggled quite a bit to learn Nix, I’d say start small. Install Nix the package manager on any old distro you’re familiar with and play with standalone Home Manager. Enable one program here and there, have it manage your shells and CLI apps, set environment variables and write files. It’s something you can immediately see the effects of and feels pretty rewarding, so I think it’s a great place to start.
I also happened upon this video series a few days ago and it’s a great resource, easy to parse and walks you through not only the basics but how to look around and investigate in the REPL when you want to figure something out.
Here is an alternative Piped link(s):
Piped is a privacy-respecting open-source alternative frontend to YouTube.
I’m open-source; check me out at GitHub.
deleted by creator
Side note, I wish yesterday me had read this before cloning the full 4 gigs lol
Tried couple of times and it didn’t work. I had more luck with AppImage. Don’t use it, don’t want it.
The Flatpak experience on Ubuntu is piss poor on purpose fwiw, Canonical kneecapped Flatpak in favour of Snaps. Try it on Fedora!
AppImages offer zero protection or containerization, it’s just a distribution format.
Okey, let me start the discussion.
What’s the point of sandboxing or permissions on environment for one user?
It means you can run apps without trusting their developer will full access to your computer and your files.
Just like on mobile, you only allow apps to access what you know they need. Nothing more.
Okey, so why we run apps without trusing developers in the first place? Or why do we even need the trust?
(It’s not that I think sandboxing is not useful sometimes, I just want to see if we get somewhere)
Think about service providers (government, banking, messaging, streaming, gaming). To participate in life we might depend on some of their services but don’t fully trust these parties. Flatpak is not secure/sandboxed enough to run untrusted apps. Meanwhile on Android the situation looks much better.
deleted by creator
That’s a feature not a bug. Under flathub, the original author of the software (for verified apps at least) knows what is the best configuration to ship for their package.
ATM. You are not trusting flathub when installing a flatpak. You are trusting the application’s author. Maybe in the future, flathub would introduce restrictions on certain permissions but we would be speculating at that point.
I HATE org.shit.fuck.
Nope, I’ll never use flatpak, appImage, snap, things like this.
If there’s no .deb to install, I try to compile it myself.