jscrambler 8.9.3 → 8.10.0

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.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [dd01e7b]: Added generate alias config option
8
+
9
+ ## 8.9.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [5deff47]: Fixed jscrambler cli single protection
14
+
3
15
  ## 8.9.3
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -145,6 +145,7 @@ Options:
145
145
  --save-src <bool> Protection should save application sources (default: true)
146
146
  --protection-report <string> (version 8.4 and above) Protection id for the metadata report
147
147
  --use-global-names-on-modules <bool> (version 8.5 and above) Force the usage of more complex names on modules (default: false)
148
+ --generate-alias <bool> Generate alias for the transformations (default: true)
148
149
  -h, --help output usage information
149
150
  ```
150
151
 
@@ -106,7 +106,7 @@ const validateBeforeProtection = function () {
106
106
  });
107
107
  return beforeProtectionArray;
108
108
  };
109
- _commander.default.version(require('../../package.json').version).usage('[options] <file ...>').option('-a, --access-key <accessKey>', 'Access key').option('-c, --config <config>', 'Jscrambler configuration options').option('-H, --host <host>', 'Hostname').option('-i, --application-id <id>', 'Application ID').option('-o, --output-dir <dir>', 'Output directory').option('-p, --port <port>', 'Port').option('--base-path <path>', 'Base Path').option('--protocol <protocol>', 'Protocol (http or https)').option('--cafile <path>', 'Internal certificate authority').option('-C, --cwd <dir>', 'Current Working Directory').option('-s, --secret-key <secretKey>', 'Secret key').option('-m, --source-maps <id>', 'Download source maps').option('-R, --randomization-seed <seed>', 'Set randomization seed').option('--instrument', 'Instrument file(s) before start profiling. ATTENTION: previous profiling information will be deleted').option('--start-profiling', 'Starts profiling (assumes an already instrumented application)').option('--stop-profiling', 'Stops profiling').option('--code-hardening-threshold <threshold>', 'Set code hardening file size threshold. Format: {value}{unit="b,kb,mb"}. Example: 200kb', validateCodeHardeningThreshold).option('--recommended-order <bool>', 'Use recommended order', validateBool('recommended-order')).option('-W, --werror <bool>', 'Set werror flag value (default: true)', validateBool('werror')).option('--utc <bool>', 'Set UTC as the request time zone. Otherwise it uses the local time zone (default: true)', validateBool('utc')).option('--tolerate-minification <bool>', "Don't detect minification as malicious tampering (default: true)", validateBool('tolerate-minification')).option('--use-profiling-data <bool>', "(version 6.2 only) Protection should use the existing profiling data (default: true)", validateBool('use-profiling-data')).option('--profiling-data-mode <mode>', "(version 6.3 and above) Select profiling mode (default: automatic)", validateProfilingDataMode).option('--remove-profiling-data', "Removes the current application profiling information").option('--use-app-classification <bool>', '(version 6.3 and above) Protection should use Application Classification metadata when protecting (default: true)', validateBool('--use-app-classification')).option('--input-symbol-table <file>', '(version 6.3 and above) Protection should use symbol table when protecting. (default: no file)').option('--output-symbol-table <id>', '(version 6.3 and above) Download output symbol table (json)').option('--jscramblerVersion <version>', 'Use a specific Jscrambler version').option('--debugMode', 'Protect in debug mode').option('--skip-sources', 'Prevent source files from being updated').option('--force-app-environment <environment>', "(version 7.1 and above) Override application's environment detected automatically. Possible values: ".concat(availableEnvironments.toString()), validateForceAppEnvironment).option('--ensure-code-annotation <bool>', "(version 7.3 and above) Fail protection if no annotations are found on the source code (default: false)", validateBool('ensure-code-annotation')).option('-n <number>', "(version 7.2 and above) Create multiple protections at once.").option('--delete-protection-on-success <bool>', 'Deletes the protection files after they have been protected and downloaded (default: false)', validateBool('--delete-protection-on-success')).option('--mode <mode>', "(version 8.4 and above) Define protection mode. Possible values: automatic, manual (default: manual)", validateMode).option('--save-src <bool>', 'Protection should save application sources (default: true)', validateBool('--save-src')).option('--protection-report <string>', '(version 8.4 and above) Protection id for the metadata report').option('--use-global-names-on-modules <bool>', '(version 8.5 and above) Force the usage of more complex names on modules').option('--balance', '(version 8.4 and above) Gets the balance of the user').parse(process.argv);
109
+ _commander.default.version(require('../../package.json').version).usage('[options] <file ...>').option('-a, --access-key <accessKey>', 'Access key').option('-c, --config <config>', 'Jscrambler configuration options').option('-H, --host <host>', 'Hostname').option('-i, --application-id <id>', 'Application ID').option('-o, --output-dir <dir>', 'Output directory').option('-p, --port <port>', 'Port').option('--base-path <path>', 'Base Path').option('--protocol <protocol>', 'Protocol (http or https)').option('--cafile <path>', 'Internal certificate authority').option('-C, --cwd <dir>', 'Current Working Directory').option('-s, --secret-key <secretKey>', 'Secret key').option('-m, --source-maps <id>', 'Download source maps').option('-R, --randomization-seed <seed>', 'Set randomization seed').option('--instrument', 'Instrument file(s) before start profiling. ATTENTION: previous profiling information will be deleted').option('--start-profiling', 'Starts profiling (assumes an already instrumented application)').option('--stop-profiling', 'Stops profiling').option('--code-hardening-threshold <threshold>', 'Set code hardening file size threshold. Format: {value}{unit="b,kb,mb"}. Example: 200kb', validateCodeHardeningThreshold).option('--recommended-order <bool>', 'Use recommended order', validateBool('recommended-order')).option('-W, --werror <bool>', 'Set werror flag value (default: true)', validateBool('werror')).option('--utc <bool>', 'Set UTC as the request time zone. Otherwise it uses the local time zone (default: true)', validateBool('utc')).option('--tolerate-minification <bool>', "Don't detect minification as malicious tampering (default: true)", validateBool('tolerate-minification')).option('--use-profiling-data <bool>', "(version 6.2 only) Protection should use the existing profiling data (default: true)", validateBool('use-profiling-data')).option('--profiling-data-mode <mode>', "(version 6.3 and above) Select profiling mode (default: automatic)", validateProfilingDataMode).option('--remove-profiling-data', "Removes the current application profiling information").option('--use-app-classification <bool>', '(version 6.3 and above) Protection should use Application Classification metadata when protecting (default: true)', validateBool('--use-app-classification')).option('--input-symbol-table <file>', '(version 6.3 and above) Protection should use symbol table when protecting. (default: no file)').option('--output-symbol-table <id>', '(version 6.3 and above) Download output symbol table (json)').option('--jscramblerVersion <version>', 'Use a specific Jscrambler version').option('--debugMode', 'Protect in debug mode').option('--skip-sources', 'Prevent source files from being updated').option('--force-app-environment <environment>', "(version 7.1 and above) Override application's environment detected automatically. Possible values: ".concat(availableEnvironments.toString()), validateForceAppEnvironment).option('--ensure-code-annotation <bool>', "(version 7.3 and above) Fail protection if no annotations are found on the source code (default: false)", validateBool('ensure-code-annotation')).option('-n <number>', "(version 7.2 and above) Create multiple protections at once.").option('--delete-protection-on-success <bool>', 'Deletes the protection files after they have been protected and downloaded (default: false)', validateBool('--delete-protection-on-success')).option('--mode <mode>', "(version 8.4 and above) Define protection mode. Possible values: automatic, manual (default: manual)", validateMode).option('--save-src <bool>', 'Protection should save application sources (default: true)', validateBool('--save-src')).option('--protection-report <string>', '(version 8.4 and above) Protection id for the metadata report').option('--use-global-names-on-modules <bool>', '(version 8.5 and above) Force the usage of more complex names on modules').option('--balance', '(version 8.4 and above) Gets the balance of the user').option('--generate-alias <bool>', 'Generate alias for the transformations (default: true)', validateBool('--generate-alias')).parse(process.argv);
110
110
  let globSrc, filesSrc, config;
111
111
 
112
112
  // If -c, --config file was provided
@@ -193,6 +193,11 @@ if (_commander.default.saveSrc) {
193
193
  } else {
194
194
  config.saveSrc = config.saveSrc !== false;
195
195
  }
196
+ if (_commander.default.generateAlias) {
197
+ config.generateAlias = _commander.default.generateAlias !== 'false';
198
+ } else {
199
+ config.generateAlias = config.generateAlias !== false;
200
+ }
196
201
  globSrc = config.filesSrc;
197
202
  // If src paths have been provided
198
203
  if (_commander.default.args.length > 0) {
@@ -277,7 +282,8 @@ const {
277
282
  mode,
278
283
  saveSrc,
279
284
  globalNamesPrefix,
280
- useGlobalNamesOnModules
285
+ useGlobalNamesOnModules,
286
+ generateAlias
281
287
  } = config;
282
288
  const params = config.params;
283
289
  const incompatibleOptions = ['sourceMaps', 'instrument', 'startProfiling', 'stopProfiling'];
@@ -420,7 +426,8 @@ if (_commander.default.balance) {
420
426
  mode,
421
427
  saveSrc,
422
428
  globalNamesPrefix,
423
- useGlobalNamesOnModules
429
+ useGlobalNamesOnModules,
430
+ generateAlias
424
431
  });
425
432
  try {
426
433
  if (typeof werror !== 'undefined') {
package/dist/config.js CHANGED
@@ -18,6 +18,7 @@ const config = (0, _rc.default)('jscrambler', {
18
18
  clientId: _constants.CLIENT_IDS.CLI,
19
19
  utc: true,
20
20
  maxRetries: 5,
21
- saveSrc: true
21
+ saveSrc: true,
22
+ generateAlias: true
22
23
  }, []);
23
24
  var _default = exports.default = config;
package/dist/index.js CHANGED
@@ -285,7 +285,8 @@ var _default = exports.default = {
285
285
  mode,
286
286
  saveSrc,
287
287
  globalNamesPrefix,
288
- useGlobalNamesOnModules
288
+ useGlobalNamesOnModules,
289
+ generateAlias
289
290
  } = finalConfig;
290
291
  const {
291
292
  accessKey,
@@ -376,7 +377,8 @@ var _default = exports.default = {
376
377
  ensureCodeAnnotation,
377
378
  useProfilingData,
378
379
  useRecommendedOrder,
379
- mode
380
+ mode,
381
+ generateAlias
380
382
  };
381
383
  for (const prop in dataToValidate) {
382
384
  const value = dataToValidate[prop];
@@ -411,7 +413,8 @@ var _default = exports.default = {
411
413
  forceAppEnvironment,
412
414
  mode,
413
415
  globalNamesPrefix,
414
- useGlobalNamesOnModules
416
+ useGlobalNamesOnModules,
417
+ generateAlias
415
418
  });
416
419
  if (finalConfig.inputSymbolTable) {
417
420
  const inputSymbolTableContents = await _fs.default.promises.readFile(finalConfig.inputSymbolTable, 'utf-8');
@@ -493,7 +496,7 @@ var _default = exports.default = {
493
496
  }
494
497
  }
495
498
  if (!protectionOptions.numberOfProtections || protectionOptions.numberOfProtections === 1) {
496
- this.handleApplicationProtectionDownload(client, protection._id, downloadOptions);
499
+ await this.handleApplicationProtectionDownload(client, protection._id, applicationId, downloadOptions);
497
500
  }
498
501
  return protection._id;
499
502
  };
@@ -514,10 +517,12 @@ var _default = exports.default = {
514
517
  /**
515
518
  * Handle the download, unzipping, and possible deletion of protections
516
519
  * @param {object} client
517
- * @param {string} instrumentationId
520
+ * @param {string} protectionId
521
+ * @param {string} applicationId
522
+ * @param {object} downloadOptions
518
523
  * @returns {Promise<object>}
519
524
  */
520
- async handleApplicationProtectionDownload(client, protectionId, downloadOptions) {
525
+ async handleApplicationProtectionDownload(client, protectionId, applicationId, downloadOptions) {
521
526
  const {
522
527
  filesDest,
523
528
  destCallback,
@@ -912,7 +917,7 @@ var _default = exports.default = {
912
917
  } = _ref5;
913
918
  seen[_id] = true;
914
919
  console.log("[".concat(Object.keys(seen).length, "/").concat(protectionIds.length, "] Protection=").concat(_id, ", state=").concat(state, ", build-time=").concat(Math.round((new Date(finishedAt) - new Date(startedAt)) / 1000), "s"));
915
- await this.handleApplicationProtectionDownload(client, _id, downloadOptions);
920
+ await this.handleApplicationProtectionDownload(client, _id, applicationId, downloadOptions);
916
921
  console.log("Downloaded: ".concat(_id));
917
922
  });
918
923
  if (ended.length < protectionIds.length) {
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.9.3",
4
+ "version": "8.10.0",
5
5
  "homepage": "https://github.com/jscrambler/jscrambler",
6
6
  "author": "Jscrambler <support@jscrambler.com>",
7
7
  "repository": {