Manual review request - shadowsocks-electron

The new version adds personal-files interface as a depends. In order to support Launch On Boot feature on snap platform, it needs to save a desktop file named shadowsocks-electron.desktop in ~/.config/autostart/ directory.

Please confirm that and thanks in advance.

Granting write access to ~/.config/autostart/ would allow a snap to escape confinement by specifying any arbitrary command be run. Instead however, a snap can allow itself to be autostarted by specifying the autostart property within their snapcraft.yaml as per https://snapcraft.io/docs/snapcraft-yaml-reference - this should be the name of a desktop file which is expected to reside in $SNAP_USER_DATA/.config/autostart - ie. ~/snap/<snap_name>/<revision>/.config/autostart - so your snap can simply create this file and as it resides in the snap’s private storage location there is no need to use personal-files to access this. Also since by default the HOME environment variable is set to ~/snap/<snap_name/<revision/ for a snap when it is run, you can simply create the autostart file as say $HOME/.config/autostart/shadowsocks-electron.desktop and this will automatically create it in the right place and then you just need to set autostart: shadowsocks-electron.desktop. Then it should just work.

I use this for one of my own snaps - see https://github.com/alexmurray/indicator-sensors/blob/master/snap/snapcraft.yaml#L35 and https://github.com/alexmurray/indicator-sensors/blob/master/indicator-sensors/is-application.c#L690 where as you can see there is no snap-specific code to handle creating the autostart file - this just uses the normal APIs and things just work.

1 Like

@nojsja since you marked @alexmurray comment as solution, we are removing this request from our review queue. If you have any further question, please ask here again and we will be happy to answer.

Thanks!