Global Variable Indirection

Potency Medium
Resilience Medium
Cost Medium
Tags: identifier

Description

Global Variable Indirection will create aliases for every global variable that is referenced in the code. This will make your code harder to track since someone, like an attacker, will find less familiar code.

Code Annotation Example

You can only use Global Variable Indirection with global annotations.

// @jscrambler global enable globalVariableIndirection

Note: For React-Native applications, you can not set Global Variable Indirection via annotations, once we need to exclude the platform-specific global variables (done automatically by the jscrambler-metro-plugin)

Option Types

Name Required Default Value Description
excludeList No [] List of names defined by the user that mustn't be renamed.
namePrefix No N/A Adds a prefix to all global variables.

Browser Compatibility

Browser Compatible Versions Tested Versions Notes
Chrome 80+ 80+
Firefox 90+ 90+
Internet Explorer 9+ 8+
Microsoft Edge 116+ 116+
Safari 13.1+ 13.1+

API Parameters

Example:

{
  "keys": {
    "accessKey": "XXXXXX",
    "secretKey": "YYYYYY"
  },
  "applicationId": "ZZZZZZ",
  "params": [
    {
      "name": "globalVariableIndirection",
      "options": {
        "excludeList": [],
        "namePrefix": "VALUE"
      }
    }
  ]
}