Search code examples
javascriptfirefoxgoogle-chrome-extensionfirefox-addonbrowser-security

How to protect source code of firefox browser extension


We are developing firefox browser extension. We are able to successfully install XPI and access the features that we have developed.

Major of the logic are written in JavaScript and HTML files. So anybody can unzip the XPI file and can see the source code. How to prevent this ? Is mozilla providing any encryption mechanism ?

The same features will be developed for other browsers like Chrome.


Solution

  • You can obfuscate your JavaScript and your XPI will still work. JavaScript obfuscation keeps the functionality of your code but makes it harder to read and reuse (not impossible, though).

    I'll leave you here the two tools that I've already tried:

    Free: uglifyjs (only minification ie. removes unnecessary characters to make it smaller);

    Not-free: jscrambler (seems to be the best pick if you are looking for obfuscation);

    Google: [javascript | html5] [~protect | ~obfuscate] to find more obfuscation tools.