A couple of years ago, we sandboxed thumbnailers using bubblewrap to avoid drive-by downloads taking advantage of thumbnailers with security issues.
It's a great tool, and it's a tool that Flatpak relies upon to create its own sandboxes. But that also meant that we couldn't use it inside the Flatpak sandboxes themselves, and those aren't always as closed as they could be, to support legacy applications.
We've finally implemented support for sandboxing thumbnailers within Flatpak, using the Spawn D-Bus interface (indirectly).
This should all land in GNOME 40, though it should already be possible to integrate it into your Flatpaks. Make sure to use the latest gnome-desktop development version, and that the flatpak-spawn utility is new enough in the runtime you're targeting (it's been updated in the freedesktop.org runtimes #1, #2, #3, but it takes time to trickle down to GNOME versions). Example JSON snippets:
{ "name": "flatpak-xdg-utils", "buildsystem": "meson", "sources": [ { "type": "git", "url": "https://github.com/flatpak/flatpak-xdg-utils.git", "tag": "1.0.4" } ] }, { "name": "gnome-desktop", "buildsystem": "meson", "config-opts": ["-Ddebug_tools=true", "-Dudev=disabled"], "sources": [ { "type": "git", "url": "https://gitlab.gnome.org/GNOME/gnome-desktop.git" } ] }
(We also sped up GStreamer-based thumbnailers by allowing them to use a cache, and added profiling information to the thumbnail test tools, which could prove useful if you want to investigate performance or bugs in that area)
Edit: correct a link, thanks to the commenters for the notice