jscrambler 8.5.1 → 8.6.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,18 @@
1
1
  # jscrambler
2
2
 
3
+ ## 8.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [bf31071]: bump glob dependency version as 8.1.0 is no longer supported
8
+ - [dadea38]: remove unused dependencies, and bump others, specially due to vulnerabilites
9
+
10
+ ## 8.6.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [051fda1]: Added --save-src flag to control sources storage behavior.
15
+
3
16
  ## 8.5.1
4
17
 
5
18
  ### Patch Changes
@@ -117,7 +117,7 @@ const validateBeforeProtection = function () {
117
117
  });
118
118
  return beforeProtectionArray;
119
119
  };
120
- _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).parse(process.argv);
120
+ _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')).parse(process.argv);
121
121
  let globSrc, filesSrc, config;
122
122
 
123
123
  // If -c, --config file was provided
@@ -197,6 +197,11 @@ if (config.beforeProtection) {
197
197
  if (_commander.default.deleteProtectionOnSuccess) {
198
198
  config.deleteProtectionOnSuccess = _commander.default.deleteProtectionOnSuccess === 'true';
199
199
  }
200
+ if (_commander.default.saveSrc) {
201
+ config.saveSrc = _commander.default.saveSrc !== 'false';
202
+ } else {
203
+ config.saveSrc = config.saveSrc !== false;
204
+ }
200
205
  globSrc = config.filesSrc;
201
206
  // If src paths have been provided
202
207
  if (_commander.default.args.length > 0) {
@@ -278,7 +283,8 @@ const {
278
283
  forceAppEnvironment,
279
284
  beforeProtection,
280
285
  deleteProtectionOnSuccess,
281
- mode
286
+ mode,
287
+ saveSrc
282
288
  } = config;
283
289
  const params = config.params;
284
290
  const incompatibleOptions = ['sourceMaps', 'instrument', 'startProfiling', 'stopProfiling'];
@@ -395,7 +401,8 @@ if (_commander.default.sourceMaps) {
395
401
  forceAppEnvironment,
396
402
  beforeProtection,
397
403
  deleteProtectionOnSuccess,
398
- mode
404
+ mode,
405
+ saveSrc
399
406
  });
400
407
  try {
401
408
  if (typeof werror !== 'undefined') {
package/dist/config.js CHANGED
@@ -17,6 +17,7 @@ const config = (0, _rc.default)('jscrambler', {
17
17
  werror: true,
18
18
  clientId: _constants.CLIENT_IDS.CLI,
19
19
  utc: true,
20
- maxRetries: 5
20
+ maxRetries: 5,
21
+ saveSrc: true
21
22
  }, []);
22
23
  var _default = exports.default = config;
package/dist/index.js CHANGED
@@ -112,8 +112,9 @@ var _default = exports.default = {
112
112
  * sources: Array.<{filename: string, content: string}>,
113
113
  * filesSrc: Array.<string>,
114
114
  * cwd: string,
115
+ * saveSrc: boolean,
115
116
  * appProfiling: ?object,
116
- * runBeforeProtection?: Array<{type: string, target: string, source: string }>
117
+ * runBeforeProtection?: Array<{type: string, target: string, source: string }>
117
118
  * }} opts
118
119
  * @returns {Promise<{extension: string, filename: string, content: *}>}
119
120
  */
@@ -123,6 +124,7 @@ var _default = exports.default = {
123
124
  filesSrc,
124
125
  cwd,
125
126
  appProfiling,
127
+ saveSrc = true,
126
128
  runBeforeProtection = []
127
129
  } = _ref;
128
130
  if (sources || filesSrc && filesSrc.length) {
@@ -179,7 +181,9 @@ var _default = exports.default = {
179
181
  filename: 'application.zip',
180
182
  extension: 'zip'
181
183
  };
182
- errorHandler(await this.addApplicationSource(client, applicationId, source));
184
+ if (saveSrc) {
185
+ errorHandler(await this.addApplicationSource(client, applicationId, source));
186
+ }
183
187
  }
184
188
  return source;
185
189
  },
@@ -269,7 +273,8 @@ var _default = exports.default = {
269
273
  ensureCodeAnnotation,
270
274
  forceAppEnvironment,
271
275
  deleteProtectionOnSuccess,
272
- mode
276
+ mode,
277
+ saveSrc
273
278
  } = finalConfig;
274
279
  const {
275
280
  accessKey,
@@ -331,7 +336,8 @@ var _default = exports.default = {
331
336
  filesSrc,
332
337
  cwd,
333
338
  appProfiling,
334
- runBeforeProtection
339
+ runBeforeProtection,
340
+ saveSrc
335
341
  });
336
342
  } else {
337
343
  console.log('Update source files SKIPPED');
@@ -364,7 +370,7 @@ var _default = exports.default = {
364
370
  updateData[prop] = value;
365
371
  }
366
372
  }
367
- if (updateData.parameters || updateData.applicationTypes || updateData.languageSpecifications || updateData.browsers || typeof updateData.areSubscribersOrdered !== 'undefined') {
373
+ if ((updateData.parameters || updateData.applicationTypes || updateData.languageSpecifications || updateData.browsers || typeof updateData.areSubscribersOrdered !== 'undefined') && saveSrc) {
368
374
  if (debug) {
369
375
  console.log('Updating parameters of protection');
370
376
  }
package/dist/utils.js CHANGED
@@ -8,7 +8,7 @@ exports.concatenate = concatenate;
8
8
  exports.getMatchedFiles = getMatchedFiles;
9
9
  exports.isJavascriptFile = isJavascriptFile;
10
10
  exports.validateNProtections = validateNProtections;
11
- var _glob = _interopRequireDefault(require("glob"));
11
+ var _glob = require("glob");
12
12
  var _fs = _interopRequireDefault(require("fs"));
13
13
  var _path = require("path");
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -18,7 +18,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
18
18
  * @returns {string[]}
19
19
  */
20
20
  function getMatchedFiles(pattern) {
21
- let matchedFiles = _glob.default.sync(pattern, {
21
+ let matchedFiles = _glob.glob.sync(pattern, {
22
22
  dot: true
23
23
  });
24
24
 
@@ -43,7 +43,7 @@ const APPEND_JS_TYPE = exports.APPEND_JS_TYPE = 'append-js';
43
43
  const PREPEND_JS_TYPE = exports.PREPEND_JS_TYPE = 'prepend-js';
44
44
 
45
45
  /**
46
- *
46
+ *
47
47
  * @param {*} firstFile if prepending: script file; if appending: target file.
48
48
  * @param {*} secondFile if prepending: target file; if appending: script file.
49
49
  * @returns first and second files concatenated
@@ -56,7 +56,7 @@ function handleScriptConcatenation(firstFile, secondFile) {
56
56
  }
57
57
 
58
58
  /**
59
- *
59
+ *
60
60
  * @param {*} scriptObject the object with the script content: { target: '/path/to/target/file', source: '/path/to/script/file', type: 'append-js' | 'prepend-js' }. Its used for both appending and prepending.
61
61
  * @param {*} cwd current working directory, passed by argument
62
62
  * @param {*} path file path (file being parsed)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jscrambler",
3
3
  "description": "Jscrambler API client.",
4
- "version": "8.5.1",
4
+ "version": "8.6.1",
5
5
  "homepage": "https://github.com/jscrambler/jscrambler",
6
6
  "author": "Jscrambler <support@jscrambler.com>",
7
7
  "repository": {
@@ -21,23 +21,19 @@
21
21
  "node": ">= 12.17.0"
22
22
  },
23
23
  "dependencies": {
24
- "axios": "^1.4.0",
24
+ "axios": "^1.7.2",
25
25
  "commander": "^2.8.1",
26
- "core-js": "^3.16.4",
27
26
  "filesize-parser": "1.5.0",
28
- "glob": "^8.1.0",
27
+ "glob": "10.4.5",
29
28
  "http-proxy-agent": "7.0.2",
30
29
  "https-proxy-agent": "7.0.4",
31
- "jszip": "^3.7.1",
30
+ "jszip": "^3.8.0",
32
31
  "lodash.clone": "^4.0.3",
33
32
  "lodash.clonedeep": "^4.5.0",
34
33
  "lodash.defaults": "^4.0.1",
35
34
  "lodash.keys": "^4.0.1",
36
35
  "lodash.size": "^4.0.1",
37
- "q": "^1.4.1",
38
- "rc": "^1.1.0",
39
- "snake-case": "^2.1.0",
40
- "temp": "^0.8.3"
36
+ "rc": "^1.1.0"
41
37
  },
42
38
  "devDependencies": {
43
39
  "@babel/cli": "^7.23.4",