Closed Bug 1461759 Opened 7 years ago Closed 3 years ago

[snap] Opening a file with "Url Handler Script" does nothing

Categories

(Release Engineering Graveyard :: Release Automation: Snap, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: olivier, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached image url-handler-script.png
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.40 Safari/537.36 Steps to reproduce: (issue initially reported on the snapcraft forum: https://forum.snapcraft.io/t/firefox-url-handler-does-nothing/5329) 1) snap run firefox 2) click on a link to e.g. a .doc file 3) the default action proposed to the user is to open the file with "Url Handler Script" (see attached screenshot), click OK to do that Actual results: Nothing happens, the document is not opened. Seeing the following error in terminal: user-open error: no such file or directory Expected results: The file should be opened with whatever the default application for its mimetype is (e.g. libreoffice for a doc file).
I could reproduce this issue with snap run firefox. I get option to open doc with "Url Handler Script" and after clicking 'OK' doc is not opened and terminal shows 'user-open error: no such file or directory'. Placing this under Firefox:Shell Integration so someone can look into it. Feel free to change this to more appropriate component.
Status: UNCONFIRMED → NEW
Component: Untriaged → Shell Integration
Ever confirmed: true
+1
Component: Shell Integration → File Handling
Blocks: snappy
Component: File Handling → Security: Process Sandboxing
Product: Firefox → Core

Snap's sandbox, not ours.

I assume the Snap environment has some way for an application to ask for a file to be opened in another app, but I don't know the details.

Component: Security: Process Sandboxing → Release Automation: Snap
Product: Core → Release Engineering
QA Contact: jlorenzo
Version: 59 Branch → unspecified

Yes, the blessed way for snaps to open a file is to call xdg-open, which is being proxied (after a few sanity checks) to outside the snap confinement.

As I understand it, firefox doesn't use xdg-open, instead it tries to query the system for applications that can handle a certain file type. This will fail in a strictly confined snap where this would be considered an information leak.

Firefox does use xdg-open if it's chosen as target application. The problem is that FF always save the file to /tmp or $TMPDIR before passing it over and /tmp in snap is being namespaced and inaccessible for anything outside snap sandbox. If the $TMPDIR would be set to some other path like $TMPDIR=$"SNAP_USER_DATA" in desktop-launcher the problem may be gone.

sorry, it should be "export TMPDIR=$"$SNAP_USER_DATA"

I tested this again on a variety of Ubuntu releases, and I'm not seeing this "Url Handler Script" option any longer, when opening files that are not handled by Firefox directly. Instead the default option in the dialog is "System Handler", and it does the right thing.

This bug can be closed.

Closing per comment 9.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
Product: Release Engineering → Release Engineering Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: