Self Defending

Potency High
Resilience High
Cost High
Tags: rasp, tampering, debugging

Description

Self Defending protects functions and object literals concealing their logic, blocking code tampering attempts with anti-tampering techniques, and detecting debuggers to trigger defenses that thwart reverse engineering attempts. Countermeasures can be specified (optionally) to be executed when someone tries to debug or tamper with the code.

Note: if you intend to minify your code after protecting it with Jscrambler, make sure that the tolerateMinification flag is enabled in your application. This makes it so that the modifications done by this process are not treated as malicious by this and other transformations. We nonetheless recommend that you use Jscrambler after minifying your code, as the last step of your build process, for optimum results. You can learn more about how to configure your application here.

Code Annotation Example

// @jscrambler define selfDefending {threshold: 10480, options: [tolerateBenignPoisoning], countermeasures: {deleteCookies: 1, redirect: /logout}} as sd
// @jscrambler enable sd

Option Types

Name Required Default Value Description
threshold No 10240 Minimum size (in bytes) that a function / object literal must have to be targeted by the transformation.
options No [] List of available options
countermeasures No {"deleteCookies": false,"realTimeNotifications": false} List of available countermeasures

Options

Name Description
tolerateBenignPoisoning Blocks only malicious native function poisoning

Countermeasures

Name Description
customCallback Name of the function to be called as a countermeasure.
deleteCookies Deletes all the cookies accessible via JavaScript.
redirect Redirects the user to a specific URL.
realTimeNotifications Sends a notification when a violation occurs.

API Parameters

Example:

{
  "keys": {
    "accessKey": "XXXXXX",
    "secretKey": "YYYYYY"
  },
  "applicationId": "ZZZZZZ",
  "params": [
    {
      "name": "selfDefending",
      "options": {
        "threshold": 10240,
        "options": [],
        "countermeasures": {
          "customCallback": null,
          "deleteCookies": false,
          "redirect": null,
          "realTimeNotifications": false
        }
      }
    }
  ]
}