Closed Bug 1575162 Opened 5 years ago Closed 5 years ago

Attempting to connect to a native host that does not allow messages from content scripts

Categories

(WebExtensions :: General, defect)

68 Branch
defect
Not set
normal

Tracking

(firefox-esr68 wontfix, firefox71 wontfix, firefox72 verified, firefox73 verified, firefox74 verified)

VERIFIED FIXED
mozilla72
Tracking Status
firefox-esr68 --- wontfix
firefox71 --- wontfix
firefox72 --- verified
firefox73 --- verified
firefox74 --- verified

People

(Reporter: eynand, Assigned: robwu)

References

(Regression)

Details

(Keywords: regression)

Attachments

(6 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36

Steps to reproduce:

install a previously (before 68.0) working plugin that uses the managed storage.

Actual results:

Getting an error.
I trucked the error to - _tryPath resource://gre/modules/NativeManifests.jsm:109
The error is - “Attempting to connect to a native host that does not allow messages from content scripts…”

Expected results:

Before 68.0 the extension can access the manged storage.

Could you please provide exact steps in order to reproduce this bug?
Thanks.

Flags: needinfo?(eynand)
Flags: needinfo?(eynand)

exact steps to reproduce are:

  1. create a file with content:
    "{
    "name": "active_eue_enteprise@bmc.com",
    "description": "ignored",
    "type": "storage",
    "data": {
    "BeaconReceiverHost": "my_demo_host",
    "BeaconReceiverPort": 8444,
    "Version" : 11.3
    }
    }"
  2. name the file "active_eue_enteprise@bmc.com.json".
  3. create a new registry key "Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\ManagedStorage\active_eue_enteprise@bmc.com"
  4. in the (Default) String key put the full path to the file created in step 1.
  5. load the attached extension to Firefox.
  6. go to any web page
  7. the error will be visible in the Browser Console.
Product: Firefox → WebExtensions

Agi, the particular error message is one you added, do you know what would cause this issue?

https://searchfox.org/mozilla-central/rev/e7c61f4a68b974d5fecd216dc7407b631a24eb8f/toolkit/components/extensions/NativeManifests.jsm#147

Flags: needinfo?(taoyagi)

Shane, I guess you wrongly added me in needinfo.

Flags: needinfo?(taoyagi)

autocomplete got the wrong email.

Agi see comment 4.

Flags: needinfo?(agi)

Can't reproduce on latest nightly, from the debugger I can see that the manifest is read correctly from the content script.

Flags: needinfo?(agi)

What platform/steps did try to reproduce with, because I get the error on Windows 10, both beta and latest Nightly?

This definitely looks like a wrong place for that check, as NativeManifests are used both for native messaging, managed storage and pkcs11 modules.

Flags: needinfo?(agi)
Status: UNCONFIRMED → NEW
Component: Untriaged → General
Ever confirmed: true
Keywords: regression
Priority: -- → P1
Regressed by: 1518843

I messed up in editing the manifest registry key, I can't actually reproduce either.

Eynan, can you please test again, preferably with a new profile, and give more details about version of firefox or anything else that might be different with your setup ?

Status: NEW → UNCONFIRMED
Ever confirmed: false
Flags: needinfo?(agi) → needinfo?(eynand)
Keywords: regression
Priority: P1 → --
No longer regressed by: 1518843

This is definitely a regression by bug 1518843 , based on code inspection.

I've also managed to reproduce, and will attach a test case in the next comment.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Regressed by: 1518843
Attached file repro@1575162.zip

The attached zip file has the test extension, and a directory "managed-storage" containing the manifest for the managed storage.

STR:

  1. Extract managed-storage/repro@bug1575162.json from the zip file, and put it in the system-specific location, see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_manifests#Manifest_location
  2. Start Firefox and load the extension.
  3. Visit example.com and open the console.
  4. Open the global JS console (Ctrl-Shift-J / Cmd-Shift-J).

Expected:

  • At step 3: The content of the managed storage should be printed.
  • At step 4: There should not be any error.

Actual:

  • At step 3: Error: "Managed storage manifest not found"
  • At step 4: Attempting to connect to a native host that does not allow messages from content scripts /usr/lib/mozilla/managed-storage/repro@bug1575162.json.

Tested with Firefox 70.0.1 on Linux.

Flags: needinfo?(eynand)
Assignee: nobody → rob
Status: NEW → ASSIGNED
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/56c05f14df39 Allow storage.managed from content scripts r=zombie
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
Flags: in-testsuite+
Attached image errors.PNG

Currently not able to check on Ubuntu -I do not have permission to create or copy folder and files at this moment in the /usr/lib/mozilla/ location.

On Windows 10 with 64-bit I have made use of the MDN Native manifests article.
After having navigated in the registry to HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla I created a Managed Storage Key which contained the repro@bug1575162 Key. The value Name of the last Key has remained default with the Value Data being the path to the managed-storage unzipped folder.
Using the other files in the repro@1575162 folder (the manifest, the background script and the content script files) I created and xpi file which was then loaded into Nightly about:debugging.
After performing steps 2 and 3 from comment 11 the expected results were not obtained. Attached is the screenshot with the console and browser console errors.
On the positive side, I have no longer received the "Managed storage manifest not found" error.
Could it be that the "win error 5" has been received due to some administrative permissions issue?
What about the rest? Is it possible that the registry setup was not performed correctly?

Flags: needinfo?(rob)

(In reply to Miruna Curtean from comment #15)

Currently not able to check on Ubuntu -I do not have permission to create or copy folder and files at this moment in the /usr/lib/mozilla/ location.

You can also try to reproduce by registering the manifest in a user-specific location (opposed to a system one):

~/.mozilla/managed-storage/repro@bug1575162.json

Could it be that the "win error 5" has been received due to some administrative permissions issue?

"Win error 5" is "ERROR_ACCESS_DENIED". This could happen if the directory or file is not readable, for example if you created the file with admin privileges without granting read access to other users.

Flags: needinfo?(rob)
Attached image Console error logs

Currently on Windows Pro 10 64-bit on FF 72.0b6 (201912122108430) I've modified registries and added the Manage Storage>repro@1575162 Keys with and modified their Default key value to point towards the extracted zip extension folder of repro@1575162. This was done in turns for both Local_Machine and Current_User sections.
However that did not change the results and then I tried created the keys under the registry created for a mozilla firefox version and that did not work out either.
At this point, after deleting some Mozilla Firefox versions registries I am, in fact, getting the Error: "Managed storage manifest not found" console error and can't seem to manage to change that result with any maneuvering of the key paths.
Another colleague verified the test case from comment 11 on a Windows 10 PC but the results were similar to what I'd obtained in comment 15.

When posing the test scenario it was noted that it was verified on Firefox 70.0.1 on Linux. Could you also check on Windows on FF 72?

Flags: needinfo?(rob)

Re-tested on Windows on 72.0.2 (20200117190643), 73.0b10 (20200125104833) and 74.0a1 20200128092639 successfully.
Not receiving the previous browser console errors.
The content of the managed storage is printed as expected.
Marking this as Verified fixed.

Flags: needinfo?(rob)
Status: RESOLVED → VERIFIED
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: