jscrambler 8.4.1 → 8.5.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 +12 -0
- package/dist/bin/jscrambler.js +19 -3
- package/dist/client.js +13 -18
- package/dist/index.js +6 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# jscrambler
|
|
2
2
|
|
|
3
|
+
## 8.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [188894f]: Add new Mode option, validations and send it to mutations
|
|
8
|
+
|
|
9
|
+
## 8.4.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [8e2ec8d]: bump http&https-proxy-agent libs
|
|
14
|
+
|
|
3
15
|
## 8.4.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/bin/jscrambler.js
CHANGED
|
@@ -53,6 +53,15 @@ const validateForceAppEnvironment = env => {
|
|
|
53
53
|
}
|
|
54
54
|
return normalizeEnvironment;
|
|
55
55
|
};
|
|
56
|
+
const validateMode = mode => {
|
|
57
|
+
const availableModes = ['automatic', 'manual'];
|
|
58
|
+
const normalizedMode = mode.toLowerCase();
|
|
59
|
+
if (!availableModes.includes(normalizedMode)) {
|
|
60
|
+
console.error("*mode* requires one of the following modes: {".concat(availableModes.toString(), "}. Example: --mode ").concat(availableModes[0]));
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
return normalizedMode;
|
|
64
|
+
};
|
|
56
65
|
const validateBeforeProtection = function () {
|
|
57
66
|
let beforeProtectionArray = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
58
67
|
if (beforeProtectionArray.length === 0) {
|
|
@@ -108,7 +117,7 @@ const validateBeforeProtection = function () {
|
|
|
108
117
|
});
|
|
109
118
|
return beforeProtectionArray;
|
|
110
119
|
};
|
|
111
|
-
_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')).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).parse(process.argv);
|
|
112
121
|
let globSrc, filesSrc, config;
|
|
113
122
|
|
|
114
123
|
// If -c, --config file was provided
|
|
@@ -140,6 +149,7 @@ config.removeProfilingData = _commander.default.removeProfilingData;
|
|
|
140
149
|
config.skipSources = _commander.default.skipSources;
|
|
141
150
|
config.debugMode = _commander.default.debugMode || config.debugMode;
|
|
142
151
|
config.instrument = _commander.default.instrument || config.instrument;
|
|
152
|
+
config.mode = _commander.default.mode || config.mode;
|
|
143
153
|
|
|
144
154
|
// handle codeHardening = 0
|
|
145
155
|
if (typeof _commander.default.codeHardeningThreshold === 'undefined') {
|
|
@@ -267,7 +277,8 @@ const {
|
|
|
267
277
|
ensureCodeAnnotation,
|
|
268
278
|
forceAppEnvironment,
|
|
269
279
|
beforeProtection,
|
|
270
|
-
deleteProtectionOnSuccess
|
|
280
|
+
deleteProtectionOnSuccess,
|
|
281
|
+
mode
|
|
271
282
|
} = config;
|
|
272
283
|
const params = config.params;
|
|
273
284
|
const incompatibleOptions = ['sourceMaps', 'instrument', 'startProfiling', 'stopProfiling'];
|
|
@@ -281,6 +292,10 @@ if (usedIncompatibleOptions.length > 1) {
|
|
|
281
292
|
console.error('Using mutually exclusive options:', usedIncompatibleOptions);
|
|
282
293
|
process.exit(1);
|
|
283
294
|
}
|
|
295
|
+
if ((_commander.default.mode === 'automatic' || config.mode === 'automatic') && config.params) {
|
|
296
|
+
console.error('Cannot submit a Jscrambler configuration file in automatic mode with parameters.');
|
|
297
|
+
process.exit(1);
|
|
298
|
+
}
|
|
284
299
|
const clientSettings = {
|
|
285
300
|
keys: {
|
|
286
301
|
accessKey,
|
|
@@ -379,7 +394,8 @@ if (_commander.default.sourceMaps) {
|
|
|
379
394
|
numberOfProtections,
|
|
380
395
|
forceAppEnvironment,
|
|
381
396
|
beforeProtection,
|
|
382
|
-
deleteProtectionOnSuccess
|
|
397
|
+
deleteProtectionOnSuccess,
|
|
398
|
+
mode
|
|
383
399
|
});
|
|
384
400
|
try {
|
|
385
401
|
if (typeof werror !== 'undefined') {
|
package/dist/client.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.symbol.description.js");
|
|
4
3
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
4
|
require("core-js/modules/es.regexp.exec.js");
|
|
6
5
|
require("core-js/modules/es.string.replace.js");
|
|
@@ -13,18 +12,13 @@ var _zlib = require("zlib");
|
|
|
13
12
|
var _url = _interopRequireDefault(require("url"));
|
|
14
13
|
var _https = _interopRequireDefault(require("https"));
|
|
15
14
|
var _http = _interopRequireDefault(require("http"));
|
|
16
|
-
var _httpsProxyAgent =
|
|
17
|
-
var _httpProxyAgent =
|
|
15
|
+
var _httpsProxyAgent = require("https-proxy-agent");
|
|
16
|
+
var _httpProxyAgent = require("http-proxy-agent");
|
|
18
17
|
var _config = _interopRequireDefault(require("./config"));
|
|
19
18
|
var _generateSignedParams = _interopRequireDefault(require("./generate-signed-params"));
|
|
20
19
|
var _constants = require("./constants");
|
|
21
20
|
var _package = require("../package.json");
|
|
22
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
25
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
27
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
28
22
|
const debug = !!process.env.DEBUG;
|
|
29
23
|
const metrics = !!process.env.METRICS;
|
|
30
24
|
const noCompression = !!process.env.NO_COMPRESSION;
|
|
@@ -183,26 +177,27 @@ JScramblerClient.prototype.request = function (method, path) {
|
|
|
183
177
|
if (!host) {
|
|
184
178
|
throw new Error('Required *proxy.host* not provided');
|
|
185
179
|
}
|
|
186
|
-
let
|
|
180
|
+
let username;
|
|
181
|
+
let password;
|
|
187
182
|
if (auth) {
|
|
188
|
-
|
|
183
|
+
({
|
|
189
184
|
username,
|
|
190
185
|
password
|
|
191
|
-
} = auth;
|
|
186
|
+
} = auth);
|
|
192
187
|
if (!username || !password) {
|
|
193
188
|
throw new Error('Required *proxy.auth* username or/and password not provided');
|
|
194
189
|
}
|
|
195
|
-
formattedAuth = "".concat(username, ":").concat(password);
|
|
196
190
|
}
|
|
197
191
|
settings.proxy = false;
|
|
198
|
-
const proxyConfig =
|
|
192
|
+
const proxyConfig = {
|
|
199
193
|
host,
|
|
200
194
|
port,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
settings.
|
|
195
|
+
username,
|
|
196
|
+
password,
|
|
197
|
+
protocol: "".concat(proxy.protocol || 'http', ":")
|
|
198
|
+
};
|
|
199
|
+
settings.httpsAgent = new _httpsProxyAgent.HttpsProxyAgent(proxyConfig, agentOptions);
|
|
200
|
+
settings.httpAgent = new _httpProxyAgent.HttpProxyAgent(proxyConfig, agentOptions);
|
|
206
201
|
} else if (agentOptions) {
|
|
207
202
|
settings.httpsAgent = new _https.default.Agent(agentOptions);
|
|
208
203
|
settings.httpAgent = new _http.default.Agent(agentOptions);
|
package/dist/index.js
CHANGED
|
@@ -268,7 +268,8 @@ var _default = exports.default = {
|
|
|
268
268
|
numberOfProtections,
|
|
269
269
|
ensureCodeAnnotation,
|
|
270
270
|
forceAppEnvironment,
|
|
271
|
-
deleteProtectionOnSuccess
|
|
271
|
+
deleteProtectionOnSuccess,
|
|
272
|
+
mode
|
|
272
273
|
} = finalConfig;
|
|
273
274
|
const {
|
|
274
275
|
accessKey,
|
|
@@ -354,7 +355,8 @@ var _default = exports.default = {
|
|
|
354
355
|
useAppClassification,
|
|
355
356
|
ensureCodeAnnotation,
|
|
356
357
|
useProfilingData,
|
|
357
|
-
useRecommendedOrder
|
|
358
|
+
useRecommendedOrder,
|
|
359
|
+
mode
|
|
358
360
|
};
|
|
359
361
|
for (const prop in dataToValidate) {
|
|
360
362
|
const value = dataToValidate[prop];
|
|
@@ -386,7 +388,8 @@ var _default = exports.default = {
|
|
|
386
388
|
source,
|
|
387
389
|
tolerateMinification,
|
|
388
390
|
numberOfProtections,
|
|
389
|
-
forceAppEnvironment
|
|
391
|
+
forceAppEnvironment,
|
|
392
|
+
mode
|
|
390
393
|
});
|
|
391
394
|
if (finalConfig.inputSymbolTable) {
|
|
392
395
|
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 API client.",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.5.0",
|
|
5
5
|
"homepage": "https://github.com/jscrambler/jscrambler",
|
|
6
6
|
"author": "Jscrambler <support@jscrambler.com>",
|
|
7
7
|
"repository": {
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"node": ">= 12.17.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@jscrambler/https-proxy-agent": "^5.0.1",
|
|
25
24
|
"axios": "^1.4.0",
|
|
26
25
|
"commander": "^2.8.1",
|
|
27
26
|
"core-js": "^3.16.4",
|
|
28
27
|
"filesize-parser": "1.5.0",
|
|
29
28
|
"glob": "^8.1.0",
|
|
30
|
-
"http-proxy-agent": "
|
|
29
|
+
"http-proxy-agent": "7.0.2",
|
|
30
|
+
"https-proxy-agent": "7.0.4",
|
|
31
31
|
"jszip": "^3.7.1",
|
|
32
32
|
"lodash.clone": "^4.0.3",
|
|
33
33
|
"lodash.clonedeep": "^4.5.0",
|