jscrambler 8.5.1 → 8.6.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 +6 -0
- package/dist/bin/jscrambler.js +10 -3
- package/dist/config.js +2 -1
- package/dist/index.js +11 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/bin/jscrambler.js
CHANGED
|
@@ -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
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
|
-
*
|
|
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
|
-
|
|
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/package.json
CHANGED