Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree that the implementation is lacking. Snap has the abysmally named "--classic" parameter to allow installs to "run without confinement". Flatpak can request permission changes at install time (albeit declaring them), where users are likely to just click OK/OK/OK. The sandboxing needs to be tightened up.

Flathub is a strange beast. There's no mention of security on their wiki. They stopped publishing minutes (or moved them elsewhere?) in 2017 (https://github.com/flathub/flathub/wiki). They have a buildbot for automated updates from developers, but they accept binaries anyway (e.g. https://github.com/flathub/us.zoom.Zoom/blob/master/us.zoom....), so what's the point? It appears to be a fairly amateur effort, and yet is at the center of the infrastructure Red Hat and Gnome are pushing. I'd love to see some white hat activity targeted at compromising it, to demonstrate the shaky foundations.

But on the other hand, it's nice that I can run Zoom sandboxed (apparently - it's not obvious what the granted permissions are: https://www.flathub.org/apps/details/us.zoom.Zoom). It's nice that Jetbrains and Zoom have a way to publish apps that can run on all distros. It's nice that I could rollback a version of IntelliJ that was buggy with a single snap command that took 5 seconds. The goals are good.

I wish Linus took more of a BDFL approach to the desktop occasionally. Ubuntu & Red Hat need to sit down in a room and have a constructive conversation to converge Snap and Flatpak into something new, deprecating the infrastructure built to date, and fixing some of the glaring problems. There's room for both to make money without further diverging the ecosystem.



the flatpak sandbox UX is bleak. right now, you have to check the JSON file you linked to check how much access a flatpak program gets. i disagree with the --own-name and --talk-name flags (i think this is for screensharing; zoom should use the screensharing portal instead. letting zoom talk to gnome shell directly could be bad.).

--socket=x11 is a massive hole in the sandbox, since x11 does not have a security model - any client can observe and manipulate any other client. for x11, a viable solution would be running flatpak apps in xephyr, but flatpak doesn't do that. long-term, wayland is a better solution.


Try this to manage application permissions: https://flathub.org/apps/details/com.github.tchx84.Flatseal


It's not really that bad. You are told the permissions requested by an app on installation:

  $ flatpak install flathub com.microsoft.Teams

  com.microsoft.Teams permissions:
      ipc     network     pcsc     pulseaudio     x11     devices     file access [1]     dbus access [2]     tags [3]
  
      [1] xdg-download
      [2] org.freedesktop.Notifications, org.freedesktop.secrets, org.gnome.SessionManager, org.kde.StatusNotifierWatcher
      [3] proprietary


          ID                           Branch          Op         Remote          Download
   1.     com.microsoft.Teams          stable          i          flathub         < 86.0 MB

  Proceed with these changes to the system installation? [Y/n]: 

and you can query an apps permissions at any time:

  $ flatpak info --show-permissions com.discordapp.Discord

  [Context]
  shared=network;ipc;
  sockets=x11;pulseaudio;
  devices=all;
  filesystems=xdg-download;xdg-pictures:ro;xdg-videos:ro;home;

  [Session Bus Policy]
  org.kde.StatusNotifierWatcher=talk
  org.freedesktop.Notifications=talk
  com.canonical.AppMenu.Registrar=talk
  com.canonical.indicator.application=talk
  com.canonical.Unity.LauncherEntry=talk
GNOME Software in GNOME 41 also has a much better list of permissions than the version shown in this article.

https://blogs.gnome.org/tbernard/2021/09/09/software-41-cont...


> x11 does not have a security model - any client can observe and manipulate any other client

This hasn't been the case for decades. X has the ability to isolate clients and/or only allow partial access to other clients. For example try this:

    $ xauth -f lockthisout generate :0 . untrusted
    $ XAUTHORITY=lockthisout xterm
The first line generates a new X authority file with a single entry that causes the display :0 to be untrusted. Then whatever runs inside xterm (or whatever you launch) will be considered as untrusted, e.g. you wont be able to run any OpenGL application or xdotool (it actually crashes after saying the XTEST extension isn't available, i guess it can't handle that case).

Note that this can be worked around by running "export XAUTHORITY=~/.Xauthority" since pretty much everything uses ~/.Xauthority for the local user (which is connected as trusted). This one can also be addressed by storing the session X authority file somewhere else (AFAIK some distros generate a new randomly named one for every session), or you could use something like AppArmor or SELinux to restrict the untrusted application's access to the session's X authority file. Or just run it as a different user who is always untrusted, though that can be inconvenient for some types of applications.

That said there are some issues, mainly because the whole X security functionality hasn't seen much attention in recent years. For example an untrusted client can't use 3D accelerated graphics but you may actually want to run a 3D app while not giving it access to everything else. Though that isn't due to some inherent limitation of X or whatever, just that since it never gained much attention (since the entire GUI sandboxing thing was never much of a priority) nobody bothered to work that part out.

In the future it might just be better for X desktop to be running untrusted applications under a Wayland "pseudocompositor" that simply lets X handle the actual window management (current Wayland compositors that can run under X create a window and treat it as a display which isn't exactly nice from a UX perspective and doesn't allow -trusted- X programs like xdotool work with Wayland windows).


> right now, you have to check the JSON file you linked to check how much access a flatpak program gets

In general, GUI package managers w/ Flatpak support show you the permissions, as does the CLI upon an attempted install.


> Snap has the abysmally named "--classic" parameter to allow installs to "run without confinement".

Only if the snap was built with classic confinemnt in mind. Otherwise, just slapping --classic on a random snap does nothing, there's even a warning display about that. Classic is very much the same as a random 3rd party vendor app built and unpacked under /opt. Unfortunately some software, especially IDEs and languages are unsuitable for running under confinement and need to be distributed this way. By passing --classic you give your consent to use an app package in this sub-par way.

FWIW, perhaps you meant --devmode, which as the name implies is mostly for developing a snap? snap install --help describes that as:

    --devmode  Put snap in development mode and disable security confinement


> especially IDEs and languages are unsuitable for running under confinement and need to be distributed this way

I think the solution to that should be something other than removing the sandbox. I see "portals" referred to elsewhere in this thread w.r.t. flatpak; does snap not have similarly?

> By passing --classic you give your consent to use an app package in this sub-par way.

Sure, but it's a terrible name. It should be --unsandboxed or --fullaccess. "Classic" sounds like a mode you'd want.


> I think the solution to that should be something other than removing the sandbox. I see "portals" referred to elsewhere in this thread w.r.t. flatpak; does snap not have similarly?

Snaps use portals like flatpaks do. The problem is more about frameworks you build applications with not being ready to consume portals. Turns out only some reasonably recent Qt versions can work with portals. IIRC Electron only landed support couple of months ago. Back on the host side of confinement, you need to run a reasonably recent xdg-desktop-portal (and a maching GUI integration bit). Some old distros do not provide any of those packages or ship version that don't work, so things are DOA.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: