flatpak / flatpak-xdg-utils

Simple portal-based commandline tools for use inside flatpak sandboxes
GNU Lesser General Public License v2.1
32 stars 14 forks source link

Adapt to use the new OpenFile method from the OpenURI portal #1

Closed mariospr closed 7 years ago

mariospr commented 7 years ago

As part of https://github.com/flatpak/xdg-desktop-portal/pull/105, and to prevent a security issue where the sandbox could be escaped at a filesystem level, the OpenURI method of this portal stopped handling file:// URIs, meaning that external files now must be accessed either via the documents portal or by using a local the newly added OpenFile method, which accepts a file descriptor instead of the URI.

From what I can see in https://github.com/flatpak/flatpak-xdg-utils/blob/master/src/xdg-open.c, this implementation of xdg-open does not treat native and non-native URIs differently (they all go through the OpenURI portal), so this would need to be adapted for file:// URIs to continue working

matthiasclasen commented 7 years ago

This is probably best done by borrowing the gopenuriportal.c file that I added in glib for this. It puts a wrapper around the generated gdbus code that takes care of calling either OpenURI or OpenFile, depending on the kind of uri it gets.

matthiasclasen commented 7 years ago

See my PR

fmuellner commented 7 years ago

The PR has been merged.