Search code examples
javascriptnode.jsjsongoogle-chrome-extensionfirefox-addon-webextensions

Is it possible to make my browser extension unreplaceable?


I'm planning to make a browser extension and monetize it by a subscription necessary to use the browser extension, my problem is that my browser extension idea fundamentally relies on working off the cloud, and that means that if someone could understand and modify my source code they could get the functional it without paying the subscription, so is it possible to avoid that? Make my browser extension source code unreadable? I know that I could license it, but that wouldn't stop bad actors.

I've come across a question here about "are all browser extension open source?" and What concluded is yes, but when I tried to examine and modify the source code of some famous browser extension it was gibberish, unreadable and in some files it was just one long long line of code.

I'm sorry if this is a stupid question or if this isn't the right place, I'm still a beginner.


Solution

  • By "web extension" do you mean "browser extenstion"?

    If so, since browser extensions tend to be written using JavaScript, there's no way to have all the code in the extension and simultaneously protect it. Even using web assembly would not prevent it from being reverse engineered as it could be "decompiled".

    The only real way would be to have a backend service (therefore not "off the cloud") that performs some functionality that the extension cannot run without. Since the code to the backend is not exposed this is the only way to really protect it.

    Side note on "Open source"

    Your conclusion to result of the question "are all web extensions open source" is a little off too.

    The definition of Open Source from Wikipedia states

    Open source is source code that is made freely available for possible modification and redistribution.

    which isn't necessarily the same as being able to see the source code. It is common to minify and obfuscate the resulting JavaScript to make it difficult (not impossible) to reverse engineer and reduce the size of the extension but this isn't the source code, no one would ever really write code like that.

    Even if the code you do see inside an extension is exactly as the developer wrote it, and could therefore be considered the source code, this doesn't mean that it's freely distributable as Copyright laws and licensing must also be taken in to consideration, however these are difficult and usually very expensive to enforce.