swift-selection-search icon indicating copy to clipboard operation
swift-selection-search copied to clipboard

Removing permission to export settings

Open Gitoffthelawn opened this issue 1 year ago β€’ 5 comments

Hi Daniel! I hope you are well.

Now that you are actively creating new versions every week (πŸ˜†πŸ˜†πŸ˜†), I thought I would take this opportunity to mention a simple little issue that can probably be resolved without messing anything else up.

Swift Selection Search currently requires the Download files and read and modify the browser’s download history permission to export its own settings. It's the only extension I've seen that requires this permission for this functionality. Because I prefer to restrict permissions as much as possible, I find myself temporarily toggling that permission on every time I want to make a backup, and then toggling it off again. It's a very minor nuisance. Would it be possible to allow settings exports without needing that permission?

If you find it helpful, I can provide you with a list of several extensions that allow exporting their settings without needing that permission.

As always, my best regards to you.

Gitoffthelawn avatar Apr 13 '25 21:04 Gitoffthelawn

Hi Daniel! I hope you are well.

Hi! All good here, thanks! I hope you are doing well too. :)

Now that you are actively creating new versions every week (πŸ˜†πŸ˜†πŸ˜†)

Don't count on it hahah πŸ˜† The issue with Favicon Kit needs to be fixed in SSS before it causes problems to a lot more people. :) It also becomes sort of an SSS bug now.

Swift Selection Search currently requires the Download files and read and modify the browser’s download history permission to export its own settings.

Ah, this one πŸ˜„ It's been years since I looked into this, but I remember being happy that I could make it an optional permission.

Mozilla's docs still list this as the way to save a file in a user-specified path: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Working_with_files

There is also this API, which is experimental and doesn't exist in Firefox: https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker

Other than these I don't know of any other way (the others are for saving in browser storage or communicating with native apps). That doesn't mean it doesn't exist, though. Could you point me to a few of those extensions?

Wishing you all the best! :)

CanisLupus avatar Apr 13 '25 22:04 CanisLupus

Glad to hear you are doing well Daniel! Some significant challenges here, but I respond well to challenges and am doing my best. πŸ˜‰

I found a bunch of quality extensions that, to the best of my understanding, can all export their settings without needing the Download files and read and modify the browser’s download history. Some of them have that as an optional permission, but it need not be enabled for the export functionality to work (I tested each one). Each one has its source code available on GitHub.

Here's the list:

victrme/Bonjourr: Minimalist & lightweight startpage inspired by iOS https://github.com/victrme/Bonjourr

piroor/copy-selected-tabs-to-clipboard: Provides ability to copy title and URL of selected tabs to the clipboard for Firefox 63 and later. https://github.com/piroor/copy-selected-tabs-to-clipboard

darkreader/darkreader: Dark Reader Chrome and Firefox extension https://github.com/darkreader/darkreader

einaregilsson/Redirector: Browser extension (Firefox, Chrome, Opera, Edge) to redirect urls based on regex patterns, like a client side mod_rewrite. https://github.com/einaregilsson/Redirector

airtower-luna/referer-mod: Web Extension to modify the Referer header in HTTP requests https://github.com/airtower-luna/referer-mod

mbnuqw/sidebery: Firefox extension for managing tabs and bookmarks in sidebar. https://github.com/mbnuqw/sidebery

openstyles/stylus: Stylus - Userstyles Manager https://github.com/openstyles/stylus

gorhill/uBlock: uBlock Origin - An efficient blocker for Chromium and Firefox. Fast and lean. https://github.com/gorhill/uBlock

Be well, my friend.

Gitoffthelawn avatar Apr 15 '25 08:04 Gitoffthelawn

Glad to hear you are doing well Daniel! Some significant challenges here, but I respond well to challenges and am doing my best. πŸ˜‰

Understood, hope it all goes well :)

Here's the list

Thanks a lot! I looked at 3 of them where I could easily find the download code. All 3 do this weird hack (to me as a non-web developer :D) where they create a sudden anchor element on the page, set its target, and then fake a click on it to start the download πŸ™ƒ

Some links for myself:

  • https://github.com/airtower-luna/referer-mod/blob/89471afef18c6e9c841743448e0519f4ea4061c2/options.js#L247C10-L247C22
  • https://github.com/victrme/Bonjourr/blob/9c7179b7a5f21fea272e36a1ad349c9d1ff6fded/src/scripts/settings.ts#L1084
  • https://github.com/gorhill/uBlock/blob/87007e62c00bc77d6a77ace8d02b6cf209d7ee23/platform/common/vapi-common.js#L203

Do you know if any of these extensions allow you to pick the folder where you save the file like SSS does? Or do they just start a download?

CanisLupus avatar Apr 16 '25 09:04 CanisLupus

Understood, hope it all goes well :)

Thank you Daniel. I appreciate your kind wishes.

Thanks a lot! I looked at 3 of them where I could easily find the download code. All 3 do this weird hack (to me as a non-web developer :D) where they create a sudden anchor element on the page, set its target, and then fake a click on it to start the download πŸ™ƒ

You're welcome. I can't really comment if that technique is weird or not, but I can say that uBlock Origin is the most popular extension for Firefox (by a factor of ~5x), so if that's how it does it, I think it's reasonably standard right now. It's also a Mozilla Recommended extension, so Mozilla has approved that code.

Some links for myself:

* https://github.com/airtower-luna/referer-mod/blob/89471afef18c6e9c841743448e0519f4ea4061c2/options.js#L247C10-L247C22

* https://github.com/victrme/Bonjourr/blob/9c7179b7a5f21fea272e36a1ad349c9d1ff6fded/src/scripts/settings.ts#L1084

* https://github.com/gorhill/uBlock/blob/87007e62c00bc77d6a77ace8d02b6cf209d7ee23/platform/common/vapi-common.js#L203

Do you know if any of these extensions allow you to pick the folder where you save the file like SSS does? Or do they just start a download?

I tested the three above, and none of those allow you to pick the folder, but they cause a standard dialog box to appear that allows the user to save the export or cancel the save operation. The dialog box shows the name of the file being saved.

... 3 minutes later ...

I also tested Redirector, Dark Reader, and Stylus, as they are very popular. The user-facing experience is the same.

.... 3 minutes later ...

To be thorough, I went ahead and tested the others too. The user-facing experience is the same on all of them. :)

Gitoffthelawn avatar Apr 16 '25 12:04 Gitoffthelawn

Sorry for the delay!

Yeah, no doubt the approach is fine and probably some standard way. It's just surprising to me 😁

I think it would likely be ok to change this to be a simple download instead of allowing folder picking, but it would be a change for the (very slightly) worse. On the other hand it does avoid the permission. I haven't tried it, though. If I do and it seems like a positive change I'll let you know, but no promises at the moment :)

CanisLupus avatar Apr 23 '25 17:04 CanisLupus