jso-protector 0.4.15 → 0.4.16

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.16 - 2026-12-04
4
+
5
+ - Show VM protection confirmation and virtualized function counts in CLI summaries and JSON output, including named-set builds.
6
+ - Describe missing report evidence as unconfirmed and suggest rerunning to refresh older reports. Count skipped-function warnings without printing their contents.
7
+ - Keep `--stdout` output limited to protected code.
8
+ - Run webpack protection after minimization and source-map generation so minifiers preserve the protected output.
9
+
3
10
  ## 0.4.15 - 2026-09-24
4
11
 
5
12
  **`--preset standard` works on the Basic and Corporate plans.** It was refused
@@ -13,6 +13,7 @@ const packageJson = require("../package.json");
13
13
  const watermark = require("../watermark.js");
14
14
  const releaseSigner = require("../release-signer.js");
15
15
  const pciCompliance = require("../compliance/pci-dss-v4/index.js");
16
+ const { summarizeVmProtection, formatVmProtection } = require("../vm-status.js");
16
17
 
17
18
  const DEFAULT_CONFIG_FILE = "jso.config.json";
18
19
  const DEFAULT_CONFIG_FILES = ["jso.config.json", "jso.config.cjs", "jso.config.mjs", "jso.config.js"];
@@ -3662,6 +3663,7 @@ async function protectGroupedFiles(config, files) {
3662
3663
  set: group.setName,
3663
3664
  files: group.files.map((file) => file.relative),
3664
3665
  preset: groupConfig.preset,
3666
+ vmRequested: boolishTrue(groupConfig.options.UseVMProtection),
3665
3667
  options: Object.keys(groupConfig.options).filter((key) => key !== "reservedNames").sort()
3666
3668
  });
3667
3669
  }
@@ -12298,6 +12300,7 @@ async function main(argv = process.argv.slice(2)) {
12298
12300
 
12299
12301
  const protectedEntry = await protectCodeDetailed(config, code, fileName);
12300
12302
  const protectedCode = protectedEntry.code;
12303
+ const vmStatus = summarizeVmProtection(protectedEntry.result, config.options);
12301
12304
  const manifestPath = config.manifest || null;
12302
12305
  if (args.stdout) {
12303
12306
  process.stdout.write(protectedCode);
@@ -12305,8 +12308,11 @@ async function main(argv = process.argv.slice(2)) {
12305
12308
  const target = path.join(config.output, fileName);
12306
12309
  fs.mkdirSync(path.dirname(target), { recursive: true });
12307
12310
  fs.writeFileSync(target, protectedCode, "utf8");
12308
- if (args.json) process.stdout.write(`${JSON.stringify({ ...summary, type: "Succeed", written: [target], manifest: manifestPath, processing: protectedEntry.processing }, null, 2)}\n`);
12309
- else process.stdout.write(`Protected stdin into ${target}\n`);
12311
+ if (args.json) process.stdout.write(`${JSON.stringify({ ...summary, type: "Succeed", written: [target], manifest: manifestPath, processing: protectedEntry.processing, ...(vmStatus ? { vmProtection: vmStatus } : {}) }, null, 2)}\n`);
12312
+ else {
12313
+ process.stdout.write(`Protected stdin into ${target}\n`);
12314
+ if (vmStatus) process.stdout.write(formatVmProtection(vmStatus) + "\n");
12315
+ }
12310
12316
  }
12311
12317
  const manifest = buildStdinManifest(config, fileName, code, protectedCode, args.stdout ? "stdout" : path.join(config.output, fileName), protectedEntry.processing);
12312
12318
  assertSizeBudgets(manifest, config);
@@ -12483,9 +12489,13 @@ async function main(argv = process.argv.slice(2)) {
12483
12489
  done.buildIds = result.Reports.map((report) => report.BuildId || null);
12484
12490
  }
12485
12491
  }
12492
+ const vmStatus = summarizeVmProtection(result, config.options,
12493
+ overrideGroups ? overrideGroups.filter(group => group.vmRequested).length : undefined);
12494
+ if (vmStatus) done.vmProtection = vmStatus;
12486
12495
  if (args.json) process.stdout.write(`${JSON.stringify(done, null, 2)}\n`);
12487
12496
  else if (overrideGroups) process.stdout.write(`Protected ${files.length} file(s) in ${overrideGroups.length} named-set group(s) and copied ${assets.length} asset(s) into ${config.output}\n`);
12488
12497
  else process.stdout.write(`Protected ${files.length} file(s) and copied ${assets.length} asset(s) into ${config.output}\n`);
12498
+ if (!args.json && vmStatus) process.stdout.write(formatVmProtection(vmStatus) + "\n");
12489
12499
  }
12490
12500
 
12491
12501
  // --scan-watermarks helpers. Walks a directory tree, looks for .js
@@ -1,83 +1,83 @@
1
- #!/usr/bin/env node
2
-
3
- "use strict";
4
-
5
- const childProcess = require("node:child_process");
6
- const fs = require("node:fs");
7
- const os = require("node:os");
8
- const path = require("node:path");
9
-
10
- const root = path.resolve(__dirname, "..");
11
- const examplesRoot = path.join(root, "examples");
12
- const packageJson = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
13
- const expectedVersion = packageJson.version;
14
-
15
- function fail(message) {
16
- process.stderr.write(`verify-examples: FAIL: ${message}\n`);
17
- process.exit(1);
18
- }
19
-
20
- function walk(folder) {
21
- return fs.readdirSync(folder, { withFileTypes: true }).flatMap((entry) => {
22
- const full = path.join(folder, entry.name);
23
- return entry.isDirectory() ? walk(full) : [full];
24
- });
25
- }
26
-
27
- function runNode(args, options = {}) {
28
- const result = childProcess.spawnSync(process.execPath, args, { encoding: "utf8", ...options });
29
- if (result.status !== 0) fail(`${args.join(" ")} failed: ${(result.stderr || result.stdout || result.error || "unknown error").toString().trim()}`);
30
- return result;
31
- }
32
-
33
- const files = walk(examplesRoot);
34
- const scripts = files.filter((file) => /\.(?:js|cjs)$/.test(file));
35
- const jsonFiles = files.filter((file) => path.extname(file) === ".json");
36
-
37
- for (const file of scripts) runNode(["--check", file]);
38
- for (const file of jsonFiles) {
39
- try { JSON.parse(fs.readFileSync(file, "utf8")); }
40
- catch (error) { fail(`${path.relative(root, file)} is invalid JSON: ${error.message}`); }
41
- }
42
-
43
- const readme = fs.readFileSync(path.join(examplesRoot, "README.md"), "utf8");
44
- // The package is published as `javascriptobfuscator-com` since 2026-08-30;
45
- // `jso-protector` is the deprecated former name. Assert the CANONICAL name so
46
- // this gate cannot go on enforcing a name we no longer tell customers to install.
47
- if (!readme.includes(`npm install --save-dev javascriptobfuscator-com@${expectedVersion}`)) fail("examples README does not install the current public version under the canonical package name");
48
- if (readme.includes("intentionally not published to npm")) fail("examples README still says the public package is unpublished");
49
-
50
- const reactNativeReadme = fs.readFileSync(path.join(examplesRoot, "react-native", "README.md"), "utf8");
51
- for (const stale of ["jso-protector/metro.js", "npx jso ai compat-scan"]) {
52
- if (reactNativeReadme.includes(stale)) fail(`React Native guide contains stale command ${JSON.stringify(stale)}`);
53
- }
54
-
55
- const exportKeys = new Set(Object.keys(packageJson.exports));
56
- for (const file of files.filter((candidate) => /\.(?:js|cjs|md)$/.test(candidate))) {
57
- const source = fs.readFileSync(file, "utf8");
58
- for (const match of source.matchAll(/(?:require\(|from\s+)["']jso-protector(\/[a-z0-9-]+)?["']/gi)) {
59
- const key = match[1] ? `.${match[1]}` : ".";
60
- if (!exportKeys.has(key)) fail(`${path.relative(root, file)} references undeclared package export ${key}`);
61
- }
62
- }
63
-
64
- const configPath = path.join(examplesRoot, "cli-basic", "jso.config.json");
65
- if (!fs.existsSync(configPath)) fail("cli-basic/jso.config.json is missing");
66
-
67
- const temp = fs.mkdtempSync(path.join(os.tmpdir(), "jso-example-"));
68
- const copied = path.join(temp, "cli-basic");
69
- fs.cpSync(path.join(examplesRoot, "cli-basic"), copied, { recursive: true });
70
- runNode([path.join(copied, "scripts", "build.js")], { cwd: copied });
71
- for (const relative of ["dist/app.js", "dist/index.html"]) {
72
- if (!fs.existsSync(path.join(copied, relative))) fail(`cli-basic build did not produce ${relative}`);
73
- }
74
-
75
- const planScript = [
76
- `const { planProtection } = require(${JSON.stringify(root)});`,
77
- `const plan = planProtection({ input: "dist", output: "dist-protected", extensions: [".js"], copyAssets: true });`,
78
- `if (plan.summary.files.length !== 1) throw new Error("expected one JS input");`,
79
- `if (!plan.summary.assets.some((item) => item.endsWith("index.html"))) throw new Error("expected copied HTML asset");`
80
- ].join("\n");
81
- runNode(["-e", planScript], { cwd: copied });
82
-
83
- process.stdout.write(`verify-examples: PASS (${scripts.length} scripts, ${jsonFiles.length} JSON files, CLI build and offline plan)\n`);
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ const childProcess = require("node:child_process");
6
+ const fs = require("node:fs");
7
+ const os = require("node:os");
8
+ const path = require("node:path");
9
+
10
+ const root = path.resolve(__dirname, "..");
11
+ const examplesRoot = path.join(root, "examples");
12
+ const packageJson = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
13
+ const expectedVersion = packageJson.version;
14
+
15
+ function fail(message) {
16
+ process.stderr.write(`verify-examples: FAIL: ${message}\n`);
17
+ process.exit(1);
18
+ }
19
+
20
+ function walk(folder) {
21
+ return fs.readdirSync(folder, { withFileTypes: true }).flatMap((entry) => {
22
+ const full = path.join(folder, entry.name);
23
+ return entry.isDirectory() ? walk(full) : [full];
24
+ });
25
+ }
26
+
27
+ function runNode(args, options = {}) {
28
+ const result = childProcess.spawnSync(process.execPath, args, { encoding: "utf8", ...options });
29
+ if (result.status !== 0) fail(`${args.join(" ")} failed: ${(result.stderr || result.stdout || result.error || "unknown error").toString().trim()}`);
30
+ return result;
31
+ }
32
+
33
+ const files = walk(examplesRoot);
34
+ const scripts = files.filter((file) => /\.(?:js|cjs)$/.test(file));
35
+ const jsonFiles = files.filter((file) => path.extname(file) === ".json");
36
+
37
+ for (const file of scripts) runNode(["--check", file]);
38
+ for (const file of jsonFiles) {
39
+ try { JSON.parse(fs.readFileSync(file, "utf8")); }
40
+ catch (error) { fail(`${path.relative(root, file)} is invalid JSON: ${error.message}`); }
41
+ }
42
+
43
+ const readme = fs.readFileSync(path.join(examplesRoot, "README.md"), "utf8");
44
+ // The package is published as `javascriptobfuscator-com` since 2026-08-30;
45
+ // `jso-protector` is the deprecated former name. Assert the CANONICAL name so
46
+ // this gate cannot go on enforcing a name we no longer tell customers to install.
47
+ if (!readme.includes(`npm install --save-dev jso-protector@${expectedVersion}`)) fail("examples README does not install the current public version under this package name");
48
+ if (readme.includes("intentionally not published to npm")) fail("examples README still says the public package is unpublished");
49
+
50
+ const reactNativeReadme = fs.readFileSync(path.join(examplesRoot, "react-native", "README.md"), "utf8");
51
+ for (const stale of ["jso-protector/metro.js", "npx jso ai compat-scan"]) {
52
+ if (reactNativeReadme.includes(stale)) fail(`React Native guide contains stale command ${JSON.stringify(stale)}`);
53
+ }
54
+
55
+ const exportKeys = new Set(Object.keys(packageJson.exports));
56
+ for (const file of files.filter((candidate) => /\.(?:js|cjs|md)$/.test(candidate))) {
57
+ const source = fs.readFileSync(file, "utf8");
58
+ for (const match of source.matchAll(/(?:require\(|from\s+)["']jso-protector(\/[a-z0-9-]+)?["']/gi)) {
59
+ const key = match[1] ? `.${match[1]}` : ".";
60
+ if (!exportKeys.has(key)) fail(`${path.relative(root, file)} references undeclared package export ${key}`);
61
+ }
62
+ }
63
+
64
+ const configPath = path.join(examplesRoot, "cli-basic", "jso.config.json");
65
+ if (!fs.existsSync(configPath)) fail("cli-basic/jso.config.json is missing");
66
+
67
+ const temp = fs.mkdtempSync(path.join(os.tmpdir(), "jso-example-"));
68
+ const copied = path.join(temp, "cli-basic");
69
+ fs.cpSync(path.join(examplesRoot, "cli-basic"), copied, { recursive: true });
70
+ runNode([path.join(copied, "scripts", "build.js")], { cwd: copied });
71
+ for (const relative of ["dist/app.js", "dist/index.html"]) {
72
+ if (!fs.existsSync(path.join(copied, relative))) fail(`cli-basic build did not produce ${relative}`);
73
+ }
74
+
75
+ const planScript = [
76
+ `const { planProtection } = require(${JSON.stringify(root)});`,
77
+ `const plan = planProtection({ input: "dist", output: "dist-protected", extensions: [".js"], copyAssets: true });`,
78
+ `if (plan.summary.files.length !== 1) throw new Error("expected one JS input");`,
79
+ `if (!plan.summary.assets.some((item) => item.endsWith("index.html"))) throw new Error("expected copied HTML asset");`
80
+ ].join("\n");
81
+ runNode(["-e", planScript], { cwd: copied });
82
+
83
+ process.stdout.write(`verify-examples: PASS (${scripts.length} scripts, ${jsonFiles.length} JSON files, CLI build and offline plan)\n`);
@@ -73,6 +73,7 @@ const REQUIRED_PACKED_FILES = [
73
73
  "react-native.d.ts",
74
74
  "react-native.js",
75
75
  "release-signer.js",
76
+ "vm-status.js",
76
77
  "rspack.d.ts",
77
78
  "rspack.js",
78
79
  "rspack-loader.d.ts",
@@ -1,84 +1,86 @@
1
- # jso-protector Examples
2
-
3
- These examples show the common release patterns:
4
-
5
- - `cli-basic`: protect a generated `dist/` folder after any build tool, with JSON and CommonJS config examples.
6
- - `node-api`: protect a generated `dist/` folder from custom Node.js release scripts, including a typed release-summary script.
7
- - `electron-app` scaffold: run `jso-protector --init --init-template electron-app` when an Electron packager writes a release folder that mixes Node-oriented JavaScript with copied app assets.
8
- - `parcel`: run Parcel normally, then protect the generated `dist/` folder as a post-build release step.
9
- - `bun`: run `bun build`, then protect the generated output folder through the Node API.
10
- - `turbopack`: run `next build --turbopack`, then protect selected `.next/static/` chunks as a post-build release step.
11
- - `browserify`: protect selected Browserify modules through a transform.
12
- - `metro.config.js`: wrap Metro or Expo serializer output so React Native release bundles are protected.
13
- - `react-native/metro.config.js`: use the React Native alias entrypoint when project docs or templates expect a dedicated React Native package path.
14
- - `nextjs`: wrap `next.config.js` so production client bundles are protected automatically.
15
- - `rspack`: protect emitted Rspack assets or selected modules through the Rspack loader alias.
16
- - `vite`: protect emitted Vite chunks.
17
- - `rollup`: protect emitted Rollup chunks.
18
- - `esbuild`: protect esbuild output.
19
- - `webpack`: protect emitted Webpack assets.
20
- - `webpack-loader`: protect selected Webpack modules through a loader.
21
- - `gulp`: protect files in a legacy Gulp release task.
22
- - `grunt`: protect file mappings in a legacy Grunt release task.
23
- - `payment-page-script-inventory.json`: starter source-free attachment for
24
- `jso-protector compliance pci-dss-v4 --script-inventory`. You can also
25
- generate a review starter from observed checkout scripts with
26
- `jso-protector --script-inventory-from-snapshot reports/runtime-inventory.json --script-inventory-output reports/payment-script-inventory.json`.
27
- In GitHub Actions, set the JSO action's `payment-script-inventory` and
28
- `runtime-inventory-snapshot` inputs to run the same drift audit as a
29
- source-free preflight gate.
30
- - `payment-page-security-headers.json`: starter source-free attachment for
31
- `jso-protector compliance pci-dss-v4 --payment-page-headers`. Generate a
32
- current snapshot from a browser or synthetic-monitor HAR with
33
- `jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json`.
34
- `matchesBaseline` uses `match`, `mismatch`, or `missing` so reviewers can
35
- see whether a checkout page or frame changed from the approved baseline.
36
-
37
- Install the published package before running examples. The package is now
38
- published as `javascriptobfuscator-com`; `jso-protector` is the former name and
39
- is deprecated but still updated:
40
-
41
- ```bash
42
- npm install --save-dev javascriptobfuscator-com@0.4.15
43
- ```
44
-
45
- Repository contributors can instead use the existing `file:../..` development
46
- dependency in the self-contained example projects. Customer projects should use
47
- the pinned registry version above.
48
-
49
- All examples expect API credentials in environment variables:
50
-
51
- ```bash
52
- set JSO_API_KEY=base64-api-key-from-dashboard
53
- set JSO_API_PASSWORD=base64-api-password-from-dashboard
54
- ```
55
-
56
- Use CI secrets for shared pipelines.
57
-
58
- Run `npm run preflight` in `examples/cli-basic` before protection when you want one offline release check that validates config, confirms matched files/assets, and runs doctor checks without sending source code to the API.
59
-
60
- Run `jso-protector --config jso.config.json --competitor-gap-report --json` after migrating from another obfuscator when you need a source-free report of runtime-defense, source-map, lock, and release-forensics parity gaps.
61
-
62
- Use `jso.config.json` for schema-friendly static config. Use `jso.config.cjs` when CI needs environment-aware inputs, outputs, presets, or release domain settings. JavaScript config files execute as Node.js code, so only load them from trusted repositories.
63
-
64
- For Parcel, Bun, and Turbopack, the examples intentionally use the generic Node API after the framework build completes. That keeps the package aligned with the current hosted-API workflow while still giving modern toolchains a copy-paste release recipe.
65
-
66
- ## Protected regions
67
-
68
- Projects migrating from `javascript-obfuscator` can preserve source regions marked with conditional comments by setting `honorConditionalComments: true` in CLI, Node API, or build-plugin config. The protector sends only enabled regions to the hosted API and recomposes the original file afterward.
69
-
70
- ```js
71
- jsoProtector({
72
- apiKey: process.env.JSO_API_KEY,
73
- apiPassword: process.env.JSO_API_PASSWORD,
74
- preset: "balanced",
75
- honorConditionalComments: true
76
- });
77
- ```
78
-
79
- ```js
80
- console.log("protect this");
81
- // javascript-obfuscator:disable
82
- console.log("leave this exact code alone");
83
- // javascript-obfuscator:enable
84
- ```
1
+ # jso-protector Examples
2
+
3
+ These examples show the common release patterns:
4
+
5
+ - `cli-basic`: protect a generated `dist/` folder after any build tool, with JSON and CommonJS config examples.
6
+ - `node-api`: protect a generated `dist/` folder from custom Node.js release scripts, including a typed release-summary script.
7
+ - `electron-app` scaffold: run `jso-protector --init --init-template electron-app` when an Electron packager writes a release folder that mixes Node-oriented JavaScript with copied app assets.
8
+ - `parcel`: run Parcel normally, then protect the generated `dist/` folder as a post-build release step.
9
+ - `bun`: run `bun build`, then protect the generated output folder through the Node API.
10
+ - `turbopack`: run `next build --turbopack`, then protect selected `.next/static/` chunks as a post-build release step.
11
+ - `browserify`: protect selected Browserify modules through a transform.
12
+ - `metro.config.js`: wrap Metro or Expo serializer output so React Native release bundles are protected.
13
+ - `react-native/metro.config.js`: use the React Native alias entrypoint when project docs or templates expect a dedicated React Native package path.
14
+ - `nextjs`: wrap `next.config.js` so production client bundles are protected automatically.
15
+ - `rspack`: protect emitted Rspack assets or selected modules through the Rspack loader alias.
16
+ - `vite`: protect emitted Vite chunks.
17
+ - `rollup`: protect emitted Rollup chunks.
18
+ - `esbuild`: protect esbuild output.
19
+ - `webpack`: protect emitted Webpack assets.
20
+ - `webpack-loader`: protect selected Webpack modules through a loader.
21
+ - `gulp`: protect files in a legacy Gulp release task.
22
+ - `grunt`: protect file mappings in a legacy Grunt release task.
23
+ - `payment-page-script-inventory.json`: starter source-free attachment for
24
+ `jso-protector compliance pci-dss-v4 --script-inventory`. You can also
25
+ generate a review starter from observed checkout scripts with
26
+ `jso-protector --script-inventory-from-snapshot reports/runtime-inventory.json --script-inventory-output reports/payment-script-inventory.json`.
27
+ In GitHub Actions, set the JSO action's `payment-script-inventory` and
28
+ `runtime-inventory-snapshot` inputs to run the same drift audit as a
29
+ source-free preflight gate.
30
+ - `payment-page-security-headers.json`: starter source-free attachment for
31
+ `jso-protector compliance pci-dss-v4 --payment-page-headers`. Generate a
32
+ current snapshot from a browser or synthetic-monitor HAR with
33
+ `jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json`.
34
+ `matchesBaseline` uses `match`, `mismatch`, or `missing` so reviewers can
35
+ see whether a checkout page or frame changed from the approved baseline.
36
+
37
+ Install the published package before running examples. The package is now
38
+ published as `javascriptobfuscator-com`; `jso-protector` is the former name and
39
+ is deprecated but still updated:
40
+
41
+ ```bash
42
+ npm install --save-dev javascriptobfuscator-com@0.5.1
43
+ # Or install this package name:
44
+ npm install --save-dev jso-protector@0.4.16
45
+ ```
46
+
47
+ Repository contributors can instead use the existing `file:../..` development
48
+ dependency in the self-contained example projects. Customer projects should use
49
+ the pinned registry version above.
50
+
51
+ All examples expect API credentials in environment variables:
52
+
53
+ ```bash
54
+ set JSO_API_KEY=base64-api-key-from-dashboard
55
+ set JSO_API_PASSWORD=base64-api-password-from-dashboard
56
+ ```
57
+
58
+ Use CI secrets for shared pipelines.
59
+
60
+ Run `npm run preflight` in `examples/cli-basic` before protection when you want one offline release check that validates config, confirms matched files/assets, and runs doctor checks without sending source code to the API.
61
+
62
+ Run `jso-protector --config jso.config.json --competitor-gap-report --json` after migrating from another obfuscator when you need a source-free report of runtime-defense, source-map, lock, and release-forensics parity gaps.
63
+
64
+ Use `jso.config.json` for schema-friendly static config. Use `jso.config.cjs` when CI needs environment-aware inputs, outputs, presets, or release domain settings. JavaScript config files execute as Node.js code, so only load them from trusted repositories.
65
+
66
+ For Parcel, Bun, and Turbopack, the examples intentionally use the generic Node API after the framework build completes. That keeps the package aligned with the current hosted-API workflow while still giving modern toolchains a copy-paste release recipe.
67
+
68
+ ## Protected regions
69
+
70
+ Projects migrating from `javascript-obfuscator` can preserve source regions marked with conditional comments by setting `honorConditionalComments: true` in CLI, Node API, or build-plugin config. The protector sends only enabled regions to the hosted API and recomposes the original file afterward.
71
+
72
+ ```js
73
+ jsoProtector({
74
+ apiKey: process.env.JSO_API_KEY,
75
+ apiPassword: process.env.JSO_API_PASSWORD,
76
+ preset: "balanced",
77
+ honorConditionalComments: true
78
+ });
79
+ ```
80
+
81
+ ```js
82
+ console.log("protect this");
83
+ // javascript-obfuscator:disable
84
+ console.log("leave this exact code alone");
85
+ // javascript-obfuscator:enable
86
+ ```
package/package.json CHANGED
@@ -1,318 +1,319 @@
1
- {
2
- "name": "jso-protector",
3
- "version": "0.4.15",
4
- "description": "Obfuscate and protect JavaScript in your build or CI: dependency-free CLI, Node API, and webpack/Vite/Rollup/esbuild/Next.js/Metro plugins, with one-command migration from javascript-obfuscator and JS-Confuser configs.",
5
- "license": "SEE LICENSE IN LICENSE",
6
- "author": "JavaScript Obfuscator",
7
- "homepage": "https://javascriptobfuscator.com/docs/npmcli.aspx",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/richtexteditor/jso-protector.git"
11
- },
12
- "bugs": {
13
- "url": "https://github.com/richtexteditor/jso-protector/issues",
14
- "email": "support@javascriptobfuscator.com"
15
- },
16
- "keywords": [
17
- "javascript-obfuscator",
18
- "obfuscation",
19
- "javascript",
20
- "cli",
21
- "ci",
22
- "browserify",
23
- "electron",
24
- "expo",
25
- "next",
26
- "nextjs",
27
- "react-native",
28
- "vite",
29
- "webpack",
30
- "rspack",
31
- "webpack-loader",
32
- "rspack-loader",
33
- "rollup",
34
- "esbuild",
35
- "gulp",
36
- "grunt",
37
- "obfuscator",
38
- "javascript-obfuscation",
39
- "code-protection",
40
- "source-code-protection",
41
- "anti-tamper",
42
- "minify",
43
- "protect",
44
- "typescript",
45
- "nodejs",
46
- "build-tool"
47
- ],
48
- "files": [
49
- "bin/",
50
- "ci/",
51
- "compliance/",
52
- "config/",
53
- "examples/",
54
- "governance/",
55
- "runtime/",
56
- "!examples/**/dist/**",
57
- "!examples/**/dist-protected/**",
58
- "!examples/**/node_modules/**",
59
- "bun.d.ts",
60
- "bun.js",
61
- "ai-cli.js",
62
- "ai.js",
63
- "browserify.d.ts",
64
- "browserify.js",
65
- "credentials.js",
66
- "esbuild.d.ts",
67
- "esbuild.js",
68
- "gulp.d.ts",
69
- "gulp.js",
70
- "grunt.d.ts",
71
- "grunt.js",
72
- "index.d.ts",
73
- "index.js",
74
- "metro.d.ts",
75
- "metro.js",
76
- "next.d.ts",
77
- "next.js",
78
- "parcel.d.ts",
79
- "parcel.js",
80
- "react-native.d.ts",
81
- "react-native.js",
82
- "release-signer.js",
83
- "rspack.d.ts",
84
- "rspack.js",
85
- "rspack-loader.d.ts",
86
- "rspack-loader.js",
87
- "rollup.d.ts",
88
- "rollup.js",
89
- "turbopack.d.ts",
90
- "turbopack.js",
91
- "vite.d.ts",
92
- "vite.js",
93
- "watermark.js",
94
- "webpack.d.ts",
95
- "webpack.js",
96
- "webpack-loader.d.ts",
97
- "webpack-loader.js",
98
- "CHANGELOG.md",
99
- "LICENSE",
100
- "MIGRATION.md",
101
- "README.md",
102
- "RELEASE.md",
103
- "SECURITY.md",
104
- "jso.config.example.json",
105
- "jso.config.schema.json"
106
- ],
107
- "sideEffects": false,
108
- "type": "commonjs",
109
- "main": "./index.js",
110
- "types": "./index.d.ts",
111
- "exports": {
112
- ".": {
113
- "types": "./index.d.ts",
114
- "require": "./index.js",
115
- "default": "./index.js"
116
- },
117
- "./browserify": {
118
- "types": "./browserify.d.ts",
119
- "require": "./browserify.js",
120
- "default": "./browserify.js"
121
- },
122
- "./bun": {
123
- "types": "./bun.d.ts",
124
- "require": "./bun.js",
125
- "default": "./bun.js"
126
- },
127
- "./next": {
128
- "types": "./next.d.ts",
129
- "require": "./next.js",
130
- "default": "./next.js"
131
- },
132
- "./metro": {
133
- "types": "./metro.d.ts",
134
- "require": "./metro.js",
135
- "default": "./metro.js"
136
- },
137
- "./parcel": {
138
- "types": "./parcel.d.ts",
139
- "require": "./parcel.js",
140
- "default": "./parcel.js"
141
- },
142
- "./react-native": {
143
- "types": "./react-native.d.ts",
144
- "require": "./react-native.js",
145
- "default": "./react-native.js"
146
- },
147
- "./rspack": {
148
- "types": "./rspack.d.ts",
149
- "require": "./rspack.js",
150
- "default": "./rspack.js"
151
- },
152
- "./rspack-loader": {
153
- "types": "./rspack-loader.d.ts",
154
- "require": "./rspack-loader.js",
155
- "default": "./rspack-loader.js"
156
- },
157
- "./esbuild": {
158
- "types": "./esbuild.d.ts",
159
- "require": "./esbuild.js",
160
- "default": "./esbuild.js"
161
- },
162
- "./gulp": {
163
- "types": "./gulp.d.ts",
164
- "require": "./gulp.js",
165
- "default": "./gulp.js"
166
- },
167
- "./grunt": {
168
- "types": "./grunt.d.ts",
169
- "require": "./grunt.js",
170
- "default": "./grunt.js"
171
- },
172
- "./rollup": {
173
- "types": "./rollup.d.ts",
174
- "require": "./rollup.js",
175
- "default": "./rollup.js"
176
- },
177
- "./turbopack": {
178
- "types": "./turbopack.d.ts",
179
- "require": "./turbopack.js",
180
- "default": "./turbopack.js"
181
- },
182
- "./vite": {
183
- "types": "./vite.d.ts",
184
- "require": "./vite.js",
185
- "default": "./vite.js"
186
- },
187
- "./webpack": {
188
- "types": "./webpack.d.ts",
189
- "require": "./webpack.js",
190
- "default": "./webpack.js"
191
- },
192
- "./webpack-loader": {
193
- "types": "./webpack-loader.d.ts",
194
- "require": "./webpack-loader.js",
195
- "default": "./webpack-loader.js"
196
- },
197
- "./governance": {
198
- "types": "./governance/index.d.ts",
199
- "require": "./governance/index.js",
200
- "default": "./governance/index.js"
201
- },
202
- "./runtime/managed-integrity": {
203
- "types": "./runtime/managed-integrity.d.ts",
204
- "require": "./runtime/managed-integrity.js",
205
- "default": "./runtime/managed-integrity.js"
206
- },
207
- "./runtime/data-exfiltration-guard": {
208
- "types": "./runtime/data-exfiltration-guard.d.ts",
209
- "require": "./runtime/data-exfiltration-guard.js",
210
- "default": "./runtime/data-exfiltration-guard.js"
211
- },
212
- "./runtime/third-party-inventory": "./runtime/third-party-inventory.js",
213
- "./runtime/countermeasures": "./runtime/countermeasures.js",
214
- "./runtime/environment-integrity": "./runtime/environment-integrity.js",
215
- "./runtime/ai-script-governance": "./runtime/ai-script-governance.js",
216
- "./package.json": "./package.json",
217
- "./jso.config.schema.json": "./jso.config.schema.json",
218
- "./schema": "./jso.config.schema.json"
219
- },
220
- "bin": {
221
- "javascriptobfuscator": "./bin/jso-protector.js",
222
- "jso-protector": "./bin/jso-protector.js"
223
- },
224
- "scripts": {
225
- "smoke": "node ./bin/jso-protector.js --help && node ./bin/jso-protector.js --config ./jso.config.example.json --dry-run --json",
226
- "smoke:api": "node ./bin/jso-protector.js --config ./jso.config.example.json --json",
227
- "test": "node ./test/cli.test.js && node ./test/ai.test.js && node ./test/ai-precheck.test.js && node ./test/ai-script-governance.test.js && node ./test/data-exfiltration-guard.test.js && node ./test/compat-scan.test.js && node ./test/compliance.test.js && node ./test/evidence-forwarder.test.js && node ./test/config-schema.test.js && node ./test/countermeasures.test.js && node ./test/environment-integrity.test.js && node ./test/estimate.test.js && node ./test/github-action.test.js && node ./test/governance.test.js && node ./test/local-bridge.test.js && node ./test/managed-integrity.test.js && node ./test/named-sets.test.js && node ./test/release-signer.test.js && node ./test/scan-watermarks.test.js && node ./test/third-party-inventory.test.js && node ./test/watermark.test.js && node ./test/wire-format-vectors.test.js",
228
- "verify": "npm test && npm run verify:package && npm run verify:examples && npm run verify:publish-metadata && npm run verify:ci && npm run verify:polyglot && npm run verify:ai && npm run verify:verify-scripts-tracked && npm run verify:aspnet-bom && npm run verify:aspnet-compile && npm run verify:endrequest-guard && npm run verify:analysis-pattern-bounds && npm run verify:wire-name-coverage && npm run verify:desktop-option-names && npm run verify:symbolicate-api-shape && npm run verify:advice-option-names && npm run verify:preset-plan-levels && npm run verify:health-readiness && npm run verify:legacy-soap-security && npm run verify:online-demo-security && npm run verify:parser-engine && npm run verify:emit-validation && npm run verify:es5-syntax && npm run verify:emit-validation-modern && npm run verify:runtime-defense-libraries && npm run verify:internal-links && npm run verify:seo && npm run verify:sitemap-freshness && npm run verify:changelog-freshness && npm run verify:faq-visibility && npm run verify:artifact-claims && npm run verify:runtime-dashboard && npm run verify:plan-numbers && npm run verify:payment-page && npm run verify:payment-activation && npm run verify:payment-row-completeness && npm run verify:account-recovery && npm run verify:registration && npm run verify:admin-auth && npm run verify:http-api-auth && npm run verify:request-body-limits && npm run verify:public-form-security && npm run verify:operational-logs && npm run verify:richtexteditor-surface && npm run verify:dashboard-resource-governance && npm run verify:dashboard-diagnostic-surface && npm run verify:web-integrity-policy && npm run verify:entitlements && npm run verify:enterprise-governance && npm run verify:database-migrations && npm run verify:source-secrets && npm run verify:published-artifact-secrets && npm run verify:ignored-shipping-secrets && npm run verify:winforms-runtime-floor && npm run verify:ai-billing && npm run verify:ai-key-security && npm run verify:ajax-transport && npm run verify:competitor-gap && npm run verify:parity-defect-sync && npm run verify:source-map-evidence && npm run verify:migration-review && npm run verify:identifier-cache-review && npm run verify:runtime-defense-review && npm run verify:vm-proof && npm run verify:deployment-hygiene && npm run verify:download-artifacts && npm run verify:download-examples && npm run verify:copy-discipline && npm run verify:github-action && npm run verify:outbound-nofollow",
229
- "verify:release": "npm run verify && npm run verify:corpus-protect && npm run verify:corpus-runtime",
230
- "verify:verify-scripts-tracked": "node ../polyglot-smoke/check-verify-scripts-tracked.js",
231
- "verify:parity-defect-sync": "node ../polyglot-smoke/check-parity-defect-sync.js",
232
- "verify:aspnet-bom": "node ../polyglot-smoke/check-aspnet-bom.js",
233
- "verify:aspnet-compile": "node ../polyglot-smoke/check-aspnet-compile.js",
234
- "verify:endrequest-guard": "node ../polyglot-smoke/check-endrequest-guard.js",
235
- "verify:payment-row-completeness": "node ../polyglot-smoke/check-payment-row-completeness.js",
236
- "verify:analysis-pattern-bounds": "node ../polyglot-smoke/check-analysis-pattern-bounds.js",
237
- "verify:wire-name-coverage": "node ../polyglot-smoke/check-wire-name-coverage.js",
238
- "verify:desktop-option-names": "node ../polyglot-smoke/check-desktop-option-names.js",
239
- "verify:symbolicate-api-shape": "node ../polyglot-smoke/check-symbolicate-api-shape.js",
240
- "verify:advice-option-names": "node ../polyglot-smoke/check-advice-option-names.js",
241
- "verify:preset-plan-levels": "node ../polyglot-smoke/check-preset-plan-levels.js",
242
- "verify:health-readiness": "node ../polyglot-smoke/check-health-readiness.js",
243
- "verify:live-health": "node ../polyglot-smoke/check-production-health.js",
244
- "verify:live-seo": "node ../polyglot-smoke/check-live-seo.js",
245
- "verify:legacy-soap-security": "node ../polyglot-smoke/check-legacy-soap-security.js",
246
- "verify:online-demo-security": "node ../polyglot-smoke/check-online-demo-security.js",
247
- "verify:parser-engine": "node ../polyglot-smoke/check-parser-engine.js",
248
- "verify:package-closure": "bash ../../tools/verify-package-closure.sh",
249
- "verify:package-behaviour": "bash ../../tools/verify-package-behaviour.sh",
250
- "verify:emit-validation": "node ../../tools/emit-validation/run.js",
251
- "verify:emit-validation-modern": "node ../../tools/emit-validation/run.js modern",
252
- "verify:es5-syntax": "node ../../tools/es5-syntax-gate/run.js",
253
- "verify:corpus-protect": "node ../../tools/corpus-protect/run.js",
254
- "verify:corpus-runtime": "node ../../tools/corpus-protect/runtime-smoke.js",
255
- "verify:runtime-defense-libraries": "node ../../tools/corpus-protect/runtime-defense-libraries.js",
256
- "verify:internal-links": "node ../polyglot-smoke/check-internal-links.js",
257
- "verify:seo": "node ../polyglot-smoke/check-public-seo.js",
258
- "verify:live-changelog": "node ../polyglot-smoke/check-changelog-freshness.js --live",
259
- "verify:changelog-freshness": "node ../polyglot-smoke/check-changelog-freshness.js",
260
- "verify:sitemap-freshness": "node ../polyglot-smoke/check-sitemap-freshness.js",
261
- "verify:plan-numbers": "node ../polyglot-smoke/check-plan-numbers.js",
262
- "verify:faq-visibility": "node ../polyglot-smoke/check-faq-visibility.js",
263
- "verify:artifact-claims": "node ../polyglot-smoke/check-public-artifact-claims.js",
264
- "verify:artifact-claims-live": "node ../polyglot-smoke/check-public-artifact-claims.js --live",
265
- "verify:runtime-dashboard": "node ../polyglot-smoke/check-runtime-dashboard.js",
266
- "verify:payment-page": "node ../polyglot-smoke/check-payment-page-evidence.js",
267
- "verify:payment-activation": "node ../polyglot-smoke/check-payment-activation-security.js",
268
- "verify:account-recovery": "node ../polyglot-smoke/check-account-recovery-security.js",
269
- "verify:registration": "node ../polyglot-smoke/check-registration-security.js",
270
- "verify:admin-auth": "node ../polyglot-smoke/check-admin-auth-security.js",
271
- "verify:http-api-auth": "node ../polyglot-smoke/check-http-api-auth-security.js",
272
- "verify:request-body-limits": "node ../polyglot-smoke/check-request-body-limits.js",
273
- "verify:public-form-security": "node ../polyglot-smoke/check-public-form-security.js",
274
- "verify:operational-logs": "node ../polyglot-smoke/check-operational-log-governance.js",
275
- "verify:richtexteditor-surface": "node ../polyglot-smoke/check-richtexteditor-surface.js",
276
- "verify:dashboard-resource-governance": "node ../polyglot-smoke/check-dashboard-resource-governance.js",
277
- "verify:dashboard-diagnostic-surface": "node ../polyglot-smoke/check-dashboard-diagnostic-surface.js",
278
- "verify:web-integrity-policy": "node ../polyglot-smoke/check-web-integrity-policy-security.js",
279
- "verify:entitlements": "node ../polyglot-smoke/check-entitlement-consistency.js",
280
- "verify:enterprise-governance": "node ../polyglot-smoke/check-enterprise-governance-security.js",
281
- "verify:database-migrations": "node ../polyglot-smoke/check-database-migration-drift.js",
282
- "verify:published-artifact-secrets": "node ../polyglot-smoke/check-published-artifact-secrets.js",
283
- "verify:source-secrets": "node ../polyglot-smoke/check-source-secret-discipline.js",
284
- "verify:ignored-shipping-secrets": "node ../polyglot-smoke/check-ignored-shipping-secrets.js",
285
- "verify:winforms-runtime-floor": "node ../polyglot-smoke/check-winforms-runtime-floor.js",
286
- "verify:ai-billing": "node ../polyglot-smoke/check-ai-billing-security.js",
287
- "verify:ai-key-security": "node ../polyglot-smoke/check-ai-key-security.js",
288
- "verify:ajax-transport": "node ../polyglot-smoke/check-ajax-transport-security.js",
289
- "verify:js-safe-integer-ids": "node ../polyglot-smoke/check-js-safe-integer-ids.js",
290
- "verify:mixedfile-roundtrip": "node ../../tools/mixedfile-roundtrip/run.js",
291
- "verify:mixedfile-protect": "node ../../tools/mixedfile-protect/run.js",
292
- "verify:local-report": "node ../../tools/local-report/run.js",
293
- "verify:competitor-gap": "node ../polyglot-smoke/check-competitor-gap-report.js",
294
- "verify:source-map-evidence": "node ../polyglot-smoke/check-source-map-evidence.js",
295
- "verify:migration-review": "node ../polyglot-smoke/check-migration-review.js",
296
- "verify:identifier-cache-review": "node ../polyglot-smoke/check-identifier-cache-review.js",
297
- "verify:runtime-defense-review": "node ../polyglot-smoke/check-runtime-defense-review.js",
298
- "verify:vm-proof": "node ../polyglot-smoke/check-vm-proof-pack.js",
299
- "verify:deployment-hygiene": "node ../polyglot-smoke/check-archive-hygiene.js",
300
- "verify:download-artifacts": "node ../polyglot-smoke/check-download-artifacts.js",
301
- "verify:download-examples": "node ../polyglot-smoke/check-download-examples.js",
302
- "verify:copy-discipline": "node ../polyglot-smoke/check-public-copy-discipline.js",
303
- "verify:github-action": "node ../polyglot-smoke/check-github-action.js",
304
- "verify:package": "node ./ci/verify-package.js",
305
- "verify:examples": "node ./ci/verify-examples.js",
306
- "verify:publish-metadata": "node ./ci/verify-publish-metadata.js --allow-local",
307
- "verify:publish-ready": "node ./ci/verify-publish-metadata.js",
308
- "verify:ci": "node ./ci/verify-templates.js",
309
- "verify:polyglot": "node ../polyglot-smoke/smoke.js",
310
- "verify:ai": "node ../polyglot-smoke/ai-smoke.js",
311
- "verify:ai-live": "node ../polyglot-smoke/ai-smoke-live.js",
312
- "prepublishOnly": "node ./ci/verify-publish-metadata.js && npm run verify:published-artifact-secrets && npm run verify:package && npm run verify:examples && npm run verify:ci && npm run verify:polyglot && npm run verify:ai",
313
- "verify:outbound-nofollow": "node ../polyglot-smoke/check-outbound-nofollow.js"
314
- },
315
- "engines": {
316
- "node": ">=18"
317
- }
318
- }
1
+ {
2
+ "name": "jso-protector",
3
+ "version": "0.4.16",
4
+ "description": "Obfuscate and protect JavaScript in your build or CI: dependency-free CLI, Node API, and webpack/Vite/Rollup/esbuild/Next.js/Metro plugins, with one-command migration from javascript-obfuscator and JS-Confuser configs.",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "author": "JavaScript Obfuscator",
7
+ "homepage": "https://javascriptobfuscator.com/docs/npmcli.aspx",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/richtexteditor/jso-protector.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/richtexteditor/jso-protector/issues",
14
+ "email": "support@javascriptobfuscator.com"
15
+ },
16
+ "keywords": [
17
+ "javascript-obfuscator",
18
+ "obfuscation",
19
+ "javascript",
20
+ "cli",
21
+ "ci",
22
+ "browserify",
23
+ "electron",
24
+ "expo",
25
+ "next",
26
+ "nextjs",
27
+ "react-native",
28
+ "vite",
29
+ "webpack",
30
+ "rspack",
31
+ "webpack-loader",
32
+ "rspack-loader",
33
+ "rollup",
34
+ "esbuild",
35
+ "gulp",
36
+ "grunt",
37
+ "obfuscator",
38
+ "javascript-obfuscation",
39
+ "code-protection",
40
+ "source-code-protection",
41
+ "anti-tamper",
42
+ "minify",
43
+ "protect",
44
+ "typescript",
45
+ "nodejs",
46
+ "build-tool"
47
+ ],
48
+ "files": [
49
+ "bin/",
50
+ "ci/",
51
+ "compliance/",
52
+ "config/",
53
+ "examples/",
54
+ "governance/",
55
+ "runtime/",
56
+ "!examples/**/dist/**",
57
+ "!examples/**/dist-protected/**",
58
+ "!examples/**/node_modules/**",
59
+ "bun.d.ts",
60
+ "bun.js",
61
+ "ai-cli.js",
62
+ "ai.js",
63
+ "browserify.d.ts",
64
+ "browserify.js",
65
+ "credentials.js",
66
+ "esbuild.d.ts",
67
+ "esbuild.js",
68
+ "gulp.d.ts",
69
+ "gulp.js",
70
+ "grunt.d.ts",
71
+ "grunt.js",
72
+ "index.d.ts",
73
+ "index.js",
74
+ "metro.d.ts",
75
+ "metro.js",
76
+ "next.d.ts",
77
+ "next.js",
78
+ "parcel.d.ts",
79
+ "parcel.js",
80
+ "react-native.d.ts",
81
+ "react-native.js",
82
+ "release-signer.js",
83
+ "rspack.d.ts",
84
+ "rspack.js",
85
+ "rspack-loader.d.ts",
86
+ "rspack-loader.js",
87
+ "rollup.d.ts",
88
+ "rollup.js",
89
+ "turbopack.d.ts",
90
+ "turbopack.js",
91
+ "vite.d.ts",
92
+ "vite.js",
93
+ "watermark.js",
94
+ "webpack.d.ts",
95
+ "webpack.js",
96
+ "webpack-loader.d.ts",
97
+ "webpack-loader.js",
98
+ "CHANGELOG.md",
99
+ "LICENSE",
100
+ "MIGRATION.md",
101
+ "README.md",
102
+ "RELEASE.md",
103
+ "SECURITY.md",
104
+ "jso.config.example.json",
105
+ "jso.config.schema.json",
106
+ "vm-status.js"
107
+ ],
108
+ "sideEffects": false,
109
+ "type": "commonjs",
110
+ "main": "./index.js",
111
+ "types": "./index.d.ts",
112
+ "exports": {
113
+ ".": {
114
+ "types": "./index.d.ts",
115
+ "require": "./index.js",
116
+ "default": "./index.js"
117
+ },
118
+ "./browserify": {
119
+ "types": "./browserify.d.ts",
120
+ "require": "./browserify.js",
121
+ "default": "./browserify.js"
122
+ },
123
+ "./bun": {
124
+ "types": "./bun.d.ts",
125
+ "require": "./bun.js",
126
+ "default": "./bun.js"
127
+ },
128
+ "./next": {
129
+ "types": "./next.d.ts",
130
+ "require": "./next.js",
131
+ "default": "./next.js"
132
+ },
133
+ "./metro": {
134
+ "types": "./metro.d.ts",
135
+ "require": "./metro.js",
136
+ "default": "./metro.js"
137
+ },
138
+ "./parcel": {
139
+ "types": "./parcel.d.ts",
140
+ "require": "./parcel.js",
141
+ "default": "./parcel.js"
142
+ },
143
+ "./react-native": {
144
+ "types": "./react-native.d.ts",
145
+ "require": "./react-native.js",
146
+ "default": "./react-native.js"
147
+ },
148
+ "./rspack": {
149
+ "types": "./rspack.d.ts",
150
+ "require": "./rspack.js",
151
+ "default": "./rspack.js"
152
+ },
153
+ "./rspack-loader": {
154
+ "types": "./rspack-loader.d.ts",
155
+ "require": "./rspack-loader.js",
156
+ "default": "./rspack-loader.js"
157
+ },
158
+ "./esbuild": {
159
+ "types": "./esbuild.d.ts",
160
+ "require": "./esbuild.js",
161
+ "default": "./esbuild.js"
162
+ },
163
+ "./gulp": {
164
+ "types": "./gulp.d.ts",
165
+ "require": "./gulp.js",
166
+ "default": "./gulp.js"
167
+ },
168
+ "./grunt": {
169
+ "types": "./grunt.d.ts",
170
+ "require": "./grunt.js",
171
+ "default": "./grunt.js"
172
+ },
173
+ "./rollup": {
174
+ "types": "./rollup.d.ts",
175
+ "require": "./rollup.js",
176
+ "default": "./rollup.js"
177
+ },
178
+ "./turbopack": {
179
+ "types": "./turbopack.d.ts",
180
+ "require": "./turbopack.js",
181
+ "default": "./turbopack.js"
182
+ },
183
+ "./vite": {
184
+ "types": "./vite.d.ts",
185
+ "require": "./vite.js",
186
+ "default": "./vite.js"
187
+ },
188
+ "./webpack": {
189
+ "types": "./webpack.d.ts",
190
+ "require": "./webpack.js",
191
+ "default": "./webpack.js"
192
+ },
193
+ "./webpack-loader": {
194
+ "types": "./webpack-loader.d.ts",
195
+ "require": "./webpack-loader.js",
196
+ "default": "./webpack-loader.js"
197
+ },
198
+ "./governance": {
199
+ "types": "./governance/index.d.ts",
200
+ "require": "./governance/index.js",
201
+ "default": "./governance/index.js"
202
+ },
203
+ "./runtime/managed-integrity": {
204
+ "types": "./runtime/managed-integrity.d.ts",
205
+ "require": "./runtime/managed-integrity.js",
206
+ "default": "./runtime/managed-integrity.js"
207
+ },
208
+ "./runtime/data-exfiltration-guard": {
209
+ "types": "./runtime/data-exfiltration-guard.d.ts",
210
+ "require": "./runtime/data-exfiltration-guard.js",
211
+ "default": "./runtime/data-exfiltration-guard.js"
212
+ },
213
+ "./runtime/third-party-inventory": "./runtime/third-party-inventory.js",
214
+ "./runtime/countermeasures": "./runtime/countermeasures.js",
215
+ "./runtime/environment-integrity": "./runtime/environment-integrity.js",
216
+ "./runtime/ai-script-governance": "./runtime/ai-script-governance.js",
217
+ "./package.json": "./package.json",
218
+ "./jso.config.schema.json": "./jso.config.schema.json",
219
+ "./schema": "./jso.config.schema.json"
220
+ },
221
+ "bin": {
222
+ "javascriptobfuscator": "./bin/jso-protector.js",
223
+ "jso-protector": "./bin/jso-protector.js"
224
+ },
225
+ "scripts": {
226
+ "smoke": "node ./bin/jso-protector.js --help && node ./bin/jso-protector.js --config ./jso.config.example.json --dry-run --json",
227
+ "smoke:api": "node ./bin/jso-protector.js --config ./jso.config.example.json --json",
228
+ "test": "node ./test/cli.test.js && node ./test/ai.test.js && node ./test/ai-precheck.test.js && node ./test/ai-script-governance.test.js && node ./test/data-exfiltration-guard.test.js && node ./test/compat-scan.test.js && node ./test/compliance.test.js && node ./test/evidence-forwarder.test.js && node ./test/config-schema.test.js && node ./test/countermeasures.test.js && node ./test/environment-integrity.test.js && node ./test/estimate.test.js && node ./test/github-action.test.js && node ./test/governance.test.js && node ./test/local-bridge.test.js && node ./test/managed-integrity.test.js && node ./test/named-sets.test.js && node ./test/release-signer.test.js && node ./test/scan-watermarks.test.js && node ./test/third-party-inventory.test.js && node ./test/watermark.test.js && node ./test/wire-format-vectors.test.js",
229
+ "verify": "npm test && npm run verify:package && npm run verify:examples && npm run verify:publish-metadata && npm run verify:ci && npm run verify:polyglot && npm run verify:ai && npm run verify:verify-scripts-tracked && npm run verify:aspnet-bom && npm run verify:aspnet-compile && npm run verify:endrequest-guard && npm run verify:analysis-pattern-bounds && npm run verify:wire-name-coverage && npm run verify:desktop-option-names && npm run verify:symbolicate-api-shape && npm run verify:advice-option-names && npm run verify:preset-plan-levels && npm run verify:health-readiness && npm run verify:legacy-soap-security && npm run verify:online-demo-security && npm run verify:parser-engine && npm run verify:emit-validation && npm run verify:es5-syntax && npm run verify:emit-validation-modern && npm run verify:runtime-defense-libraries && npm run verify:internal-links && npm run verify:seo && npm run verify:sitemap-freshness && npm run verify:changelog-freshness && npm run verify:faq-visibility && npm run verify:artifact-claims && npm run verify:runtime-dashboard && npm run verify:plan-numbers && npm run verify:payment-page && npm run verify:payment-activation && npm run verify:payment-row-completeness && npm run verify:account-recovery && npm run verify:registration && npm run verify:admin-auth && npm run verify:http-api-auth && npm run verify:request-body-limits && npm run verify:public-form-security && npm run verify:operational-logs && npm run verify:richtexteditor-surface && npm run verify:dashboard-resource-governance && npm run verify:dashboard-diagnostic-surface && npm run verify:web-integrity-policy && npm run verify:entitlements && npm run verify:enterprise-governance && npm run verify:database-migrations && npm run verify:source-secrets && npm run verify:published-artifact-secrets && npm run verify:ignored-shipping-secrets && npm run verify:winforms-runtime-floor && npm run verify:ai-billing && npm run verify:ai-key-security && npm run verify:ajax-transport && npm run verify:competitor-gap && npm run verify:parity-defect-sync && npm run verify:source-map-evidence && npm run verify:migration-review && npm run verify:identifier-cache-review && npm run verify:runtime-defense-review && npm run verify:vm-proof && npm run verify:deployment-hygiene && npm run verify:download-artifacts && npm run verify:download-examples && npm run verify:copy-discipline && npm run verify:github-action && npm run verify:outbound-nofollow",
230
+ "verify:release": "npm run verify && npm run verify:corpus-protect && npm run verify:corpus-runtime",
231
+ "verify:verify-scripts-tracked": "node ../polyglot-smoke/check-verify-scripts-tracked.js",
232
+ "verify:parity-defect-sync": "node ../polyglot-smoke/check-parity-defect-sync.js",
233
+ "verify:aspnet-bom": "node ../polyglot-smoke/check-aspnet-bom.js",
234
+ "verify:aspnet-compile": "node ../polyglot-smoke/check-aspnet-compile.js",
235
+ "verify:endrequest-guard": "node ../polyglot-smoke/check-endrequest-guard.js",
236
+ "verify:payment-row-completeness": "node ../polyglot-smoke/check-payment-row-completeness.js",
237
+ "verify:analysis-pattern-bounds": "node ../polyglot-smoke/check-analysis-pattern-bounds.js",
238
+ "verify:wire-name-coverage": "node ../polyglot-smoke/check-wire-name-coverage.js",
239
+ "verify:desktop-option-names": "node ../polyglot-smoke/check-desktop-option-names.js",
240
+ "verify:symbolicate-api-shape": "node ../polyglot-smoke/check-symbolicate-api-shape.js",
241
+ "verify:advice-option-names": "node ../polyglot-smoke/check-advice-option-names.js",
242
+ "verify:preset-plan-levels": "node ../polyglot-smoke/check-preset-plan-levels.js",
243
+ "verify:health-readiness": "node ../polyglot-smoke/check-health-readiness.js",
244
+ "verify:live-health": "node ../polyglot-smoke/check-production-health.js",
245
+ "verify:live-seo": "node ../polyglot-smoke/check-live-seo.js",
246
+ "verify:legacy-soap-security": "node ../polyglot-smoke/check-legacy-soap-security.js",
247
+ "verify:online-demo-security": "node ../polyglot-smoke/check-online-demo-security.js",
248
+ "verify:parser-engine": "node ../polyglot-smoke/check-parser-engine.js",
249
+ "verify:package-closure": "bash ../../tools/verify-package-closure.sh",
250
+ "verify:package-behaviour": "bash ../../tools/verify-package-behaviour.sh",
251
+ "verify:emit-validation": "node ../../tools/emit-validation/run.js",
252
+ "verify:emit-validation-modern": "node ../../tools/emit-validation/run.js modern",
253
+ "verify:es5-syntax": "node ../../tools/es5-syntax-gate/run.js",
254
+ "verify:corpus-protect": "node ../../tools/corpus-protect/run.js",
255
+ "verify:corpus-runtime": "node ../../tools/corpus-protect/runtime-smoke.js",
256
+ "verify:runtime-defense-libraries": "node ../../tools/corpus-protect/runtime-defense-libraries.js",
257
+ "verify:internal-links": "node ../polyglot-smoke/check-internal-links.js",
258
+ "verify:seo": "node ../polyglot-smoke/check-public-seo.js",
259
+ "verify:live-changelog": "node ../polyglot-smoke/check-changelog-freshness.js --live",
260
+ "verify:changelog-freshness": "node ../polyglot-smoke/check-changelog-freshness.js",
261
+ "verify:sitemap-freshness": "node ../polyglot-smoke/check-sitemap-freshness.js",
262
+ "verify:plan-numbers": "node ../polyglot-smoke/check-plan-numbers.js",
263
+ "verify:faq-visibility": "node ../polyglot-smoke/check-faq-visibility.js",
264
+ "verify:artifact-claims": "node ../polyglot-smoke/check-public-artifact-claims.js",
265
+ "verify:artifact-claims-live": "node ../polyglot-smoke/check-public-artifact-claims.js --live",
266
+ "verify:runtime-dashboard": "node ../polyglot-smoke/check-runtime-dashboard.js",
267
+ "verify:payment-page": "node ../polyglot-smoke/check-payment-page-evidence.js",
268
+ "verify:payment-activation": "node ../polyglot-smoke/check-payment-activation-security.js",
269
+ "verify:account-recovery": "node ../polyglot-smoke/check-account-recovery-security.js",
270
+ "verify:registration": "node ../polyglot-smoke/check-registration-security.js",
271
+ "verify:admin-auth": "node ../polyglot-smoke/check-admin-auth-security.js",
272
+ "verify:http-api-auth": "node ../polyglot-smoke/check-http-api-auth-security.js",
273
+ "verify:request-body-limits": "node ../polyglot-smoke/check-request-body-limits.js",
274
+ "verify:public-form-security": "node ../polyglot-smoke/check-public-form-security.js",
275
+ "verify:operational-logs": "node ../polyglot-smoke/check-operational-log-governance.js",
276
+ "verify:richtexteditor-surface": "node ../polyglot-smoke/check-richtexteditor-surface.js",
277
+ "verify:dashboard-resource-governance": "node ../polyglot-smoke/check-dashboard-resource-governance.js",
278
+ "verify:dashboard-diagnostic-surface": "node ../polyglot-smoke/check-dashboard-diagnostic-surface.js",
279
+ "verify:web-integrity-policy": "node ../polyglot-smoke/check-web-integrity-policy-security.js",
280
+ "verify:entitlements": "node ../polyglot-smoke/check-entitlement-consistency.js",
281
+ "verify:enterprise-governance": "node ../polyglot-smoke/check-enterprise-governance-security.js",
282
+ "verify:database-migrations": "node ../polyglot-smoke/check-database-migration-drift.js",
283
+ "verify:published-artifact-secrets": "node ../polyglot-smoke/check-published-artifact-secrets.js",
284
+ "verify:source-secrets": "node ../polyglot-smoke/check-source-secret-discipline.js",
285
+ "verify:ignored-shipping-secrets": "node ../polyglot-smoke/check-ignored-shipping-secrets.js",
286
+ "verify:winforms-runtime-floor": "node ../polyglot-smoke/check-winforms-runtime-floor.js",
287
+ "verify:ai-billing": "node ../polyglot-smoke/check-ai-billing-security.js",
288
+ "verify:ai-key-security": "node ../polyglot-smoke/check-ai-key-security.js",
289
+ "verify:ajax-transport": "node ../polyglot-smoke/check-ajax-transport-security.js",
290
+ "verify:js-safe-integer-ids": "node ../polyglot-smoke/check-js-safe-integer-ids.js",
291
+ "verify:mixedfile-roundtrip": "node ../../tools/mixedfile-roundtrip/run.js",
292
+ "verify:mixedfile-protect": "node ../../tools/mixedfile-protect/run.js",
293
+ "verify:local-report": "node ../../tools/local-report/run.js",
294
+ "verify:competitor-gap": "node ../polyglot-smoke/check-competitor-gap-report.js",
295
+ "verify:source-map-evidence": "node ../polyglot-smoke/check-source-map-evidence.js",
296
+ "verify:migration-review": "node ../polyglot-smoke/check-migration-review.js",
297
+ "verify:identifier-cache-review": "node ../polyglot-smoke/check-identifier-cache-review.js",
298
+ "verify:runtime-defense-review": "node ../polyglot-smoke/check-runtime-defense-review.js",
299
+ "verify:vm-proof": "node ../polyglot-smoke/check-vm-proof-pack.js",
300
+ "verify:deployment-hygiene": "node ../polyglot-smoke/check-archive-hygiene.js",
301
+ "verify:download-artifacts": "node ../polyglot-smoke/check-download-artifacts.js",
302
+ "verify:download-examples": "node ../polyglot-smoke/check-download-examples.js",
303
+ "verify:copy-discipline": "node ../polyglot-smoke/check-public-copy-discipline.js",
304
+ "verify:github-action": "node ../polyglot-smoke/check-github-action.js",
305
+ "verify:package": "node ./ci/verify-package.js",
306
+ "verify:examples": "node ./ci/verify-examples.js",
307
+ "verify:publish-metadata": "node ./ci/verify-publish-metadata.js --allow-local",
308
+ "verify:publish-ready": "node ./ci/verify-publish-metadata.js",
309
+ "verify:ci": "node ./ci/verify-templates.js",
310
+ "verify:polyglot": "node ../polyglot-smoke/smoke.js",
311
+ "verify:ai": "node ../polyglot-smoke/ai-smoke.js",
312
+ "verify:ai-live": "node ../polyglot-smoke/ai-smoke-live.js",
313
+ "prepublishOnly": "node ./ci/verify-publish-metadata.js && npm run verify:published-artifact-secrets && npm run verify:package && npm run verify:examples && npm run verify:ci && npm run verify:polyglot && npm run verify:ai",
314
+ "verify:outbound-nofollow": "node ../polyglot-smoke/check-outbound-nofollow.js"
315
+ },
316
+ "engines": {
317
+ "node": ">=18"
318
+ }
319
+ }
package/vm-status.js ADDED
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ function truth(value) {
4
+ return value === true || value === 1 || (typeof value === "string" && value.trim().toLowerCase() === "true");
5
+ }
6
+
7
+ function count(value) {
8
+ const n = typeof value === "number" || (typeof value === "string" && /^\d+$/.test(value)) ? Number(value) : 0;
9
+ return Number.isSafeInteger(n) && n >= 0 ? n : 0;
10
+ }
11
+
12
+ function get(report, pascal, camel) {
13
+ return report[pascal] === undefined ? report[camel] : report[pascal];
14
+ }
15
+
16
+ function summarizeVmProtection(result, options = {}, expectedReports) {
17
+ const expected = expectedReports === undefined ? (truth(options.UseVMProtection) ? 1 : 0) : count(expectedReports);
18
+ const reports = Array.isArray(result.Reports) && result.Reports.length ? result.Reports : [result.Report];
19
+ const selected = reports.filter(report => report && typeof report === "object").filter(report => {
20
+ const enabled = get(report, "EnabledOptions", "enabledOptions");
21
+ return truth(get(report, "VMProtectionRequested", "vmProtectionRequested")) ||
22
+ truth(get(report, "VMProtectionApplied", "vmProtectionApplied")) ||
23
+ (Array.isArray(enabled) && enabled.includes("UseVMProtection"));
24
+ });
25
+ if (!selected.length && !expected) return null;
26
+ let confirmedReports = 0, virtualizedCount = 0, warningCount = 0;
27
+ for (const report of selected) {
28
+ const n = count(get(report, "VMProtectionVirtualizedCount", "vmProtectionVirtualizedCount") ??
29
+ get(report, "VirtualizedFunctionCount", "virtualizedFunctionCount"));
30
+ if (truth(get(report, "VMProtectionApplied", "vmProtectionApplied")) && n > 0) {
31
+ confirmedReports++;
32
+ virtualizedCount += n;
33
+ }
34
+ const dedicated = get(report, "VMProtectionWarnings", "vmProtectionWarnings");
35
+ const general = get(report, "Warnings", "warnings");
36
+ const warnings = (Array.isArray(dedicated) ? dedicated : []).concat(
37
+ Array.isArray(general) ? general.filter(w => typeof w === "string" && /\bVM\b|@virtualize/i.test(w)) : []);
38
+ warningCount += new Set(warnings.filter(w => typeof w === "string" && w.trim())).size;
39
+ }
40
+ const unconfirmedReports = Math.max(selected.length, expected) - confirmedReports;
41
+ return {
42
+ requested: true,
43
+ status: unconfirmedReports ? (confirmedReports ? "partial" : "unconfirmed") :
44
+ (warningCount ? "applied-with-warnings" : "applied"),
45
+ virtualizedCount, confirmedReports, unconfirmedReports, warningCount
46
+ };
47
+ }
48
+
49
+ function formatVmProtection(status) {
50
+ if (!status) return "";
51
+ if (status.status === "unconfirmed") {
52
+ return "VM protection: not confirmed by the report. Use --report <path> to inspect VMProtectionApplied, VMProtectionVirtualizedCount and VMProtectionWarnings; rerun to refresh an older report.";
53
+ }
54
+ let text = `VM protection: ${status.status === "partial" ? "partially confirmed" : "confirmed"} for ${status.virtualizedCount} function(s).`;
55
+ if (status.unconfirmedReports) text += ` ${status.unconfirmedReports} report(s) lack complete VM evidence.`;
56
+ if (status.warningCount) text += ` Review ${status.warningCount} VM warning(s) in the report for skipped functions.`;
57
+ return text;
58
+ }
59
+
60
+ module.exports = { summarizeVmProtection, formatVmProtection };
package/webpack.js CHANGED
@@ -13,7 +13,14 @@ class JsoProtectorWebpackPlugin {
13
13
  const processAssetsHook = compiler.hooks && compiler.hooks.thisCompilation;
14
14
  if (processAssetsHook && compiler.webpack && compiler.webpack.sources && compiler.webpack.Compilation) {
15
15
  const RawSource = compiler.webpack.sources.RawSource;
16
- const stage = compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE;
16
+ const stages = compiler.webpack.Compilation;
17
+ // Minifiers can decode escaped literals and strip the protection header.
18
+ // Protect after minimization/map generation, before content hashes settle.
19
+ const stage = typeof stages.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE === "number"
20
+ ? stages.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
21
+ : (typeof stages.PROCESS_ASSETS_STAGE_DEV_TOOLING === "number"
22
+ ? stages.PROCESS_ASSETS_STAGE_DEV_TOOLING
23
+ : stages.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE) + 1;
17
24
 
18
25
  processAssetsHook.tap(pluginName, (compilation) => {
19
26
  compilation.hooks.processAssets.tapPromise({ name: pluginName, stage }, async (assets) => {