Prevent users from disabling or uninstalling a Firefox addon - firefox

I'm building a Firefox add-on for children where I need to prevent them from disabling/uninstalling it.
I don't want them to be able to either remove or disable the add-on once it's installed.
How can I do this?

You can disable the access to add-on manager after you install the extension and then hide the shortcut in the bar. this works for me
Create a txt (windows) with this:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\Software\Policies\Mozilla\Firefox]
"DisablePrivateBrowsing"=dword:00000000
"DisableFirefoxAccounts"=dword:00000000
"BlockAboutAddons"=dword:00000001
then change the .txt into .reg and execute

This one works for me:
Windows Registry extension
Installing or updating certain software on Windows can register an extension for Firefox or Thunderbird. For example, a Windows Registry entry to install a Firefox extension can be added under one of these keys:
HKEY_CURRENT_USER\Software\Mozilla\Firefox\Extensions\
HKEY_LOCAL_MACHINE\Software\Mozilla\Firefox\Extensions\
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Mozilla\Firefox\Extensions (Only on 64-bit versions of Windows)
The Registry entry name will be the ID name or GUID of the add-on and the value data will be the path to the folder containing the extension (see Adding Extensions using the Windows Registry - MDC for details). When Firefox or Thunderbird next starts, it will notice the entry and install the extension.
source

You need a supplemental program to do the work.
This mozillazine article has information:
In a few cases, an extension may be installed globally into the Mozilla installation directory. Installing a global extension is something an administrator might do so that the add-on can be used by any user on the machine. It is also possible that another software installation may have included a global extension (for example, the Java JRE installer adds a global extension to Firefox, for the Java Console). To manually uninstall a global extension, open the "extensions" directory in your Mozilla application's installation directory and remove the directory that corresponds to the extension you want to uninstall.
And here:
Extensions that are installed this way include the Java Quick Starter extension for Firefox (see above), the Microsoft .NET Framework Assistant the RealPlayer Browser Record Plugin extension, and the Lenovo ThinkVantage Password Manager extension for Firefox. Although you can disable the extension in the Add-ons manager, the Uninstall option may not be functional (it will be "greyed out). In such cases, experienced users can uninstall the extension by removing the associated Registry entry and/or the contents of the folder containing the extension; otherwise, simply disable it.

Related

Installing WebExtension for Firefox from GPO

I would like to install a WebExtension for Firefox for multiple computers.
I have tried adding in regedit a key named with the uuid of my WebExtension and the path to the xpi "...\Mozilla Firefox\browser\extensions{uuid}.xpi". The key is in HKEY_CURRENT_USER\Software\Mozilla\Firefox\Extensions\
I have then restarted Firefox but it does not ask to install the WebExtension or installed it.
Am I missing something ?
Thanks.
To install the extension. It should be present on your physical Drive. If you want to a Web-extension for Firefox for multiple computers. You can try and create a batch file that automatically install extension on one click or you can simply use Dropbox across the computers and Sync Your Profile Folder where Firefox files are present with that extension installed.
The extension file (.xpi file) is present. It is located in "C:...\Mozilla Firefox\browser\". I have already created a .msi file to deploy it on multiple computers. The only thing left is that after restarting Firefox, it does not detect that I have set a key in regedit to install a new extension.

How to install unpacked extension in firefox & chrome?

i have created extension by using crossrider they gave me xpi & crx file which i extracted and want to install manually by copying data to the browser's extension path.
I've read & tried many posts regarding this but they are not helpful because i think some posts are old & not able to find target paths & registry.
like in many posts they say create the following key in the registry here
32-bit Windows: HKEY_LOCAL_MACHINE\Software\Google\Chrome\Extensions
but i couldn't find that on my windows registry & i am using 32bit.
i want something like i copy my extension data to the browser's extension directory & inject some registry value thats all. if it possible then How?
For firefox just add the xpi or unpacked folder to the profile folder. No need for registry so its cross platform.
It can't be automatic as spyware would be all over that. After placing xpi in the extensions folder of the profile, on next startup of Firefox it will prompt saying it found an unauthorized by user add-on, and gives user a chance to enable it, or keep it disabled.
If you want to do it without startup, just launch the file path to the xpi or unpacked folder (if unpacked folder doesnt work, then point it to the install.rdf) in the browser, user will be prompted if they want to install.
There are some registry options though: Install Firefox extension using Windows registry
In Chrome, it's no longer possible to add an extension programmatically on Windows unless the extension is actually published in the Store.
This is for security reasons: previous registry-based (and otherwise) methods were open to malware abuse.
If your extension is published in the store, you can add it semi-automatically via registry. The user will still be asked whether to enable it on the next load.
You can also install extensions silently using Enterprise policy (only if the machine is part of a Windows domain and you have admin rights on the domain policy), on other OSes, or load it unpacked for testing with the --load-extension command line switch (will not persist after Chrome is restarted).
In Chrome go to
chrome://extensions
Enable Developer Mode at the top and click on the button to load an extracted extension.

Is it necessary to pack firefox extension files into an xpi even on development?

I am developing an extension for Mozilla Firefox. Is there any way in which I can develop without packing the files into an xpi for every change I make (like in Chrome)?
Yes. To do this, first close Firefox.
Then create a file in your profiles extensions directory that has the same ID as your extension.
In that file, you should place the fully qualified path to where you are developing your extension. In particular, to the same directory as the install.rdf.
When Firefox is restarted, it should ask you if you want to install the extension. Once you've done that, the extension will run from the local copy. After you make changes, you just need to close and restart the browser.
For more information, check this page out:
https://developer.mozilla.org/en-US/docs/Setting_up_extension_development_environment
I also recommend you install the Developer Assistant - https://addons.mozilla.org/en-US/firefox/addon/extension-developer/ - which will set some prefs that make it easier to create Firefox extensions.

Installing firefox extension for all users [system wide installation]

I have written a Firefox extension which is packed as an .xpi file. I want to install this extension for all users. Somewhere I found that we can achieve this by putting the file in the Mozilla\Extensions folder, then the extension will be available to all users.
But the problem is after installing the extension, on first launch of Firefox
for an administrator, a pop-up tab will appear to ask whether to enable or disable the extension, but
for the non-admin user, no pop-up will be there and the extension will be disabled for them initially.
Is it possible to notify every user by launching a pop-up tab when they start the browser the first time after installation?
Just to provide the old answer, which no longer worked flawlessly:
If you want to do a silent administrative install [...]:
uncompress the .xpi file yourself (as a ZIP file) to an appropriately named (extension's ID) folder. On Linux/Unix platforms you can use a helper script to determine extension IDs in an automated fashion.
Put this directory into the browser/extension folder.
See also this answer about Thunderbird (by me). The same steps worked for Firefox before application signing was enforced. In Firefox 43, the signature checks can be disabled via about:config. The about:config workaround will supposedly stop working in Firefox 44.

Correct way to restore Firefox preferences when Add-On uninstalled by external application

I have written an application suite on Windows which amongst other things installs a Firefox add-on which once run modifies the Firefox network preferences by interfacing with nsIPrefService.
The extension itself resides in a folder under Program Files along with other parts of the application which work together with each other.
Since the application consists of a number of components, the correct way to uninstall it is via the Control Panel or via an uninstall shortcut I provide for the users.
I have no control over whether Firefox will be running or not when the user chooses to uninstall (possibly I could try to detect if it's running in the uninstaller and request the user close it to continue).
Since the purposes of the uninstaller is to remove all traces of the program from the end-users system i.e:
all the files under the Program Files folder, including the extension components
remove the add-on from Firefox (by removing the registry key under HKEY_CURRENT_USER\Software\Mozilla\Firefox\Extensions, causing the add-on to unregister on next Firefox restart)
remove application specific registry keys
Then after uninstall there isn't any of my code left on the users system capable of restoring the network preferences to what they were before the component was installed. This results in end-users not being able to browse the web and being very frustrated!
The only way I can figure out how to do this at the moment is to have my component write to the window's registry the location of the users profile folder - which I can do with my add-on:
Components.classes["#mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties).get("ProfD",
Components.interfaces.nsIFile).path
And then have my uninstaller modify the prefs.js file in that location directly. But this will only work if I can guarantee Firefox isn't running during uninstall (since prefs.js is re-written on FF close)
To me this is not an elegant solution:
It seems not to be future proof since it is dependent on the format and symbols used prefs.js which may change in future FF releases.
Firefox has a nasty habbit of not always closing properlly (sometimes other installed add-ons prevent it from completely unloading from memory. This would break my uninstaller).
This wouldn't work (without elaborate modification) if the user has multiple FF profiles setup all using my add-on.
Is there a better or "standard" way to achieve this simple task?
Did you try to package defaults files (defaults/preferences/myprefs.js) in your extension? I didn't check if it works for overriding Firefox-wide defaults, but it should.
Can't the uninstaller "insist" that Firefox be closed? eg,
check if FireFox is open
if open, inform user "FF must be closed, or cancel uninstall" ok/cancel
loop
I've had several installers do this to me. Not unistallers, though, that I can remember.
Also, this doesn't future-proof the solution, nor deal with profiles.

Resources