jso-protector 0.2.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,48 +1,66 @@
1
1
  # jso-protector
2
2
 
3
- Lightweight Node.js CLI wrapper for the JavaScript Obfuscator HTTP API.
4
-
5
- This package is intentionally dependency-free. It is designed to close the developer workflow gap with npm-first obfuscators while keeping JavaScript Obfuscator's existing hosted API, account plans, and dashboard API keys.
6
-
7
- ## Quick Start
8
-
9
- Install from the local workspace path:
3
+ Obfuscate and protect JavaScript as part of your build: a dependency-free CLI,
4
+ Node API, and plugins for webpack, Vite, Rollup, esbuild, Next.js, Metro, and
5
+ the rest of the toolchain.
10
6
 
11
7
  ```bash
12
- npm install --save-dev ./packages/jso-protector
13
- npx jso-protector --init
14
- npx jso-protector --init --init-template html-app --manifest dist-protected/jso-manifest.json
15
- npx jso-protector --init --init-template electron-app --input out --output out-protected
16
- npx jso-protector --init --init-template nextjs-app --manifest .next/static-protected/jso-manifest.json
17
- npx jso-protector --init --init-template vite-app --manifest dist-protected/jso-manifest.json
18
- npx jso-protector --init --init-template parcel-app --manifest dist-protected/jso-manifest.json
19
- npx jso-protector --init --init-template bun-app --manifest dist-protected/jso-manifest.json
20
- npx jso-protector --init --init-template browserify-app --manifest dist-protected/jso-manifest.json
21
- npx jso-protector --init --init-template turbopack-app --manifest .next/static-protected/jso-manifest.json
8
+ npm install --save-dev jso-protector
9
+ npx jso-protector --input dist --output dist-protected
22
10
  ```
23
11
 
24
- For another app in the same workspace, pin the local dependency with a `file:` path:
12
+ That protects every JavaScript file in `dist/` and writes the result to
13
+ `dist-protected/`. Nothing else in your build has to change.
25
14
 
26
- ```json
27
- {
28
- "devDependencies": {
29
- "jso-protector": "file:../packages/jso-protector"
30
- }
31
- }
32
- ```
15
+ ## What you need
16
+
17
+ An API key and password from your [javascriptobfuscator.com](https://javascriptobfuscator.com/)
18
+ dashboard, passed as `--api-key` / `--api-password` or read from the
19
+ `JSO_API_KEY` and `JSO_API_PASSWORD` environment variables. Run
20
+ `npx jso-protector --doctor` to check credentials, paths, and file matching
21
+ before you wire it into CI.
22
+
23
+ ## Already using another obfuscator?
33
24
 
34
- For internal sharing without publishing to npm, create a tarball and install that artifact inside the consuming project:
25
+ Bring your configuration with you rather than rewriting it:
35
26
 
36
27
  ```bash
37
- npm pack --json
38
- npm install --save-dev path/to/jso-protector-0.2.0.tgz
28
+ npx jso-protector --migrate-javascript-obfuscator javascript-obfuscator.json --output jso.config.json
29
+ npx jso-protector --migrate-js-confuser js-confuser.config.cjs --output jso.config.json
39
30
  ```
40
31
 
41
- Keep local tarballs inside internal storage or build artifacts, not in public package registries.
32
+ `--list-migration-map` prints how each option maps, `--explain-compat <option>`
33
+ explains a single one, and `--competitor-gap-report` prints covered, partial,
34
+ and missing parity against common JavaScript obfuscators.
35
+
36
+ ## What this gives you that a static transform does not
37
+
38
+ - **Protect on your own machine.** `--local` runs the bundled `jso-local`
39
+ executable instead of sending source to the hosted API.
40
+ - **Reproducible when you need it.** `--seed <value>` makes the same input,
41
+ options, and seed produce byte-identical output; omit it for the default
42
+ per-build polymorphic output.
43
+ - **Evidence you can hand to a reviewer.** `--ai-resistance-evidence`,
44
+ `--source-map-evidence`, `--vm-proof-pack`, `--deployment-hygiene-evidence`,
45
+ and `--runtime-incident-evidence` turn a build into a written report.
46
+ - **Presets instead of forty switches.** `--preset standard|balanced|maximum`,
47
+ or import a preset exported from the online tool with `--web-preset`.
48
+ - **Different profiles in one build.** `namedSets` maps file globs to their own
49
+ preset and options, so a checkout flow can ship maximum protection while
50
+ marketing pages stay on standard.
51
+
52
+ Full option reference: [Docs / npm CLI](https://javascriptobfuscator.com/docs/npmcli.aspx)
53
+ and [Docs / npm options](https://javascriptobfuscator.com/docs/npmoptions.aspx).
42
54
 
43
- The package is intentionally local-only: `private:true`, `UNLICENSED`, and `prepublishOnly` block accidental npm publishing.
55
+ ## Quick Start
44
56
 
45
- `--init` supports starter templates for common release patterns:
57
+ ```bash
58
+ npm install --save-dev jso-protector
59
+ npx jso-protector --init
60
+ ```
61
+
62
+ `--init` writes a starter `jso.config.json`. It supports templates for common
63
+ release layouts:
46
64
 
47
65
  - `browser-app`: default browser build output in `dist/`
48
66
  - `html-app`: browser build output plus marked inline HTML/template script protection
@@ -58,28 +76,13 @@ The package is intentionally local-only: `private:true`, `UNLICENSED`, and `prep
58
76
  - `turbopack-app`: Next.js Turbopack production client chunks in `.next/static/` with `chunks/*.js` and nested `chunks/**/*.js` targeting
59
77
  - `react-native-app`: Metro/Expo release bundle outputs with mobile-oriented optimization defaults
60
78
 
61
- You can combine `--init` with normal config flags to scaffold a closer first draft:
79
+ Combine `--init` with normal flags to scaffold a closer first draft:
62
80
 
63
81
  ```bash
64
82
  npx jso-protector --init --init-template node-app --input build --output build-protected --manifest build-protected/jso-manifest.json
65
- ```
66
-
67
- For Electron Forge, Electron Builder, or custom desktop packaging flows that emit a release folder, start with the dedicated Electron scaffold:
68
-
69
- ```bash
70
83
  npx jso-protector --init --init-template electron-app --input out --output out-protected --manifest out-protected/jso-manifest.json
71
- ```
72
-
73
- For framework-specific release folders, start with the dedicated Next.js, Vite/Webpack-family, Turbopack, or React Native aliases:
74
-
75
- ```bash
76
84
  npx jso-protector --init --init-template next --manifest .next/static-protected/jso-manifest.json
77
85
  npx jso-protector --init --init-template vite --manifest dist-protected/jso-manifest.json
78
- npx jso-protector --init --init-template parcel --manifest dist-protected/jso-manifest.json
79
- npx jso-protector --init --init-template bun --manifest dist-protected/jso-manifest.json
80
- npx jso-protector --init --init-template browserify --manifest dist-protected/jso-manifest.json
81
- npx jso-protector --init --init-template webpack --manifest dist-protected/jso-manifest.json
82
- npx jso-protector --init --init-template rspack --manifest dist-protected/jso-manifest.json
83
86
  npx jso-protector --init --init-template turbopack --manifest .next/static-protected/jso-manifest.json
84
87
  npx jso-protector --init --init-template expo --input dist --output dist-protected
85
88
  ```
@@ -209,7 +212,7 @@ npx jso-protector compliance pci-dss-v4 \
209
212
  --manifest dist-protected/jso-manifest.json.sig \
210
213
  --root dist-protected \
211
214
  --watermark-key "$JSO_WATERMARK_KEY" \
212
- --beacon-url "https://www.javascriptobfuscator.com/v1/runtime/beacon.ashx" \
215
+ --beacon-url "https://javascriptobfuscator.com/v1/runtime/beacon.ashx" \
213
216
  --siem splunk-hec \
214
217
  --script-inventory reports/payment-script-inventory.json \
215
218
  --script-inventory-audit reports/payment-script-inventory-audit.json \
@@ -311,15 +314,20 @@ internal remediation.
311
314
 
312
315
  ## Payment and API Access
313
316
 
314
- `jso-protector` is a localhost developer client for the paid JavaScript Obfuscator hosted API. The npm package does not unlock protection by itself and does not contain payment logic.
317
+ `jso-protector` is a localhost developer client for the paid JavaScript Obfuscator service: it drives the hosted API by default, or the bundled `jso-local` protector with `--local`. The npm package does not unlock protection by itself and does not contain payment logic.
315
318
 
316
319
  Payment and account enforcement stay on `javascriptobfuscator.com`:
317
320
 
318
321
  1. The user buys a plan or credits on the JavaScript Obfuscator website.
319
322
  2. The dashboard provides `JSO_API_KEY` and `JSO_API_PASSWORD`.
320
- 3. The local npm CLI sends selected JavaScript to the configured HTTPS API endpoint.
323
+ 3. By default the local npm CLI sends selected JavaScript to the configured HTTPS API endpoint.
321
324
  4. The hosted API validates the account, plan, limits, and credentials before returning protected code.
322
325
 
326
+ With `--local` the source body stays on the build machine and step 3 does not
327
+ happen, but entitlement is still enforced server-side: the run makes a
328
+ source-free plan/option check before protecting. Either way, billing and plan
329
+ limits live on the server, never in this package.
330
+
323
331
  Keep billing, entitlement checks, plan limits, and API secrets on the server side. The local npm package should only read credentials from environment variables or config and call the API.
324
332
 
325
333
  If the hosted API rejects a request, the CLI reports dashboard credential hints for authentication failures and account/plan/credit guidance for entitlement failures. API keys and passwords are redacted from error messages before they reach terminal logs.
@@ -525,7 +533,25 @@ Use `obfuscate(code, options, fileName)` and `obfuscateMultiple(sourceCodesObjec
525
533
 
526
534
  The Node API accepts common `javascript-obfuscator` option names directly and maps them to the closest hosted API options. Supported compatibility keys include `optionsPreset`, `parseHtml`, `stringArray`, `stringArrayEncoding`, `controlFlowFlattening`, `deadCodeInjection`, `deadCodeInjectionThreshold`, `identifierNamesGenerator`, `renameGlobals`, `renameProperties`, `reservedNames`, `domainLock`, `compact`, and `target`. Use `translateJavascriptObfuscatorOptions(sourceOptions, overrides)` when you want to inspect or reuse the mapped config before calling the API.
527
535
 
528
- For JS-Confuser migration scripts, pass a `jsConfuserOptions` object or call `translateJsConfuserOptions(sourceOptions, overrides)` first. The Node API also detects common top-level JS-Confuser options directly, including `lock.domainLock` and `lock.endDate`, so existing build scripts can migrate with smaller edits. Current direct mappings cover common presets plus `target`, `renameVariables`, `renameGlobals`, `globalConcealing`, `stringEncoding`, `stringConcealing`, `duplicateLiteralsRemoval`, `stringCompression`, `compact`, `minify`, `controlFlowFlattening`, `deadCode`, `identifierGenerator`, `lock.domainLock`, and `lock.endDate`. Review-only runtime locks such as `lock.antiDebug`, `lock.integrity`, `lock.selfDefending`, `lock.startDate`, `lock.countermeasures`, and `lock.tamperProtection` are preserved as `jsConfuserLock*` fields in translated config objects so migration tooling can carry them forward for manual follow-up instead of dropping them silently.
536
+ `stringArrayIndexShift` maps approximately to native `StringArrayIndexShift`: enabled builds use a deterministic nonzero one-slot offset in plain and encrypted string tables. This does not reproduce the competitor's randomized shift magnitude, so validate the protected build in its target runtime.
537
+
538
+ `stringArrayShuffle` maps directly to native `StringArrayShuffle`. It randomizes unique moved-string order and preserves every lookup across plain, encrypted, shifted, and self-compressed output. Default builds use fresh entropy; `Seed` makes the shuffle reproducible.
539
+
540
+ `stringArrayRotate` maps directly to native `StringArrayRotate`. It cyclically rotates multi-value tables by a nonzero per-build offset and rewrites every lookup. Rotation uses an independent entropy stream, composes with shuffle/index shifting/encryption, and is reproducible under `Seed`.
541
+
542
+ `stringArrayIndexesType` maps directly to native `StringArrayIndexesType`. Use `hexadecimal-number`, `hexadecimal-numeric-string`, or both. Numeric strings are explicitly coerced before array access; mixed lists select a type per lookup and become reproducible when `Seed` is supplied.
543
+
544
+ `stringArrayThreshold` maps directly to native `StringArrayThreshold`. It accepts 0 through 1 and makes one stable decision per unique eligible literal. Zero keeps all literals verbatim, one moves all eligible literals, duplicates stay consistent, and `Seed` makes partial selection reproducible.
545
+
546
+ `stringArrayCallsTransform` maps directly to native secondary index-table indirection, with `stringArrayCallsTransformThreshold` controlling per-lookup probability from 0 through 1. Selected calls become nested table lookups, the default threshold is 0.5, and `Seed` makes selection reproducible. The transform composes with all native moved-string storage and output modes.
547
+
548
+ String-array wrapper controls generate bounded root-level aliases or multi-parameter functions. Counts are limited to 0-10, function parameters to 2-5, and chaining can route each wrapper through its predecessor. The count mapping is approximate: unlike the competitor's per-function-scope placement, JSO keeps wrappers at the protected root. Selection and noise parameters are reproducible under `Seed`.
549
+
550
+ `transformObjectKeys` maps approximately to native safe data-key transformation. Identifier and quoted data keys become computed moved-string lookups; numeric keys, methods/accessors, shorthand-sensitive members, and `__proto__` stay literal to avoid changing property and prototype behavior.
551
+
552
+ For JS-Confuser migration scripts, pass a `jsConfuserOptions` object or call `translateJsConfuserOptions(sourceOptions, overrides)` first. The Node API also detects common top-level JS-Confuser options directly, including the `lock` bag, so existing build scripts can migrate with smaller edits. In addition to common transform and date/domain settings, `lock.antiDebug`, `lock.integrity`, `lock.selfDefending`, and `lock.tamperProtection` map to `DebugProtection`, `SelfDefending`, and `AntiMonkeyPatching`; `lock.startDate` maps to the native activation boundary. These runtime mappings are approximate: JS-Confuser numeric probabilities collapse to enabled/disabled and vendor-specific detection behavior still requires protected-browser testing. Arbitrary `lock.countermeasures` and custom locks remain review-only rather than being executed or guessed.
553
+
554
+ JS-Confuser `stringSplitting` also maps approximately to native `SplitStrings`. Boolean values map directly; numeric probabilities greater than zero enable splitting because the native engine does not reproduce per-literal probability scheduling. Custom selector functions require manual migration review and are never executed by translation tooling.
529
555
 
530
556
  `getOptionsByPreset("standard" | "balanced" | "maximum")` returns a copy of the hosted API preset options for scripts that previously used preset lookup helpers.
531
557
 
@@ -897,7 +923,7 @@ The Browserify, esbuild, Vite, Rollup, Webpack, Webpack loader, Gulp, and Grunt
897
923
  ```json
898
924
  {
899
925
  "$schema": "./node_modules/jso-protector/jso.config.schema.json",
900
- "endpoint": "https://www.javascriptobfuscator.com/HttpApi.ashx",
926
+ "endpoint": "https://javascriptobfuscator.com/HttpApi.ashx",
901
927
  "apiKey": "$JSO_API_KEY",
902
928
  "apiPassword": "$JSO_API_PASSWORD",
903
929
  "projectName": "browser-release",
@@ -930,13 +956,19 @@ The Browserify, esbuild, Vite, Rollup, Webpack, Webpack loader, Gulp, and Grunt
930
956
 
931
957
  The package includes `jso.config.schema.json` for editor autocomplete and validation. Generated configs point to `./node_modules/jso-protector/jso.config.schema.json`; the in-package example points to `./jso.config.schema.json`.
932
958
 
933
- For common product features that otherwise require raw HTTP API option names, the config also supports convenience aliases such as `keepHeaderComment`, `protectObjectDeclaration`, `moveNestedFunction`, `formattedOutput`, `keepIndent`, `lineNumbers`, `lockDomainSubdomains`, `lockDomainMessage`, `lockDate`, `lockDateValue`, and `lockDateMessage`. These map to the corresponding `options.*` values before explicit `options` overrides are applied.
959
+ For common product features that otherwise require raw HTTP API option names, the config also supports convenience aliases such as `keepHeaderComment`, `protectObjectDeclaration`, `moveNestedFunction`, `formattedOutput`, `keepIndent`, `lineNumbers`, `lockDomainSubdomains`, `lockDomainMessage`, `lockDate`, `lockDateValue`, and `lockDateMessage`. Runtime-defense aliases include `selfDefendingIntervalSeconds`, `selfHealing`, `selfHealingMaxAttempts`, `antiMonkeyPatching`, `antiMonkeyPatchingCleanRealm`, `antiMonkeyPatchingIncludeGlobals`, `antiMonkeyPatchingExcludeGlobals`, `runtimeDefenseAction`, `runtimeDefenseCallback`, and `runtimeDefenseRedirectUrl`. These map to the corresponding `options.*` values before explicit `options` overrides are applied. The CLI also exposes `--self-defending-interval-seconds`, `--self-healing`, `--self-healing-max-attempts`, `--anti-monkey-patching`, `--anti-monkey-patching-clean-realm`, `--runtime-defense-action`, `--runtime-defense-callback`, and `--runtime-defense-redirect-url`. Keep bearer beacon tokens in environment-backed configuration or raw options rather than command-line history. Self-defending intervals accept 1 through 86,400 seconds and use the protected page scheduler. Self-defending, self-healing, and anti-monkey-patching wrappers use JavaScript dynamic evaluation (`eval` and/or the `Function` constructor), so deployed CSP must permit it (commonly `script-src 'unsafe-eval'`); leave them disabled where that CSP relaxation is unacceptable.
960
+
961
+ Runtime wrappers apply to classic scripts. ES modules are protected without those wrappers so `import`/`export` linking stays valid. Classic-script top-level `var` globals are preserved, but cross-script top-level `let`, `const`, and `class` bindings are not; bundle dependent scripts or leave Self-Defending disabled for that contract.
934
962
 
935
963
  `--config` accepts JSON files plus trusted CommonJS or ES module config files. When no config path is provided, the CLI looks for `jso.config.json`, then `jso.config.cjs`, then `jso.config.mjs`, then `jso.config.js`.
936
964
 
937
965
  `--mode <name>` passes a release mode into JavaScript config functions. Use it when production, staging, or tenant-specific builds need different include/exclude rules, presets, or output folders without duplicating config files. When `--mode` is omitted, JavaScript config loaders fall back to `NODE_ENV` when it is set.
938
966
 
939
- Config files can also carry mapped `javascript-obfuscator` compatibility keys during migration, including `optionsPreset`, `stringArray`, `stringArrayEncoding`, `controlFlowFlattening`, `deadCodeInjection`, `identifierNamesGenerator`, `renameGlobals`, `renameProperties`, `domainLock`, `compact`, `target`, `parseHtml`, and `ignoreImports`. `optionsPreset` also accepts the current `vm-default`, `vm-low-obfuscation`, `vm-medium-obfuscation`, `vm-high-obfuscation`, `vm-ultra-high-obfuscation`, and `vm-anti-llm` aliases, mapped to the closest hosted preset for starter migration. Review-only compatibility fields such as `selfDefending`, `sourceMap`, `identifiersDictionary`, `identifiersPrefix`, `reservedStrings`, `splitStrings`, `seed`, and `numbersToExpressions` are also accepted in config files so existing configs do not fail immediately; `validate-config` reports them as warnings because the hosted API has no one-to-one local mapping. Explicit `options` values still win, so teams can keep a familiar starter config and override exact hosted API fields as they tune release output.
967
+ Config files can also carry mapped `javascript-obfuscator` compatibility keys including `splitStrings` and `splitStringsChunkLength`. These map directly to native fixed-length literal splitting; valid chunk lengths are 1-1024 and the default is 10. Directives, reserved literals, object keys, template segments, dynamic-import/static-require specifiers, mixed-server markers, and Unicode surrogate pairs are preserved, and splitting composes with enabled move/encode transforms. Runtime guards, deterministic seeds, string-selection patterns, string-array shuffle/rotation/index/call controls, and wrapper type/chaining/parameter controls also map directly; wrapper count and safe object-key transformation map approximately. `numbersToExpressions` remains an approximate mapping to `EncodeNumbers`. Source maps, identifier dictionaries/prefixes, rename mode, simplify, and strict-mode workflow policy remain review-only. Explicit `options` values still win over compatibility keys.
968
+
969
+ The config migration maps deterministic seed, and string-selection patterns map directly; a fixed seed reduces per-build polymorphism and is not a security control. Matching reserved literals remain verbatim outside `MoveStrings` and `EncodeStrings`.
970
+
971
+ Quoted class method, accessor, and field names are also definition-site literals and remain intact; only their ordinary string values and safe expression uses are eligible for splitting.
940
972
 
941
973
  ```js
942
974
  module.exports = ({ env, mode }) => ({
@@ -987,6 +1019,37 @@ Use `reservedNames` to preserve public API names, framework entry points, global
987
1019
  }
988
1020
  ```
989
1021
 
1022
+ ## Named Configuration Sets
1023
+
1024
+ Apply a different protection profile to different parts of one app in a
1025
+ single build with `namedSets`. Each set names an array of `match` globs and
1026
+ any of `preset`, `options`, and `countermeasures`; the first matching set
1027
+ wins per file (write sets in priority order), a set's options merge on top of
1028
+ the baseline, a set's preset contributes that preset's option block before
1029
+ the set's own options, and files matching no set keep the baseline exactly.
1030
+ Each set runs as its own API round, so a set your plan cannot afford fails
1031
+ only its own group.
1032
+
1033
+ ```json
1034
+ {
1035
+ "preset": "balanced",
1036
+ "namedSets": {
1037
+ "checkout": {
1038
+ "match": ["src/checkout/**", "src/wallet/**"],
1039
+ "preset": "maximum",
1040
+ "options": { "DeadcodeLevel": "High" }
1041
+ },
1042
+ "marketing": {
1043
+ "match": ["src/marketing/**"],
1044
+ "preset": "standard"
1045
+ }
1046
+ }
1047
+ }
1048
+ ```
1049
+
1050
+ The JSON summary reports the per-set grouping under `namedSetGroups`, and the
1051
+ manifest spans every group.
1052
+
990
1053
  ## Online Presets
991
1054
 
992
1055
  The online obfuscator can export a JSON preset for Standard options, premium preview features, and the Variable Exclusion List. Use it directly during a dry run or in a CI config:
@@ -1079,17 +1142,19 @@ When replacing existing `javascript-obfuscator` package scripts, the CLI accepts
1079
1142
 
1080
1143
  `--seed <value>` requests a reproducible build: the same input, options, and seed produce byte-identical protected output. Omit it for the default per-build polymorphic output (each build differs, which is what you usually want in production). An integer seed is used directly; any other string folds to a stable value. It maps to the engine `Seed` option, so `--option Seed=<value>`, a config `seed` key, and `options.Seed` are equivalent. Keep seed values out of shared logs, and note that a fixed seed makes builds diffable but is not itself a security control.
1081
1144
 
1082
- The CLI also accepts common review-only flags such as `--source-map`, `--source-map-sources-mode`, `--identifier-names-cache`, `--identifier-names-cache-path`, `--identifiers-dictionary`, `--identifiers-prefix`, `--self-defending`, `--debug-protection`, `--disable-console-output`, `--reserved-strings`, `--rename-properties-mode`, `--strict-mode`, `--numbers-to-expressions`, `--simplify`, `--split-strings`, and string-array wrapper/index flags so older scripts do not fail immediately. `--ignore-imports` is handled directly and preserves import/export-from statements plus common static `require()` and `import()` statements before the remaining code is protected. Other review-only flags emit compatibility warnings when there is no one-to-one hosted API mapping.
1145
+ The CLI maps runtime-defense flags plus `--split-strings` and `--split-strings-chunk-length` directly to hosted engine options. String chunks are bounded to 1-1024 characters (default 10), with syntax-sensitive literals preserved. String-array shuffle, rotation, index representation, call indirection, wrapper type/chaining/parameter controls, and thresholds map to native controls; index shift, wrapper count, and safe object-key transformation retain documented approximation boundaries. `--numbers-to-expressions` maps approximately to native `EncodeNumbers`. Source-map, identifier-cache/dictionary, rename-mode, strict-mode, and simplify workflow fields remain review-only. `--ignore-imports` is handled directly. Review-only flags emit compatibility warnings and vendor-specific runtime semantics still need runtime validation.
1146
+
1147
+ Specifically, it maps `--self-defending`, `--debug-protection`, `--debug-protection-interval`, `--disable-console-output`, and `--domain-lock-redirect-url` directly.
1083
1148
 
1084
1149
  Use `--version` for a quick CLI parity check in scripts. Add `--json` to print package metadata and the default hosted API endpoint.
1085
1150
 
1086
1151
  Use `--list-presets` and `--list-options` to inspect available presets and commonly used HTTP API options. Add `--list-migration-map --json` to inspect `javascript-obfuscator` option migration coverage before converting a config. The migration map includes mapped, direct, approximate, review-only, and total known option counts for migration tooling. Use `--explain-compat <option>` when one migrated option needs a human-readable answer before you edit a build script.
1087
1152
 
1088
- Use `--compat-scan` before protection when you want a local source scan for common runtime reflection hazards such as `Function.prototype.toString.call(...)`, `.constructor.name`, and `.name` access that may change after obfuscation. The scan is heuristic and warning-oriented, but it catches the same class of issues competitor docs often call out explicitly. Add `--json` for machine-readable CI output.
1153
+ Use `--compat-scan` before protection when you want a local source scan for public browser-global contracts and common runtime reflection hazards. It recognizes classic distributions shaped like `var Library = function (...)` plus direct `window`, `globalThis`, or `self` assignments, and returns an anchored `suggestedVariableExclusion` for each public name so `RenameGlobals` does not break script-tag consumers. It also detects `Function.prototype.toString.call(...)`, `.constructor.name`, and `.name` access that may change after obfuscation. The scan is heuristic and warning-oriented; runtime-test the protected distribution and review each suggested exclusion before release. Add `--json` for machine-readable CI output.
1089
1154
 
1090
- ### AI precheck — gate the obfuscation API call on AI compat-check findings
1155
+ ### AI precheck 鈥?gate the obfuscation API call on AI compat-check findings
1091
1156
 
1092
- Use `--ai-precheck` to fold the JSO AI `/v1/ai/compat-check` call into your existing obfuscation command. The CLI scans every resolved input file *before* the obfuscation API is called; if anything in your source would produce a broken protected build — `eval`, `Function` constructor, framework reflection traps, decorator metadata — the build aborts and your obfuscation quota is not touched.
1157
+ Use `--ai-precheck` to fold the JSO AI `/v1/ai/compat-check` call into your existing obfuscation command. The CLI scans every resolved input file *before* the obfuscation API is called; if anything in your source would produce a broken protected build 鈥?`eval`, `Function` constructor, framework reflection traps, decorator metadata 鈥?the build aborts and your obfuscation quota is not touched.
1093
1158
 
1094
1159
  ```sh
1095
1160
  # Single command, single round-trip. Add to any CI step you already run:
@@ -1105,14 +1170,14 @@ Gate levels for `--ai-precheck-fail-on`:
1105
1170
  - `warning`: build aborts on any error or warning finding (paranoid mode).
1106
1171
  - `never`: print findings, never fail (advisory mode).
1107
1172
 
1108
- For projects that want to run the gate stand-alone — pre-commit hooks, IDE integrations, ad-hoc audits — use the companion sub-command:
1173
+ For projects that want to run the gate stand-alone 鈥?pre-commit hooks, IDE integrations, ad-hoc audits 鈥?use the companion sub-command:
1109
1174
 
1110
1175
  ```sh
1111
1176
  jso ai compat-scan --config jso.config.json --fail-on error
1112
1177
  jso ai compat-scan --config jso.config.json --max-files 50 # cap quota burn on huge repos
1113
1178
  ```
1114
1179
 
1115
- Both paths hit the same `/v1/ai/compat-check` endpoint. `--ai-precheck` just folds it into the obfuscation flow so CI doesn't need a second step. Requires a JSO API key with AI access — FreeTrial works for testing the wire format; Basic and up for production usage. See the [JSO AI quick start](https://www.javascriptobfuscator.com/Docs/AIQuickStart.aspx) for tier details.
1180
+ Both paths hit the same `/v1/ai/compat-check` endpoint. `--ai-precheck` just folds it into the obfuscation flow so CI doesn't need a second step. Requires a JSO API key with AI access 鈥?FreeTrial works for testing the wire format; Basic and up for production usage. See the [JSO AI quick start](https://javascriptobfuscator.com/Docs/AIQuickStart.aspx) for tier details.
1116
1181
 
1117
1182
  ### AI usage and BYO key health
1118
1183
 
@@ -1140,13 +1205,13 @@ if (usage.providerKey && usage.providerKey.status !== "ready") {
1140
1205
 
1141
1206
  The `AiProviderKeyHealth` shape reports provider, status label, last test, next stored-key test, rotation review, and recommended action. It does not return the provider secret or key suffix.
1142
1207
 
1143
- ### Pre-flight quota gate — `--estimate`
1208
+ ### Pre-flight quota gate 鈥?`--estimate`
1144
1209
 
1145
1210
  Add `--estimate` to any obfuscation command to do a cost check before submitting any source. The CLI walks your input file set, hits the existing `/v1/ai/usage` endpoint to read the current month's quota, and prints a CI-friendly report. The gate has three states:
1146
1211
 
1147
- - **OK** (exit 0) — quota healthy, build can proceed.
1148
- - **WARN** (exit 0) — fewer than 5 actions remaining OR cost cap below 20%. Print, don't block.
1149
- - **FAIL** (exit 1) — actions remaining = 0. Block the build before it consumes any more.
1212
+ - **OK** (exit 0) 鈥?quota healthy, build can proceed.
1213
+ - **WARN** (exit 0) 鈥?fewer than 5 actions remaining OR cost cap below 20%. Print, don't block.
1214
+ - **FAIL** (exit 1) 鈥?actions remaining = 0. Block the build before it consumes any more.
1150
1215
 
1151
1216
  ```sh
1152
1217
  jso-protector --config jso.config.json --estimate
@@ -1157,7 +1222,7 @@ Network failures on `/v1/ai/usage` downgrade to WARN with a note (don't crash th
1157
1222
 
1158
1223
  When the usage endpoint includes BYO provider-key health, `--estimate` also prints the source-free AI key state: provider, status label, next 30-day stored-key test due date, 90-day rotation review date, and recommended action. The JSON output exposes the same data under `estimate.providerKey` without returning the provider secret or key suffix, so CI can alert on missing, failed, stale, or rotation-review-due AI keys before a release run depends on provider-backed assistance.
1159
1224
 
1160
- ### Watermarking — anti-piracy + dispute proof
1225
+ ### Watermarking 鈥?anti-piracy + dispute proof
1161
1226
 
1162
1227
  `--watermark <tag> --watermark-key <secret>` injects an HMAC-SHA256-signed header comment at the top of every input file. The obfuscator's `KeepComment` option preserves it verbatim through every transform (string array moves, control-flow flattening, dead code, etc.), so the marker survives intact in the protected output. Holders of the secret can verify; everyone else sees an opaque comment block.
1163
1228
 
@@ -1178,11 +1243,11 @@ jso-protector --scan-watermarks dist-protected/ --watermark-key "$JSO_WATERMARK_
1178
1243
 
1179
1244
  Without `--watermark-key`, verifiers run in **lookup-only mode**: they print the embedded tag but skip the HMAC compare. Useful for forensic inspection of leaked artifacts where you don't (or shouldn't) ship the secret to the investigator.
1180
1245
 
1181
- Wire format is identical across the Node, Python (`jso_protector.watermark`), and .NET (`JsoProtector.Watermark`) clients — an artifact stamped by any verifies under any. Reads `JSO_WATERMARK_KEY` from env when the flag isn't passed.
1246
+ Wire format is identical across the Node, Python (`jso_protector.watermark`), and .NET (`JsoProtector.Watermark`) clients 鈥?an artifact stamped by any verifies under any. Reads `JSO_WATERMARK_KEY` from env when the flag isn't passed.
1182
1247
 
1183
1248
  Exit codes (`--scan-watermarks`): **0** all clean / **1** at least one invalid signature found / **2** no watermarks found at all.
1184
1249
 
1185
- ### Signed release attestations — SLSA-style
1250
+ ### Signed release attestations 鈥?SLSA-style
1186
1251
 
1187
1252
  `--sign-release <priv.pem>` produces an Ed25519-signed envelope alongside your existing `--manifest` file. The envelope covers BuildId, polymorphism fingerprint, release label, and per-file SHA-256 hashes:
1188
1253
 
@@ -1205,16 +1270,16 @@ jso-protector --verify-release dist-protected/build.manifest.json.sig \
1205
1270
 
1206
1271
  Two-stage verification:
1207
1272
 
1208
- - **Stage 1** — Ed25519 signature over canonical-JSON manifest (catches forgery + manifest tampering).
1209
- - **Stage 2** — re-hash every referenced file on disk and compare against the embedded SHA-256 (catches post-signing tampering of the actual artifacts). Triggered when `--verify-root <dir>` is supplied.
1273
+ - **Stage 1** 鈥?Ed25519 signature over canonical-JSON manifest (catches forgery + manifest tampering).
1274
+ - **Stage 2** 鈥?re-hash every referenced file on disk and compare against the embedded SHA-256 (catches post-signing tampering of the actual artifacts). Triggered when `--verify-root <dir>` is supplied.
1210
1275
 
1211
- Without `--public-key`, the envelope's embedded public key is trusted (signature-only verification). With it, embedded != trusted → fail fast (defeats key-substitution attacks).
1276
+ Without `--public-key`, the envelope's embedded public key is trusted (signature-only verification). With it, embedded != trusted 鈫?fail fast (defeats key-substitution attacks).
1212
1277
 
1213
- Ed25519 chosen for 64-byte signatures, 32-byte keys, fast verify, no key-size choices to fumble. Node has it built-in since v12 — zero new dependencies.
1278
+ Ed25519 chosen for 64-byte signatures, 32-byte keys, fast verify, no key-size choices to fumble. Node has it built-in since v12 鈥?zero new dependencies.
1214
1279
 
1215
1280
  Use `--migrate-javascript-obfuscator` to convert a common `javascript-obfuscator` JSON or trusted CommonJS config into a starter `jso.config.json`. The migration report maps familiar options where possible, lists review items for options that are not one-to-one, includes a per-config summary with source option, mapped, review-only, unmapped, and automatic coverage counts, and prints the next validate, dry-run, doctor, release-check, competitor-gap-report, and protect commands. When any review-only migration item is present, it adds a `migration-review` next command so release owners get one source-free checklist before approval. When source-map review items are present, it also adds the post-protect `source-map-evidence` next command. When identifier cache, custom dictionary, or runtime-defense review items are present, it also adds the `identifier-cache-review` or `runtime-defense-review` next command so release owners can generate focused source-free review packets immediately. CommonJS source configs execute as Node.js code, so only migrate configs from your own repository or another trusted source.
1216
1281
 
1217
- Use `--list-js-confuser-migration-map --json`, `--explain-js-confuser-compat <option>`, and `--migrate-js-confuser` when migrating from JS-Confuser. The current migration path maps common preset, lock, string, identifier, minify, and control-flow options into the closest hosted API settings. Review-only runtime lock features such as anti-debugging, integrity, self-defending, start-date gates, countermeasure hooks, and tamper protection are carried into generated config as `jsConfuserLock*` review fields so they remain visible during manual follow-up.
1282
+ Use `--list-js-confuser-migration-map --json`, `--explain-js-confuser-compat <option>`, and `--migrate-js-confuser` when migrating from JS-Confuser. The current migration path maps common preset, lock, string, identifier, minify, and control-flow options into the closest hosted API settings. Anti-debugging, integrity/self-defending, start-date, and tamper-protection locks map approximately to native runtime controls; numeric probability values become enabled/disabled switches. Countermeasure hooks and custom locks remain visible review-only items.
1218
1283
 
1219
1284
  Use `--release-check --json` as the default CI preflight before protection. It runs config validation, dry-run file planning, and doctor checks in one report without sending source code to the API unless you also pass `--check-api`. The plan includes the number of API items plus any transformed files created from marked HTML scripts or conditional regions. Add `--strict` when warnings, such as unknown option names or not-yet-created output folders, should fail the release job.
1220
1285
 
@@ -1248,7 +1313,27 @@ console.log("protect this algorithm");
1248
1313
  console.log("keep this exact local code too");
1249
1314
  ```
1250
1315
 
1251
- Use `--local-only` when source cannot leave the build machine or when a teammate needs a quick reminder of the local package install path. The npm CLI can run validation, dry-run planning, doctor checks, release-check reports, and competitor gap reports locally, but actual npm CLI and desktop protection use the hosted service. Current protection workflows do not meet a policy that forbids source transfer. The command also reports that this package is local-only as a distribution artifact, not published to npm, and should be installed from a workspace path, `file:` dependency, or internal `npm pack` tarball.
1316
+ Use `--local-only` when a teammate needs a quick reminder of which commands avoid the network: validation, dry-run planning, doctor checks, release-check reports, and competitor gap reports all run locally. The command also reports that this package is local-only as a distribution artifact, not published to npm, and should be installed from a workspace path, `file:` dependency, or internal `npm pack` tarball.
1317
+
1318
+ ### `--local`: protect without sending source
1319
+
1320
+ `--local` protects on the build machine instead of POSTing source to the hosted API. It runs the `jso-local` executable that ships in the [Windows desktop download](https://javascriptobfuscator.com/downloads.aspx) under `cli/jso-local.exe`:
1321
+
1322
+ ```bash
1323
+ jso-protector --config jso.config.json --local
1324
+ jso-protector --config jso.config.json --local --local-exe "C:\Tools\JSObfuscator\cli\jso-local.exe"
1325
+ ```
1326
+
1327
+ The executable is found via `--local-exe`, then `JSO_LOCAL_EXE`, then the usual desktop install locations. Config equivalents are `"local": true` and `"localExe"`.
1328
+
1329
+ State it accurately when a reviewer asks:
1330
+
1331
+ - **Your source stays on the machine.** The request body is written to a temporary file, handed to `jso-local`, and deleted after the run.
1332
+ - **A source-free plan check still goes online.** Local Advanced is a paid capability, so the same short entitlement call the desktop app makes runs first, carrying only your credentials and a handful of plan-gated option switches. Fully disconnected operation is not available yet.
1333
+ - **Windows only**, because the executable ships in the Windows desktop archive.
1334
+ - **VM bytecode protection is refused, not silently dropped.** It runs in a server-side virtualizer; a `--local` build that requested it fails with a clear message instead of quietly shipping weaker output.
1335
+
1336
+ Everything downstream is unchanged: the same options, manifests, evidence packets, and size budgets apply, because the local path exchanges the same request and response shapes the hosted endpoint uses.
1252
1337
 
1253
1338
  Use `--validate-config --json` to check config shape, endpoint format, credentials presence, credential storage, path settings, budget values, and local option-name references without sending source code to the API. Unknown option names are reported as warnings so teams can catch typos while still using advanced HTTP API options. Inline `apiKey`, `apiPassword`, `--api-key`, and `--api-password` values also warn; prefer `$JSO_API_KEY` and `$JSO_API_PASSWORD` environment references so dashboard credentials do not land in committed config, shell history, or process logs.
1254
1339
 
@@ -1278,7 +1363,15 @@ Use `--max-output-bytes` / `"maxOutputBytes"` and `--max-growth-ratio` / `"maxGr
1278
1363
 
1279
1364
  ## Package Verification
1280
1365
 
1281
- Before publishing or tagging a release, run the install verification smoke:
1366
+ For ordinary development, run the deterministic verification chain with `npm run verify`. Before publishing or tagging an engine release, run the heavier release gate:
1367
+
1368
+ ```bash
1369
+ npm run verify:release
1370
+ ```
1371
+
1372
+ The release gate first runs every ordinary check, then regenerates protected output for the complete real-library corpus and compares the supported runtime samples against the freshly protected files. Do not run `verify:corpus-runtime` by itself as release evidence: it consumes the existing `tools/corpus-protect/.build/emitted` directory and therefore does not prove that the current engine produced those artifacts.
1373
+
1374
+ To check only package installation behavior, run:
1282
1375
 
1283
1376
  ```bash
1284
1377
  npm run verify:package
@@ -1327,7 +1420,7 @@ jso-protector --config jso.config.json --doctor --json
1327
1420
 
1328
1421
  `doctor` now includes a local compatibility scan summary. Run `jso-protector --config jso.config.json --compat-scan --json` when you need the detailed file-and-line findings before a release.
1329
1422
 
1330
- When a config still carries competitor-only migration fields such as source-map flags, identifier cache paths, custom naming dictionaries, or JS-Confuser runtime lock notes, `validate-config`, `doctor`, and `release-check` now emit grouped `limitations` entries in JSON output and `LIMITATION ...` lines in text output so CI can surface the remaining manual-review items explicitly.
1423
+ When a config still carries competitor-only migration fields such as source-map flags, identifier cache paths, custom naming dictionaries, or JS-Confuser custom countermeasure notes, `validate-config`, `doctor`, and `release-check` emit grouped `limitations` entries in JSON output and `LIMITATION ...` lines in text output so CI can surface the remaining manual-review items explicitly.
1331
1424
 
1332
1425
  Run the standalone competitor gap report when you want a machine-readable parity summary for migrated configs:
1333
1426
 
@@ -1460,6 +1553,41 @@ jobs:
1460
1553
  dist-protected/jso-manifest.json
1461
1554
  ```
1462
1555
 
1556
+ ## Working from a local checkout
1557
+
1558
+ Published releases install from the registry with
1559
+ `npm install --save-dev jso-protector`. The paths below are for building the
1560
+ package from a checkout of this repository — internal testing, a release
1561
+ candidate, or an air-gapped install.
1562
+
1563
+ Install the workspace copy directly:
1564
+
1565
+ ```bash
1566
+ npm install --save-dev ./packages/jso-protector
1567
+ ```
1568
+
1569
+ Or pin it from another app in the same workspace:
1570
+
1571
+ ```json
1572
+ {
1573
+ "devDependencies": {
1574
+ "jso-protector": "file:../packages/jso-protector"
1575
+ }
1576
+ }
1577
+ ```
1578
+
1579
+ For internal sharing without going through the registry, build a tarball and
1580
+ install that artifact in the consuming project:
1581
+
1582
+ ```bash
1583
+ npm pack --json
1584
+ npm install --save-dev path/to/jso-protector-0.4.0.tgz
1585
+ ```
1586
+
1587
+ Keep those tarballs in internal storage or build artifacts. `prepublishOnly`
1588
+ runs the full verification chain before any real publish, so a release cannot
1589
+ go out on an unverified tree.
1590
+
1463
1591
  ## Release Checklist
1464
1592
 
1465
1593
  1. Build unprotected JavaScript into a temporary output folder.
package/RELEASE.md CHANGED
@@ -1,82 +1,75 @@
1
- # Local Package Guide
1
+ # Release Guide
2
2
 
3
- This package is intentionally local-only. Keep `"private": true` and `"license": "UNLICENSED"` in `package.json` unless the product owner explicitly approves a public npm release later.
3
+ `jso-protector` is a published npm package. It is the developer-workflow front
4
+ end for JavaScript Obfuscator: protection itself runs through the hosted HTTP
5
+ API with the user's own dashboard credentials, or on their machine with
6
+ `--local`.
4
7
 
5
- ## Local Metadata Policy
8
+ ## Metadata Policy
6
9
 
7
- | Field | Required local value | Reason |
10
+ | Field | Value | Reason |
8
11
  | --- | --- | --- |
9
- | npm name | `jso-protector` | Local workspace/package name only; not reserved or published on npm. |
10
- | registry access | `"private": true` | Blocks accidental `npm publish`. |
11
- | license | `UNLICENSED` | Makes the package private/internal by default. |
12
- | credentials | Environment variables only | Keeps API credentials out of package files and logs. |
12
+ | npm name | `jso-protector` | Published name on the public registry. |
13
+ | license | `SEE LICENSE IN LICENSE` | Proprietary; the LICENSE file ships in the tarball. |
14
+ | credentials | Environment variables or CLI flags only | Keeps API credentials out of package files and logs. |
13
15
  | payment enforcement | Hosted API only | Keeps billing, account status, credits, and plan limits on the server. |
14
16
 
15
- ## Payment Model
17
+ Do not add billing logic, shared API keys, account secrets, or plan-limit
18
+ decisions to this package. The server must reject unpaid, expired, disabled, or
19
+ over-limit accounts.
16
20
 
17
- Use npm only as the local developer workflow. Users still need a paid JavaScript Obfuscator account because protection calls go to the hosted HTTP API with dashboard credentials.
18
-
19
- Do not add billing logic, shared API keys, account secrets, or plan-limit decisions to this package. The server must reject unpaid, expired, disabled, or over-limit accounts.
20
-
21
- ## Local Verification
22
-
23
- Use the package from another local project with either a workspace path:
24
-
25
- ```bash
26
- npm install --save-dev ../packages/jso-protector
27
- ```
28
-
29
- or a `file:` dependency:
30
-
31
- ```json
32
- {
33
- "devDependencies": {
34
- "jso-protector": "file:../packages/jso-protector"
35
- }
36
- }
37
- ```
38
-
39
- For internal handoff, create a tarball and install it directly in the consuming app:
40
-
41
- ```bash
42
- npm pack --json
43
- npm install --save-dev path/to/jso-protector-0.2.0.tgz
44
- ```
45
-
46
- Run the offline test suite:
21
+ ## Verification before any release
47
22
 
48
23
  ```bash
49
- npm test
24
+ npm test # offline suite
25
+ npm run smoke # package smoke
26
+ npm run verify:package # packaged contents + documentation contract
27
+ npm run verify:publish-metadata # license, files, metadata policy
28
+ npm run verify # everything, ~10 minutes
50
29
  ```
51
30
 
52
- Run the package smoke check:
53
-
54
- ```bash
55
- npm run smoke
56
- npm run verify:package
57
- ```
58
-
59
- Run the local-only metadata check:
60
-
61
- ```bash
62
- npm run verify:publish-metadata
63
- ```
64
-
65
- Run everything:
66
-
67
- ```bash
68
- npm run verify
69
- ```
70
-
71
- With test credentials only, run the live API preflight:
31
+ With test credentials only, the live API preflight:
72
32
 
73
33
  ```bash
74
34
  npm run smoke:api
75
35
  jso-protector --config jso.config.example.json --doctor --check-api --json
76
36
  ```
77
37
 
78
- ## Publish Guard
79
-
80
- The `prepublishOnly` script runs `ci/verify-publish-metadata.js` without the local-only allowance and blocks `npm publish`. `npm run verify:publish-ready` should fail while this package remains local-only.
81
-
82
- If a public npm release is ever approved, treat that as a separate product decision: choose a final package name/scope, approve a public license, add repository and support metadata, remove `private:true`, and rerun `npm run verify:publish-ready`.
38
+ `prepublishOnly` runs the verification chain again at publish time, so a release
39
+ cannot go out on an unverified tree.
40
+
41
+ ## Release loop
42
+
43
+ A version bump is not just `package.json` — the site serves matching artifacts
44
+ and their checksums, and `check-download-artifacts` fails when any of them
45
+ disagree. Work in this order:
46
+
47
+ 1. **Bump the version** in `package.json`, and anywhere an example or template
48
+ pins it. `npm run verify` catches a stale pin.
49
+ 2. **Write the CHANGELOG entry** — newest first, describing what changed for a
50
+ user rather than which files moved.
51
+ 3. **Build the artifacts** into `2026/JSO-Website/download/jso-protector/`:
52
+ ```bash
53
+ npm pack # jso-protector-<version>.tgz
54
+ ```
55
+ plus the `-server-upload.zip` companion of the same contents.
56
+ 4. **Update the published checksums** in
57
+ `2026/JSO-Website/download/SHA256SUMS.txt`, and the version strings on
58
+ `downloads.aspx`, `jso-protector.aspx`, and `Docs/NpmCli.aspx`. Bump the
59
+ `?v=` query on anything cached.
60
+ 5. **Remove the superseded artifacts** from the download folder. The inventory
61
+ check is exact: an extra file fails it as loudly as a missing one.
62
+ 6. **Run `npm run verify` again** and fix anything it finds before uploading.
63
+ 7. **Deploy the site surface** (see `trust/DEPLOY-LOG.md` for the FTPS flow and
64
+ the standing requirement to record every deploy there).
65
+ 8. **Publish**: `npm publish`. Then install from the registry into a scratch
66
+ directory and exercise the new behaviour end to end — a green local tree
67
+ proves the tarball, not the release.
68
+
69
+ ## What ships in the tarball
70
+
71
+ `files` in `package.json` is the allowlist. `verify:package` asserts the packed
72
+ contents against it, so adding a runtime file means adding it there too.
73
+ Documentation that ships to customers — `README.md`, `MIGRATION.md`,
74
+ `SECURITY.md`, and this file — is read on npmjs.com by people deciding whether
75
+ to trust the product. Keep it true to what the published package actually is.