-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firefox: cannot save files with the File Chooser Portal (dbus) #4716
Comments
Which DE (or better which portal implementation+version) do you use? Some implementation dislike
Quite obvious. The distro and version is more interesting. |
I'm a bit confused. Our Firefox profile is designed as a 'whitelist' profile. This implies that access is blocked to all paths that are not explicitly whitelisted, like ~/tmp. So IMO this is expected behavior. Can you save files in ~/tmp if you add a |
@rusty-snake commented on Nov 26:
AFAIK "-arch" is what Arch Linux uses. On Artix: $ uname -sro
Linux 5.15.2-artix1-1 GNU/Linux @glitsj16 commented on Nov 26:
I think the intent here is to make the file portal work so that the user can |
@kmk3 Thanks for explaining. I'm not at all familiar with (the inner workings of) these |
I'm using swaywm, and using the xdg-desktop-portal-gtk as a file picker portal.
Adding
Sorry for not being clearer, it's Arch (rolling release). #4716 (comment) is correct, my intent is to use the portal to allow reading / writing files outside whitelisted locations. For reference, I can open a file in |
@WhyNotHugo are you sure |
Yeah, apparently reading doesn't work either -- I can pick a file, but it's not read correctly. Sorry, it seems I tested this wrong a bit. The file chooser portal actually exposes the file via the document portal, which, in turn, uses a fuse mount, so I guess I'd have to whitelist that path too. I'll give that a shot and report back. |
I don't think so. |
I'm experimenting with Firefox in Flatpak too, to understand what's implemented and what isn't. With With |
Maybe the flatpak as a special patch which isn't in firefox yet? Or these code paths are only used if you run inside flatpak? |
I believe there are no special patches, but at this point, I think it's best to report this on the Firefox side just to make sure there's nothing else necessary on their side. Thanks for the guidance thus far. |
🎉 I made my non-flatpak fox perform reading through document portal: bwrap --ro-bind /usr /usr --symlink usr/bin /bin --symlink usr/lib /lib --symlink usr/lib64 /lib64 --symlink usr/sbin /sbin --ro-bind /etc /etc --ro-bind /var /var --ro-bind /run /run --dir /tmp --dev-bind /dev /dev --ro-bind /sys /sys --bind /proc /proc --dir $HOME --bind $XDG_RUNTIME_DIR $XDG_RUNTIME_DIR --ro-bind-data 3 /.flatpak-info /usr/bin/firefox --no-remote 3<<EOF
[Application]
name=org.mozilla.firefox
EOF Portals look for/at Writing still doesn't work. |
This example doesn't work for me. I set Also tried adding |
The portal handles flatpake'd applications different from native ones. See flatpak/xdg-desktop-portal#680 (comment) So I guess for this to work, a portal needs to be spawn in a specific way. I'll follow up as I learn more, but it's possible that a firejail-specific-portal-launcher is needed (or something similar; kinda like how xdg-dbus-portal is integrated). This probably isn't as simple as I original expected, but I still think it's worth it since it allows further restricting how much access applications have, and this applies to a lot of other things other than Firefox. |
Yes, I know, that's why I did bwrap … --ro-bind-data 3 /.flatpak-info … 3<<EOF
[Application]
name=org.mozilla.firefox
EOF above. |
Yeah, but the portal doesn't run inside the sandbox, so it won't detect that file. Or am I missing something? |
Do they for flatpak? (rhetorical question)
AFAIK portals look at |
You're very right, I'd misinterpreted both your message and the one in the linked issue. I ran chromium via flatpak, and opened [Application]
name=org.chromium.Chromium
runtime=runtime/org.freedesktop.Platform/x86_64/21.08
[Instance]
instance-id=535920758
instance-path=/home/hugo/.var/app/org.chromium.Chromium
app-path=/var/lib/flatpak/app/org.chromium.Chromium/x86_64/stable/b5cdf307caeee0bafeef91a270d0275c5e090b7ae4e8b36bb3ba1e09d5aad6be/files
app-commit=b5cdf307caeee0bafeef91a270d0275c5e090b7ae4e8b36bb3ba1e09d5aad6be
app-extensions=org.chromium.Chromium.Codecs=305ed74b5afde01cef9d26b9723d5acb2f47561b55c30f79063a7dea9b62742d;org.chromium.Chromium.Locale=8536d50082de1b2bede1236e8b4c834025f3a7463d0dc19a94dc5a7c26630718
runtime-path=/var/lib/flatpak/runtime/org.freedesktop.Platform/x86_64/21.08/940b0728d1b7d18b9d3f557ae44e7c37b27febcb04f93a7cc0ebb886ba2cfa37/files
runtime-commit=940b0728d1b7d18b9d3f557ae44e7c37b27febcb04f93a7cc0ebb886ba2cfa37
runtime-extensions=org.freedesktop.Platform.GL.default=031dc8a64a8fc1ed5819295270af05241a8982b0e0a48cd6f53fd69704cbb437;org.freedesktop.Platform.Locale=e351675710d3a6b6675db60e8d3cf496f700c3c9704a3c09f97448847bc89cc3;org.gtk.Gtk3theme.Arc-Dark=e048bba59ea07a84bb3f9c092dcab6adf45b4f626224983ab553ee19ae67f1a3;org.gtk.Gtk3theme.Arc-Darker=37974c74afc5b4d77104015a13318422c331dfa023790cd64b90b1b15271f472;org.freedesktop.Platform.VAAPI.Intel=0b5fc0c4a2e7930ccff2d6d4389296e64ed6d4067910a76a9f31461485574eec;org.freedesktop.Platform.openh264=73f998362a6fc0d57e0c7e83e928d32b0ec14d10d0d94291033976bdcecc6b6b
branch=stable
arch=x86_64
flatpak-version=1.12.2
session-bus-proxy=true
system-bus-proxy=true
[Context]
shared=network;ipc;
sockets=x11;wayland;pulseaudio;cups;
devices=all;
filesystems=!home;xdg-download;/run/.heim_org.h5l.kcm-socket;
[Session Bus Policy]
org.gnome.SessionManager=talk
org.freedesktop.Notifications=talk
org.mpris.MediaPlayer2.chromium.*=own
org.freedesktop.secrets=talk
org.freedesktop.FileManager1=talk
[Environment]
ALSA_CONFIG_PATH=/usr/share/alsa/alsa-flatpak.conf
GI_TYPELIB_PATH=/app/lib/girepository-1.0
GST_PLUGIN_SYSTEM_PATH=/app/lib/gstreamer-1.0:/usr/lib/extensions/gstreamer-1.0:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
XDG_DATA_DIRS=/app/share:/usr/share:/usr/share/runtime/share:/run/host/user-share:/run/host/share
LD_LIBRARY_PATH=/app/chromium/nonfree-codecs/lib
ALSA_CONFIG_DIR=/usr/share/alsa
GTK_PATH=/app/lib/gtkmodules |
The portal seems to use this to read additional metadata from Flatpak: https://github.com/flatpak/xdg-desktop-portal/blob/0c3d8fddc4afbe06c5bb6fdde02b35a6d97e6f7d/src/xdp-utils.c#L1838 It behaves differently with Flatpak vs non-Flatpak applications, and won't expose its regular functionality to applications that are not Flatpaks, even if they're sandboxed. At this point, I suspect writing a new portal is more feasible than trying to leverage that one. |
Unless someone wants to bring firejail support into x-d-p this will be wontfix. Closing for now. |
I do believe a potential fix is possible; I've outlined an idea in #5318 |
In which comment? |
Description
I've set the Firefox setting
widget.use-xdg-desktop-portal
totrue
, so that it uses the File Chooser Portal.When saving a file, the file is not persisted to disk.
Steps to Reproduce
Steps to reproduce the behavior
about:config
widget.use-xdg-desktop-portal
totrue
Expected behavior
File should be saved.
Actual behavior
File isn't saved.
Behavior without a profile
It works. It also works with Firefox's flatpak.
I mostly tested the Flatpak since the native Firefox has permissions to write there anyway, whereas the Flatpak does not. This makes me suspect it's a firejail profile issue and not Firefox itself misusing the portal.
Additional context
I'm very new to firejail (jumped to using it yesterday), so hope I haven't missed anything obvious.
Environment
firefox.local
andglobals.local
.Checklist
/usr/bin/vlc
) "fixes" it).https://github.com/netblue30/firejail/issues/1139
)browser-allow-drm yes
/browser-disable-u2f no
infirejail.config
to allow DRM/U2F in browsers.The text was updated successfully, but these errors were encountered: