jscrambler 8.7.1 → 8.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # jscrambler
2
2
 
3
+ ## 8.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [a5f9ae7]: Document globalNamesPrefix parameter
8
+
9
+ ## 8.8.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [477066b]: Added globalNamesPrefix config option to cli
14
+
3
15
  ## 8.7.1
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -25,6 +25,7 @@ If you're looking to gain control over third-party tags and achieve PCI DSS comp
25
25
  - [Profiling Data Mode (default: **automatic**)](#profiling-data-mode-default-automatic)
26
26
  - [Instrument (`--instrument`)](#instrument---instrument)
27
27
  - [Symbol Table](#symbol-table)
28
+ - [Global Names Prefix](#global-names-prefix)
28
29
  - [API](#api)
29
30
  - [Quick example](#quick-example)
30
31
  - [Jscrambler Parameters](#jscrambler-parameters)
@@ -392,6 +393,28 @@ Similarly, the resulting symbol table can be obtained using the `--output-symbol
392
393
 
393
394
  **NOTE**: It only makes sense to use symbol tables on protections that use the identifiers renaming parameter.
394
395
 
396
+ ## Global Names Prefix
397
+
398
+ If you need to make **separate obfuscation requests** for source code that belong to the same application instance, there is a small chance that you will encounter a **naming collision** on the generate global names.
399
+
400
+ To prevent **global naming collisions**, you can set the `globalNamesPrefix` parameter on each protection request:
401
+
402
+ ```json
403
+ // jscrambler.json to protect micro-frontend 1
404
+ {
405
+ "globalNamesPrefix": "p1"
406
+ }
407
+
408
+ // jscrambler.json to protect micro-frontend 2
409
+ {
410
+ "globalNamesPrefix": "p2"
411
+ }
412
+ ```
413
+
414
+ If apply the previous configuration, all generated global variable names will start with the letters *p1* for *micro-frontend 1* and *p2* for *micro-frontend 2*.
415
+
416
+ ***Note***: The `globalNamesPrefix` parameter must be **short** and **unintelligible** to avoid code size increase and automated attacks
417
+
395
418
  ## API
396
419
  ```bash
397
420
  npm install jscrambler
@@ -149,6 +149,7 @@ config.skipSources = _commander.default.skipSources;
149
149
  config.debugMode = _commander.default.debugMode || config.debugMode;
150
150
  config.instrument = _commander.default.instrument || config.instrument;
151
151
  config.mode = _commander.default.mode || config.mode;
152
+ config.globalNamesPrefix = _commander.default.globalNamesPrefix || config.globalNamesPrefix;
152
153
 
153
154
  // handle codeHardening = 0
154
155
  if (typeof _commander.default.codeHardeningThreshold === 'undefined') {
@@ -283,7 +284,8 @@ const {
283
284
  beforeProtection,
284
285
  deleteProtectionOnSuccess,
285
286
  mode,
286
- saveSrc
287
+ saveSrc,
288
+ globalNamesPrefix
287
289
  } = config;
288
290
  const params = config.params;
289
291
  const incompatibleOptions = ['sourceMaps', 'instrument', 'startProfiling', 'stopProfiling'];
@@ -410,7 +412,8 @@ if (_commander.default.sourceMaps) {
410
412
  beforeProtection,
411
413
  deleteProtectionOnSuccess,
412
414
  mode,
413
- saveSrc
415
+ saveSrc,
416
+ globalNamesPrefix
414
417
  });
415
418
  try {
416
419
  if (typeof werror !== 'undefined') {
package/dist/index.js CHANGED
@@ -273,7 +273,8 @@ var _default = exports.default = {
273
273
  forceAppEnvironment,
274
274
  deleteProtectionOnSuccess,
275
275
  mode,
276
- saveSrc
276
+ saveSrc,
277
+ globalNamesPrefix
277
278
  } = finalConfig;
278
279
  const {
279
280
  accessKey,
@@ -394,7 +395,8 @@ var _default = exports.default = {
394
395
  tolerateMinification,
395
396
  numberOfProtections,
396
397
  forceAppEnvironment,
397
- mode
398
+ mode,
399
+ globalNamesPrefix
398
400
  });
399
401
  if (finalConfig.inputSymbolTable) {
400
402
  const inputSymbolTableContents = await _fs.default.promises.readFile(finalConfig.inputSymbolTable, 'utf-8');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jscrambler",
3
3
  "description": "Jscrambler Code Integrity API client.",
4
- "version": "8.7.1",
4
+ "version": "8.8.1",
5
5
  "homepage": "https://github.com/jscrambler/jscrambler",
6
6
  "author": "Jscrambler <support@jscrambler.com>",
7
7
  "repository": {