Nemus
Nemus

Reputation: 1482

Is code obfuscation really useful in javascript?

Recently I have passed to gulp task manager, and I noticed that by default, build task produce .map files. This makes me wonder: is useful to obfuscate code for production deployment? Does it protect my software from being hacked? If yes, should I delete my .map files from there?

Upvotes: 10

Views: 10185

Answers (2)

Carl Rck
Carl Rck

Reputation: 311

Simple obfuscation will not protect your software from being hacked. If you really want to protect your javascript, to add something that will make the life of someone who tries to steal or tamper with your software really difficult, you should check Jscrambler. I have not yet seen any solution that goes even close to the level of protection they enable you to achieve.

As for the source maps question, if you obfuscate yes you should delete them.

Upvotes: 7

beingalex
beingalex

Reputation: 2476

Javascript obfuscation will not protect your software from being hacked. It is quite easy to write software to un-obfuscate it, or simply use an online tool: http://jsbeautifier.org/

The reason you would want to use Gulp to compress your Javascript would be to make the file size smaller and have less requests to the server. Which makes your site load faster.

To answer your question though: Do not delete your .map files. They are used to reference the "uglified/obfuscated" for debugging. See: https://stackoverflow.com/a/21719713/387761

Upvotes: 2

Related Questions