jscrambler 8.11.2 → 8.11.3

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,11 @@
1
1
  # jscrambler
2
2
 
3
+ ## 8.11.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [25054ca]: Ensure protected files are not written outside of project root folder in gulp
8
+
3
9
  ## 8.11.2
4
10
 
5
11
  ### Patch Changes
package/dist/constants.js CHANGED
@@ -20,6 +20,7 @@ const CLIENT_IDS = exports.CLIENT_IDS = Object.freeze({
20
20
  WEBPACK: 2,
21
21
  GULP: 3,
22
22
  GRUNT: 4,
23
+ /* @deprecated */
23
24
  EMBER: 5,
24
25
  METRO: 6
25
26
  });
@@ -29,6 +30,7 @@ const CLIENT_PACKAGES = exports.CLIENT_PACKAGES = Object.freeze({
29
30
  [CLIENT_IDS.WEBPACK]: 'jscrambler-webpack-plugin',
30
31
  [CLIENT_IDS.GULP]: 'gulp-jscrambler',
31
32
  [CLIENT_IDS.GRUNT]: 'grunt-jscrambler',
33
+ /* @deprecated */
32
34
  [CLIENT_IDS.EMBER]: 'ember-cli-jscrambler',
33
35
  [CLIENT_IDS.METRO]: 'jscrambler-metro-plugin'
34
36
  });
package/dist/index.js CHANGED
@@ -112,6 +112,7 @@ function buildFinalConfig(configPathOrObject) {
112
112
  var _default = exports.default = {
113
113
  Client: _client.default,
114
114
  config: _config2.default,
115
+ resolveOutputPath: _utils.resolveOutputPath,
115
116
  queries,
116
117
  generateSignedParams: _generateSignedParams.default,
117
118
  /**
package/dist/utils.js CHANGED
@@ -7,6 +7,7 @@ exports.PREPEND_JS_TYPE = exports.APPEND_JS_TYPE = void 0;
7
7
  exports.concatenate = concatenate;
8
8
  exports.getMatchedFiles = getMatchedFiles;
9
9
  exports.isJavascriptFile = isJavascriptFile;
10
+ exports.resolveOutputPath = resolveOutputPath;
10
11
  exports.validateCustomLabels = validateCustomLabels;
11
12
  exports.validateNProtections = validateNProtections;
12
13
  exports.validateThresholdFn = void 0;
@@ -128,4 +129,13 @@ const validateThresholdFn = optionName => val => {
128
129
  }
129
130
  return inBytes;
130
131
  };
131
- exports.validateThresholdFn = validateThresholdFn;
132
+ exports.validateThresholdFn = validateThresholdFn;
133
+ function resolveOutputPath(outputPath, filename) {
134
+ const outputRoot = (0, _path.resolve)(outputPath);
135
+ const finalPath = (0, _path.resolve)(outputRoot, filename);
136
+ const relativePath = (0, _path.relative)(outputRoot, finalPath);
137
+ if (relativePath === '..' || relativePath.indexOf("..".concat(_path.sep)) === 0 || (0, _path.isAbsolute)(relativePath)) {
138
+ throw new Error("Refusing to write file outside output directory: ".concat(filename));
139
+ }
140
+ return finalPath;
141
+ }
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.11.2",
4
+ "version": "8.11.3",
5
5
  "homepage": "https://github.com/jscrambler/jscrambler",
6
6
  "author": "Jscrambler <support@jscrambler.com>",
7
7
  "repository": {
@@ -61,6 +61,7 @@
61
61
  "clean": "rm -rf ./dist",
62
62
  "build": "babel src --out-dir dist",
63
63
  "watch": "babel -w src --out-dir dist",
64
+ "test": "pnpm run build && node test/output-path.js",
64
65
  "prepublish": "npm run build",
65
66
  "eslint": "eslint src/",
66
67
  "eslint:fix": "eslint src/ --fix"