Closed Bug 1643785 Opened 5 years ago Closed 5 years ago

Complete the Search API by adding a method browser.search.set()

Categories

(WebExtensions :: Untriaged, enhancement)

enhancement

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: olivier.debroqueville, Unassigned)

References

Details

The Search API currently has a method browser.search.get() which allows add-on developers to retrieve information about the search engines in Firefox. However, developers are still missing the possibility to add a search engine into Firefox programmatically. This is where a browser.search.set() method would come in handy. It. would allow for the export of search engines from extensions to Firefox (and its search bar) and open the way to syncing search engines between extensions and Firefox.

The set() method could take an array of objects as an argument, where each object would contain the required information to build a search engine (e.g. name, alias, isDefault, favIconUrl, query url if it's based on a GET method, etc...).

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Address Bar
Product: WebExtensions → Firefox
Component: Address Bar → Untriaged
Product: Firefox → WebExtensions

Search engines can be added via manifest.json, but you're asking for something more general. APIs for adding search engines are a little tricky since the potential for abuse is high. Cc'ing a couple of folks more involved in search so they can add their thoughts.

At this point we advise against adding yet another method to add search engines programmatically, since the chance of abuse (hijacking of search settings by malware) is high.

The only thing that we could consider here is the allow adding a search engine that will not be set as default and that way can only really be used as a one-off search option or can be set as a default by the user, manually.

Am I correct in saying that this malware would have to be an extension using Webextension's Search API? Furthermore, this extension would require 'search' permission in the manifest. Another level of protection is that the extension would have to be Recommended. Why are all these security measures not sufficient?

After second thoughts, maybe it is indeed preferable to prevent hijacking of the default search engine. Allowing the addition of search engines that won't be set to default is good enough for most use cases.

Additionally, this API would also not be able to override built-in (Mozilla-provided) search engines, since we're already maintaining those.

Blocks: 1643772

Not true! This feature request by no means blocks 1643772.

I set the blocking field as the two are very closely related and should be considered together, even if they end up being implemented separately. We can always change the blocking status later.

I will defer to the search team to decide on the API, however I would otherwise be against an api to add search engines.

It looks like the search team would be potentially ok with the .add() method without changing defaults, but even that has high level for potential abuse (spamming, confusing users, etc). This looks like a valid though not actually crucial use case, and the bar for search is high, so closing this as WONTFIX at least for now.

(In reply to Olivier de Broqueville from comment #4)

Another level of protection is that the extension would have to be Recommended.

We haven't made distinctions on APIs being available only to Recommended extensions in the past, and we'd like to avoid doing that in the future without good reasons.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.