Code hardening protects the application from reverse engineering and automated/manual deobfuscation by making transformations more resilient and consecutively strengthening the application integrity.
In order to reduce the impact in the file size growth, code hardening is only implicitly included in files that match the following criteria:
Situations may arise where the user wants code hardening to target files with different file size (by default
>= 5KB), in order to do that, users can set the
--code-hardening-threshold flag through the Jscrambler CLI.
jscrambler -c jscrambler.json --code-hardening-threshold=2kb
--code-hardening-threshold=0, which will have the desired effect.
jscrambler -c jscrambler.json --code-hardening-threshold=0
--code-hardening-threshold even vendor files will be targeted as long as their file size is greater or equal than the set threshold.
For instance, if you want to enforce code hardening, add the following code annotation to the beginning of the file:
// @jscrambler global enable codeHardening
In the other hand, if you want to disable it, use this code annotation:
// @jscrambler global disable codeHardening
Default rules are always ignored when using code annotations.