Is using an obfuscator enough to secure my JavaScript code?

后端 未结 9 2215
无人共我
无人共我 2020-12-13 01:04

I\'m working on building a development tool that is written in JavaScript.

This will not be an open source project and will be sold (hopefully) as a commercial produ

相关标签:
9条回答
  • 2020-12-13 01:43

    That's probably about the best you can do. Just be aware that anybody with enough dedication, can probably de-obfuscate your program. Just make sure you're comfortable with that before embarking on your project. I think the biggest problem with this would be to control who's using it on their site. If somebody goes to a site with your code on it, and likes what it does, it doesn't matter that they don't understand what the code does, or can't read it, when they can just copy the code, and use it on their own site.

    0 讨论(0)
  • 2020-12-13 01:48

    You're always faced with the fact that any user that comes to your webpage will download some working version of your Javascript source. They will have the source code. Obfuscating it may make it very difficult to be reused by someone with the intent to steal your hard work. However, in many cases someone can even reuse the obfuscated source! Or in the worst case they can unravel it by hand and eventually comprehend it.

    An example of a situation like yours might be Google Maps. The Javascript source is clearly obfuscated. However, for really private/sensitive logic they push the data to the server and have the server process that information using XMLHttpRequests (AJAX). With this design you have the important parts on the server side, much more tightly controlled.

    0 讨论(0)
  • 2020-12-13 01:49

    code obfuscator is enough for something that needs minimal protection, but I think it will definitely not enough to really protect you. if you are patient you can realy de-mangle the whole thing.. and i'm sure there are programs to do it for you.

    That being said, you can't stop anyone from pirating your stuff because they'll eventually will break any kind of protection you create anyway. and it is espcially easy in scripted language where the code is not compiled.

    If you are using some other language, maybe java or .NET, You can try doing things like "calling home" to verify that a license number matches a given url. Which works if you your app is some sort of online app that is going to be connected online all the time. But having access to the source, people can easily bypass that part.

    In short, javascript is a poor choice for what you are doing.
    A step up from what you are doing is maybe using a webservice backend to get your data. Let the webservice handle the authentication/verification process. Requires a bit of work to make sure it is bulletproof, but it might work

    0 讨论(0)
  • 2020-12-13 01:55

    A obfuscator won't help you at all if someone wants to figure out the code. The code still exists on the client machine and they can grab a copy of it and study it at their leisure.

    There is simply no way to hide code written in Javascript since the source code has to be handed to the browser for execution.

    If you want to hide your code, you have the following options:

    1) Use an environment where compiled code (not source) is downloaded to the client, e.g. Flash or Silverlight. I'm not even sure that's foolproof, but it's certainly much better than Javascript.

    2) Have a back end on the server side that does the work and a thin client that just makes requests to the server.

    0 讨论(0)
  • 2020-12-13 02:01

    If this is for a website, which by its very nature puts viewing of its code one menu click away, is there really any reason to hide anything? If someone wants to steal your code they will most likely go through the effort of making even the most mangled code human readable. Look at commercial websites, they don't obfuscate their code, and no one goes out and steals code from the google apps. If you are really worried about code theft, I would argue for writing it in some other compiled language. (which does of course destroy the whole webapp thing...) Even then, you aren't totally safe, there are many de-compilers out there.

    So really, there is no way to do what you want in the face of anyone with sufficient motivation.

    0 讨论(0)
  • 2020-12-13 02:06

    I deeply disagree with most answers above.

    It's true that every software can be stolen despite of obfuscation but, at least, it makes harder to extract and reuse individual parts of the software and that is the point.

    Maybe it's cheaper and less risky to use an obfuscation than leaving the code open and fighting at court after somebody stole the best parts of our software and made dangerous concurrency.

    Unobfuscated code whispers:

    • Come on, analyze me, reuse me. Maybe you could make a better software using me.

    Obfuscated code says:

    • Go away dude. It's cheaper to use your own ideas than trying to crack me.
    0 讨论(0)
提交回复
热议问题