snapcrafters / signal-desktop

Unofficial Signal Desktop installer for Linux
https://snapcraft.io/signal-desktop
GNU Affero General Public License v3.0
33 stars 15 forks source link

[Bug]: "Show in folder" selects wrong folder #82

Open hvbakel opened 1 year ago

hvbakel commented 1 year ago

What happened?

After downloading an attachment, Signal briefly shows a small popup window with the option "Show in folder" to open a file manager window for the folder where the attachment was saved to. When clicking this option a nautilus window opens but to the wrong folder. It appears to always select the parent folder to the folder the file was actually saved to. For example, when saving to the folder /home/USER, the /home folder will be opened instead. When saving to /home/USER/Downloads, the folder /home/USER will be selected instead, etc.

This problem does not appear limited to Signal, the same issue is also apparent in the Slack snap.

What should have happened?

The correct folder with the downloaded attachment should be opened.

Output of snap info $snap_name

name:      signal-desktop
summary:   Private messaging from your desktop.
publisher: Snapcrafters
store-url: https://snapcraft.io/signal-desktop
contact:   https://github.com/snapcrafters/signal-desktop/issues
license:   AGPL-3.0-only
description: |
  Private messaging from your desktop.

  To use the Signal desktop app, Signal must first be installed on your phone.

  **Are you having issues?**

  Let us know by creating a new issue here: https://github.com/snapcrafters/signal-desktop/issues

  **Authors**

  This snap is maintained by the Snapcrafters community, and is not necessarily endorsed or
  officially maintained by the upstream developers.
commands:
  - signal-desktop
snap-id:      r4LxMVp7zWramXsJQAKdamxy6TAWlaDD
tracking:     latest/stable
refresh-date: today at 07:18 EST
channels:
  latest/stable:    6.0.1  2022-12-07 (408) 197MB -
  latest/candidate: 6.0.1  2022-12-08 (414) 197MB -
  latest/beta:      5.62.0 2022-11-24 (400) 192MB -
  latest/edge:      6.0.1  2022-12-09 (415) 197MB -
installed:          6.0.1             (408) 197MB -

Output of snap connections $snap_name

Interface               Plug                                   Slot                            Notes
audio-playback          signal-desktop:audio-playback          :audio-playback                 -
audio-record            signal-desktop:audio-record            :audio-record                   -
browser-support         signal-desktop:browser-support         :browser-support                -
camera                  signal-desktop:camera                  :camera                         -
content[gnome-42-2204]  signal-desktop:gnome-42-2204           gnome-42-2204:gnome-42-2204     -
content[gtk-3-themes]   signal-desktop:gtk-3-themes            gtk-common-themes:gtk-3-themes  -
content[icon-themes]    signal-desktop:icon-themes             gtk-common-themes:icon-themes   -
content[sound-themes]   signal-desktop:sound-themes            gtk-common-themes:sound-themes  -
desktop                 signal-desktop:desktop                 :desktop                        -
desktop-legacy          signal-desktop:desktop-legacy          :desktop-legacy                 -
gsettings               signal-desktop:gsettings               :gsettings                      -
home                    signal-desktop:home                    :home                           -
network                 signal-desktop:network                 :network                        -
opengl                  signal-desktop:opengl                  :opengl                         -
removable-media         signal-desktop:removable-media         -                               -
screen-inhibit-control  signal-desktop:screen-inhibit-control  :screen-inhibit-control         -
unity7                  signal-desktop:unity7                  :unity7                         -
wayland                 signal-desktop:wayland                 :wayland                        -
x11                     signal-desktop:x11                     :x11                            -

Output of snap version

snap    2.57.6
snapd   2.57.6
series  16
ubuntu  22.04
kernel  5.15.0-57-generic

Relevant log output

[571993.826536] audit: type=1400 audit(1670675572.823:1765): apparmor="DENIED" operation="open" profile="snap.signal-desktop.signal-desktop" name="/run/mount/utab" pid=357284 comm="signal-desktop" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[571993.957612] audit: type=1107 audit(1670675572.955:1766): pid=933 uid=103 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/hostname1" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.2152" pid=357284 label="snap.signal-desktop.signal-desktop" peer_pid=358013 peer_label="unconfined"
                 exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?'
[571993.957670] audit: type=1107 audit(1670675572.955:1767): pid=933 uid=103 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/hostname1" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.2152" pid=357284 label="snap.signal-desktop.signal-desktop" peer_pid=358013 peer_label="unconfined"
                 exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?'
[571993.957716] audit: type=1107 audit(1670675572.955:1768): pid=933 uid=103 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/hostname1" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.2152" pid=357284 label="snap.signal-desktop.signal-desktop" peer_pid=358013 peer_label="unconfined"
                 exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?'
[571993.958033] audit: type=1107 audit(1670675572.955:1769): pid=933 uid=103 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/hostname1" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.2152" pid=357284 label="snap.signal-desktop.signal-desktop" peer_pid=358013 peer_label="unconfined"
                 exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?'

Teminal output of app

[357284:1210/073115.045970:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.FileManager1.ShowItems: object_path= /org/freedesktop/FileManager1: org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.1557" (uid=1000 pid=357284 comm="/snap/signal-desktop/408/opt/Signal/signal-desktop" label="snap.signal-desktop.signal-desktop (enforce)") interface="org.freedesktop.FileManager1" member="ShowItems" error name="(unset)" requested_reply="0" destination="org.freedesktop.FileManager1" (uid=1000 pid=157318 comm="/usr/bin/nautilus --gapplication-service " label="unconfined")
[357284:1210/073115.046002:ERROR:platform_util_linux.cc(238)] Error calling ShowItems
merlijn-sebrechts commented 1 year ago

What an interesting issue, thanks for reporting it!

The XDG File Manager DBus Interface is blocked by snapd. The worry is that malware might use this interface for phishing.

Signal-desktop should fall-back to using xdg-open to show the directory that contains the file. But for some reason this fails.

merlijn-sebrechts commented 1 year ago

This seems to be the reason; when the dbus call fails, it tries to open the parent folder using another call: https://chromium.googlesource.com/chromium/src/+/master/chrome/browser/platform_util_linux.cc#276

So there are two ways to fix this: