Closed Bug 1612013 Opened 1 year ago Closed 1 year ago

[webext] Can't add search provider with http only (without https) even for localhost URL

Categories

(WebExtensions :: General, defect, P5)

72 Branch
defect

Tracking

(firefox72 wontfix, firefox73 wontfix, firefox74 wontfix, firefox79 fixed)

RESOLVED FIXED
mozilla79
Tracking Status
firefox72 --- wontfix
firefox73 --- wontfix
firefox74 --- wontfix
firefox79 --- fixed

People

(Reporter: actionless.loveless, Assigned: myeongjun.ko, Mentored)

References

Details

(Keywords: good-first-bug, testcase)

Attachments

(5 files)

Attached file manifest.json

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0

Steps to reproduce:

  1. Create webextesion with only chrome_settings_overrides:
	"chrome_settings_overrides": {
	  "search_provider": {
		"name": "Search Jackett",
		"search_url": "http://127.0.0.1:9117/UI/Dashboard#search={searchTerms}&tracker=&category=",
		"keyword": "j",
		"favicon_url": "http://127.0.0.1:9117/favicon.ico?"
	  }
	}
  1. Try to load it into Firefox

Actual results:

Can't install the extension:

Extension is invalid

Reading manifest: Error processing chrome_settings_overrides.search_provider.search_url: String "http://127.0.0.1:9117/UI/Dashboard#search={searchTerms}&tracker=&category=" must match /^https:\/\/.*$/

Expected results:

It should be installed successfully, it's more than reasonless to require https for localhost communications (and generally demanding it against the user will).

Summary: [webext] Can't add search provider with http only (without https) → [webext] Can't add search provider with http only (without https) even for localhost URL
Attached file search_jackett.xpi
Has STR: --- → yes
Component: Untriaged → General
Keywords: testcase
Product: Firefox → WebExtensions

Hello,

I have managed to reproduce the issue using the provided STR and attached extension on the latest Nightly (74.0a1/20200131013147), Beta (73.0b11/20200128001646) and Release (72.0.2/20200117190643) under Windows 10 Pro 64-bit and macOS High Sierra 10.15.

Attempting to load the extension in about:debugging will produce the error from Comment 2 and the installation fails.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Mike, do you have any issue with opening http on localhost for search?

Flags: needinfo?(mdeboer)

IMO it's fine to loosen the https restriction for localhost.

Flags: needinfo?(mdeboer)
Keywords: good-first-bug
Priority: -- → P5
commit 69b79b5b524c6592692a84f2c6e503ea1a3670e4
Author: actionless <actionless.loveless@gmail.com>
Date:   Thu Mar 12 21:29:11 2020 +0100

    1612013 extensions: schemas: allow http for localhost

diff --git a/browser/components/extensions/schemas/chrome_settings_overrides.json b/browser/components/extensions/schemas/chrome_settings_overrides.json
index 8aa9b3e5dd..e38fdfa588 100644
--- a/browser/components/extensions/schemas/chrome_settings_overrides.json
+++ b/browser/components/extensions/schemas/chrome_settings_overrides.json
@@ -33,7 +33,7 @@
                   "search_url": {
                     "type": "string",
                     "format": "url",
-                    "pattern": "^https://.*$",
+                    "pattern": "^(https:\/\/|http:\/\/(localhost|127\.0\.0\.1)).*$",
                     "preprocess": "localize"
                   },
                   "favicon_url": {
@@ -45,7 +45,7 @@
                   "suggest_url": {
                     "type": "string",
                     "optional": true,
-                    "pattern": "^https://.*$|^$",
+                    "pattern": "^(https:\/\/|http:\/\/(localhost|127\.0\.0\.1)).*$",
                     "preprocess": "localize"
                   },
                   "instant_url": {
@@ -102,7 +102,7 @@
                     "type": "string",
                     "optional": true,
                     "format": "url",
-                    "pattern": "^https://.*$",
+                    "pattern": "^(https:\/\/|http:\/\/(localhost|127\.0\.0\.1)).*$",
                     "preprocess": "localize"
                   },
                   "alternate_urls": {

If this is your first contribution, please refer to https://wiki.mozilla.org/WebExtensions/Contribution_Onramp on how to get started.

Mentor: :mixedpuppy

Mentor: mixedpuppy

Hey actionless.loveless! Just saw that you added a patch to the comment! \o/ Can you go ahead and make that change on Phabricator? Check the documentation in comment 7 for instructions. :)

Flags: needinfo?(actionless.loveless)

extensions: schemas: allow http for localhost

Assignee: nobody → actionless.loveless
Status: NEW → ASSIGNED

Hey actionless.loveless! Just wanted to check in on this bug since it's been a few weeks and it looks like you're close to finishing this bug off. :) Are you interested in getting this over the finish line?

Flags: needinfo?(actionless.loveless)
Flags: needinfo?(actionless.loveless)

hi :caitmuenste! it would be better if somebody would pick my patch off to bring it to the finish line

Flags: needinfo?(actionless.loveless)

Thanks for the update, actionless.loveless! We'll unassign you from the bug for now; please know that you can come back and finish it off in the future if you would like.

Assignee: actionless.loveless → nobody
Status: ASSIGNED → NEW
Assignee: nobody → myeongjun.ko
Status: NEW → ASSIGNED
Pushed by ncsoregi@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/48dbf3178e91
add search provider with http for localhost URL r=mixedpuppy
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
Regressions: 1651665
You need to log in before you can comment on or make changes to this bug.