Skip to main content
  • Option name: "lock.tamperProtection"
  • Option values: true/false/Function

Requires Non-Strict Mode

The obfuscated code will not work properly in Strict Mode. You can use the Pack option to bypass Strict Mode constraints.

Requires Eval

The obfuscated code will contain unsafe eval expressions. The code will not work properly in environments that have disabled eval.

Input / Output

This example showcases how Tamper Protection transforms the code. Try it out by changing the input code and see changes apply in real-time.
Input.js

Improves Global Concealing

Tamper Protection with Global Concealing can detect at runtime if certain global functions have been monkey-patched. The following code exemplifies this:

Native function check

This monkey-patch can be detected by inspecting the fetch.toString() value:
Certain global functions are checked before each invocation to ensure that (1) the arguments cannot be intercepted and (2) their behavior cannot be altered.

Stealthy global

A direct eval invocation can access the local scope, only if it has not been redefined.
This method securely obtains the real global object for both the browser and NodeJS. Properties on the global object can still be changed however.

Disallows Strict Mode

Tamper Protection requires the script to run in non-strict mode. Detection of the script in Strict Mode will be considered tampering. You can control the tampering response using the lock.countermeasures option.

Custom Implementation

options.lock.tamperProtection(fnName)

Control which functions are changed. Returns a boolean.

Usage Example

The provided code example will obfuscate the file input.js and write the output to a file named output.js.
Usage Example

Enabled In


See Also