jso-protector 0.4.11 → 0.4.13

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,13 +1,23 @@
1
- # jso-protector
1
+ # JavaScript Obfuscator
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/jso-protector.svg)](https://www.npmjs.com/package/jso-protector)
3
+ [![npm version](https://img.shields.io/npm/v/javascriptobfuscator-com.svg)](https://www.npmjs.com/package/javascriptobfuscator-com)
4
4
  [![tests](https://github.com/richtexteditor/jso-protector/actions/workflows/test.yml/badge.svg)](https://github.com/richtexteditor/jso-protector/actions/workflows/test.yml)
5
- [![node](https://img.shields.io/node/v/jso-protector.svg)](https://www.npmjs.com/package/jso-protector)
5
+ [![node](https://img.shields.io/node/v/javascriptobfuscator-com.svg)](https://www.npmjs.com/package/javascriptobfuscator-com)
6
6
 
7
7
  Obfuscate and protect JavaScript as part of your build: a dependency-free CLI,
8
8
  Node API, and plugins for webpack, Vite, Rollup, esbuild, Next.js, Metro, and
9
9
  the rest of the toolchain.
10
10
 
11
+ > **Two package names, one build.** Install **`javascriptobfuscator-com`** - that
12
+ > is the canonical name. `jso-protector` is the original name and publishes the
13
+ > same code, so existing installs keep working. Whichever you install, the CLI is
14
+ > on your PATH as both `javascriptobfuscator` and `jso-protector`.
15
+ >
16
+ > The bare name `javascriptobfuscator` is not available on npm: the registry
17
+ > refuses it as too similar to an existing package, so `npx javascriptobfuscator`
18
+ > only works once the package is installed in the project. Use
19
+ > `npx javascriptobfuscator-com` for a one-off run with nothing installed.
20
+
11
21
  ```bash
12
22
  npm install --save-dev javascriptobfuscator-com
13
23
  npx javascriptobfuscator --input dist --output dist-protected
@@ -114,383 +124,437 @@ npx jso-protector --init --init-template turbopack --manifest .next/static-prote
114
124
  npx jso-protector --init --init-template expo --input dist --output dist-protected
115
125
  ```
116
126
 
117
- ## CI release tagging and crash symbolication
118
-
119
- Two CLI flags help wire `jso-protector` into a CI pipeline that has to debug production crashes later:
127
+ ## Commands
120
128
 
121
- - `--label <value>` tags the API request with a release label. The label appears as `ReleaseLabel` in the JSO dashboard audit log, so support tickets can be tied back to a specific commit. Typical CI usage:
129
+ ```bash
130
+ jso-protector --config jso.config.json
131
+ jso-protector --config jso.config.cjs
132
+ jso-protector --version
133
+ jso-protector --version --json
134
+ jso-protector src/app.js
135
+ jso-protector --input dist --output dist-protected
136
+ jso-protector --list-presets --json
137
+ jso-protector --list-options --json
138
+ jso-protector --list-migration-map --json
139
+ jso-protector --explain-compat self-defending --json
140
+ jso-protector --compat-scan --json
141
+ jso-protector --local-only --json
142
+ jso-protector --migrate-javascript-obfuscator javascript-obfuscator.json --output jso.config.json
143
+ jso-protector --migrate-javascript-obfuscator javascript-obfuscator.config.cjs --output jso.config.json
144
+ jso-protector --migrate-js-confuser js-confuser.config.cjs --output jso.config.json
145
+ jso-protector --config jso.config.json --release-check --json
146
+ jso-protector --config jso.config.json --release-check --strict --json
147
+ jso-protector --config jso.config.json --validate-config --json
148
+ jso-protector --config jso.config.json --print-config --json
149
+ jso-protector --init --init-template html-app --manifest dist-protected/jso-manifest.json
150
+ jso-protector --init --init-template electron-app --input out --output out-protected
151
+ jso-protector --init --init-template nextjs-app --manifest .next/static-protected/jso-manifest.json
152
+ jso-protector --init --init-template vite-app --manifest dist-protected/jso-manifest.json
153
+ jso-protector --init --init-template parcel-app --manifest dist-protected/jso-manifest.json
154
+ jso-protector --init --init-template bun-app --manifest dist-protected/jso-manifest.json
155
+ jso-protector --init --init-template browserify-app --manifest dist-protected/jso-manifest.json
156
+ jso-protector --init --init-template webpack-app --manifest dist-protected/jso-manifest.json
157
+ jso-protector --init --init-template rspack-app --manifest dist-protected/jso-manifest.json
158
+ jso-protector --init --init-template turbopack-app --manifest .next/static-protected/jso-manifest.json
159
+ jso-protector --init --init-template react-native-app --input dist --output dist-protected
160
+ jso-protector --verify-manifest dist-protected/jso-manifest.json
161
+ jso-protector --verify-manifest dist-protected/jso-manifest.json --verify-root protected-dist
162
+ jso-protector --verify-manifest dist-protected/jso-manifest.json --audit-source-maps
163
+ jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.md
164
+ jso-protector --runtime-incident-evidence reports/runtime-incidents.json --runtime-incident-evidence-output reports/runtime-incident-evidence.md
165
+ jso-protector --verify-vm-proof dist-protected/jso-report.json --json
166
+ jso-protector --ai-resistance-evidence dist-protected/jso-report.json --ai-resistance-evidence-output reports/ai-resistance-evidence.md
167
+ jso-protector --config jso.config.json --parse-html
168
+ jso-protector --config jso.config.json --honor-conditional-comments
169
+ jso-protector --config jso.config.json --protect-marked-comments
170
+ jso-protector --config jso.config.json --keep-header-comment --protect-object-declaration --move-nested-function
171
+ jso-protector --config jso.config.json --formatted-output --keep-indent --line-numbers
172
+ jso-protector --preset maximum --input dist --output dist-protected
173
+ jso-protector --web-preset javascript-obfuscator-preset.json --dry-run --json
174
+ jso-protector --stdin --stdout --file-name app.js < dist/app.js > dist/app.protected.js
175
+ jso-protector --stdin --file-name app.js --output dist-protected < dist/app.js
176
+ jso-protector --config jso.config.json --manifest dist-protected/jso-manifest.json
177
+ jso-protector --config jso.config.json --max-output-bytes 250000 --max-growth-ratio 8
178
+ jso-protector --config jso.config.json --option LockDomain=true --option LockDomainList=example.com
179
+ jso-protector --config jso.config.json --include "assets/*.js" --exclude "**/legacy/**" --asset-exclude "**/*.license"
180
+ jso-protector --config jso.config.json --reserved-name "^PublicApi$" --reserved-name "^renderWidget$"
181
+ jso-protector dist --output dist-protected --options-preset high-obfuscation --control-flow-flattening --string-array-encoding rc4 --reserved-names "^PublicApi$"
182
+ jso-protector --dry-run --json
183
+ jso-protector --no-copy-assets
184
+ jso-protector --init
185
+ ```
122
186
 
123
- ```bash
124
- jso-protector --input dist --output dist-protected --label "$GITHUB_SHA"
125
- ```
187
+ Use `--stdin` for small custom scripts and build steps that already know which single file should be protected. Use `--stdout` to compose with other shell commands, or omit it and pass `--output` to write the result as `output/file-name`.
126
188
 
127
- Also reads `JSO_LABEL` / `JAVASCRIPT_OBFUSCATOR_LABEL` from the environment, so CI runners with the variable already set don't have to add a flag.
189
+ For direct single-file migration scripts, `jso-protector src/app.js` writes `src/app-obfuscated.js` when no `--output` or config `output` is set. Folder and config-file workflows keep using the configured output folder, usually `dist-protected`.
128
190
 
129
- - `--report <file>` writes the full API response JSON to a path. The report carries `BuildId`, `PolymorphismFingerprint`, the `GlobalIdentifierMap` / `MemberIdentifierMap` arrays, compatibility findings, and audit metadata. Pair with [`jso-symbolicate`](https://www.npmjs.com/package/jso-symbolicate) to demangle stack traces against the same build.
191
+ Use repeatable `--option Name=value` flags to override API options from CI without editing shared config. Values `true`, `false`, `null`, and numbers are parsed into their JSON equivalents; other values are sent as strings.
130
192
 
131
- ```bash
132
- jso-protector --input dist --output dist-protected --label "$GITHUB_SHA" --report dist-protected/jso-report.json
133
- jso-protector --verify-vm-proof dist-protected/jso-report.json --json
134
- jso-protector --vm-proof-pack dist-protected/jso-report.json --vm-proof-output reports/vm-proof-pack.md
135
- jso-protector --ai-resistance-evidence dist-protected/jso-report.json --ai-resistance-evidence-output reports/ai-resistance-evidence.md
136
- # later, when a crash arrives:
137
- npx jso-symbolicate --map dist-protected/jso-report.json --stack crash.txt
138
- npx jso-symbolicate --map dist-protected/jso-report.json --event sentry --event-file sentry-event.json > sentry-event.demangled.json
139
- ```
193
+ Use repeatable `--include pattern` flags to replace the configured protected-file include list for one job. Use repeatable `--exclude pattern` and `--asset-exclude pattern` flags to add job-specific file and asset exclusions without removing the config defaults. Use repeatable `--reserved-name pattern` flags to override `reservedNames` for a release job.
140
194
 
141
- Upload `dist-protected/jso-report.json` as a build artifact alongside the protected JS so the demangling map is available wherever crash triage happens. For VM beta reviews, `--verify-vm-proof` checks that the source-free report shows `UseVMProtection`, `VMProtectionApplied`, a non-zero virtualized function count, and no unresolved VM warnings. `--vm-proof-pack` turns the same report into a Markdown or JSON reviewer packet with build identity, release label, polymorphism fingerprint, VM pass/fail checklist, review decision, warnings, hot-path/cold-path guidance, recommendations, and a VM Proof Review Assistant for BYO AI or internal reviewers.
142
- For AI-resistance reviews, `--ai-resistance-evidence` turns the same source-free report into a current evidence checklist: build identity, strong protection options, optional VM proof, runtime-defense evidence, compatibility evidence, a non-scoring attacker-model review matrix, review decision, claim boundaries, a Review Assistant Packet for BYO AI or internal reviewers, and a clear `scoreStatus` that says the Resistance Score is still planned. Add `--ai-resistance-evidence-output reports/ai-resistance-evidence.md` for a reviewer artifact, `--json` for machine-readable evidence, and `--require-vm-proof` when VM-backed evidence must be a hard CI gate.
195
+ When replacing existing `javascript-obfuscator` package scripts, the CLI accepts familiar flags and maps them to hosted API options. Supported mapped compatibility flags include `--options-preset`, `--string-array`, `--string-array-encoding`, `--unicode-escape-sequence`, `--control-flow-flattening`, `--dead-code-injection`, `--dead-code-injection-threshold`, `--identifier-names-generator`, `--rename-globals`, `--rename-properties`, `--reserved-names`, `--domain-lock`, `--target`, and `--compact`. Config and Node API `domainLock` arrays map to `LockDomain` plus newline-delimited `LockDomainList`; review redirect behavior separately. Config-level compatibility fields are also accepted and covered by the shipped JSON schema. `--options-preset default`, `low-obfuscation`, `vm-default`, and `vm-low-obfuscation` map to `standard`; `medium-obfuscation` and `vm-medium-obfuscation` map to `balanced`; `high-obfuscation`, `vm-high-obfuscation`, `vm-ultra-high-obfuscation`, and `vm-anti-llm` map to `maximum`.
143
196
 
144
- The GitHub Action that ships in this repository (`ci/github-actions.yml`, and
145
- the `jso-github-action` package) wraps the saved-report workflow too: `report-path`, `vm-proof-pack-report`,
146
- and `ai-resistance-evidence-report` outputs let CI upload source-free reviewer
147
- artifacts beside the protected build, while `build-id` and
148
- `polymorphism-fingerprint` remain available for runtime crash correlation.
197
+ `--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.
149
198
 
150
- ## npm Scripts
199
+ 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.
151
200
 
152
- ```json
153
- {
154
- "scripts": {
155
- "build": "vite build",
156
- "preflight": "jso-protector --config jso.config.json --release-check --json",
157
- "protect": "jso-protector --config jso.config.json",
158
- "release": "npm run build && npm run preflight && npm run protect && npm run smoke"
159
- }
160
- }
161
- ```
201
+ Specifically, it maps `--self-defending`, `--debug-protection`, `--debug-protection-interval`, `--disable-console-output`, and `--domain-lock-redirect-url` directly.
162
202
 
163
- ## Node API
203
+ Use `--version` for a quick CLI parity check in scripts. Add `--json` to print package metadata and the default hosted API endpoint.
164
204
 
165
- Use the API when you want to protect code or release folders from a custom build script without spawning the CLI:
205
+ 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.
166
206
 
167
- ```js
168
- const { obfuscate, obfuscateMultiple, getOptionsByPreset, protectCode, protectFiles, planProtection } = require("jso-protector");
207
+ 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.
169
208
 
170
- const obfuscationResult = await obfuscate("console.log('release');", {
171
- apiKey: process.env.JSO_API_KEY,
172
- apiPassword: process.env.JSO_API_PASSWORD,
173
- controlFlowFlattening: true,
174
- identifierNamesGenerator: "hexadecimal",
175
- reservedNames: ["^PublicApi$"],
176
- stringArrayEncoding: ["rc4"]
177
- }, "app.js");
209
+ ### AI precheck 鈥?gate the obfuscation API call on AI compat-check findings
178
210
 
179
- console.log(obfuscationResult.getObfuscatedCode());
180
- console.log(obfuscationResult.toString());
211
+ 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.
181
212
 
182
- const multipleResults = await obfuscateMultiple({
183
- "foo.js": "var foo = 1;",
184
- "bar.js": "var bar = 2;"
185
- }, {
186
- apiKey: process.env.JSO_API_KEY,
187
- apiPassword: process.env.JSO_API_PASSWORD,
188
- ...getOptionsByPreset("balanced")
189
- });
213
+ ```sh
214
+ # Single command, single round-trip. Add to any CI step you already run:
215
+ jso-protector --config jso.config.json --ai-precheck --ai-precheck-fail-on error
190
216
 
191
- console.log(multipleResults["foo.js"].getObfuscatedCode());
217
+ # JSON output for machine consumers (CI annotations, GitHub status checks):
218
+ jso-protector --config jso.config.json --ai-precheck --json
219
+ ```
192
220
 
193
- const protectedCode = await protectCode({
194
- apiKey: process.env.JSO_API_KEY,
195
- apiPassword: process.env.JSO_API_PASSWORD,
196
- preset: "balanced"
197
- }, "console.log('release');", "app.js");
221
+ Gate levels for `--ai-precheck-fail-on`:
198
222
 
199
- const plan = planProtection({
200
- input: "dist",
201
- output: "dist-protected",
202
- preset: "balanced",
203
- exclude: ["**/*.map", "**/vendor/**", "**/*-obfuscated.js"]
204
- });
223
+ - `error` (default): build aborts on any error-severity finding.
224
+ - `warning`: build aborts on any error or warning finding (paranoid mode).
225
+ - `never`: print findings, never fail (advisory mode).
205
226
 
206
- console.log(`Protecting ${plan.summary.files.length} file(s).`);
227
+ For projects that want to run the gate stand-alone 鈥?pre-commit hooks, IDE integrations, ad-hoc audits 鈥?use the companion sub-command:
207
228
 
208
- await protectFiles({
209
- apiKey: process.env.JSO_API_KEY,
210
- apiPassword: process.env.JSO_API_PASSWORD,
211
- input: "dist",
212
- output: "dist-protected",
213
- preset: "balanced",
214
- manifest: "dist-protected/jso-manifest.json"
215
- });
229
+ ```sh
230
+ jso ai compat-scan --config jso.config.json --fail-on error
231
+ jso ai compat-scan --config jso.config.json --max-files 50 # cap quota burn on huge repos
216
232
  ```
217
233
 
218
- Use `obfuscate(code, options, fileName)` and `obfuscateMultiple(sourceCodesObject, options)` when migrating from `javascript-obfuscator` style Node scripts. These methods are asynchronous because they call the hosted API, and their result objects include `getObfuscatedCode()`, `toString()`, `getSourceMap()`, and `getIdentifierNamesCache()` for compatibility-friendly call sites. They use the same marked HTML and inline planning as the CLI, so `parseHtml`, `honorConditionalComments`, and `protectMarkedComments` work for object-map inputs too. Source maps and identifier caches return `null` because the hosted API workflow is designed to remove release source maps.
234
+ 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.
219
235
 
220
- 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.
236
+ ### AI usage and BYO key health
221
237
 
222
- `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.
238
+ Use the bundled AI CLI when an account owner or release job needs to confirm quota and BYO provider-key readiness without opening the dashboard.
223
239
 
224
- `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.
240
+ ```sh
241
+ jso ai usage --pretty
242
+ # tier: Pro
243
+ # actions: 12 / 500 (488 remaining)
244
+ # AI key health: Key ready (openai) [ready]
245
+ # next key test: 2026-06-25T00:00:00Z
246
+ # rotation review: 2026-08-24T00:00:00Z
247
+ ```
225
248
 
226
- `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`.
249
+ Programmatic callers get the same source-free state from the typed Node client:
227
250
 
228
- `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.
251
+ ```js
252
+ const { ai } = require("jso-protector");
229
253
 
230
- `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.
254
+ const usage = await ai.usage();
255
+ if (usage.providerKey && usage.providerKey.status !== "ready") {
256
+ console.warn("AI key health:", usage.providerKey.label);
257
+ }
258
+ ```
231
259
 
232
- `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.
260
+ 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.
233
261
 
234
- 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`.
262
+ ### Pre-flight quota gate 鈥?`--estimate`
235
263
 
236
- `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.
264
+ 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:
237
265
 
238
- 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.
266
+ - **OK** (exit 0) 鈥?quota healthy, build can proceed.
267
+ - **WARN** (exit 0) 鈥?fewer than 5 actions remaining OR cost cap below 20%. Print, don't block.
268
+ - **FAIL** (exit 1) 鈥?actions remaining = 0. Block the build before it consumes any more.
239
269
 
240
- 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.
270
+ ```sh
271
+ jso-protector --config jso.config.json --estimate
272
+ jso-protector --config jso.config.json --estimate --json # machine-readable
273
+ ```
241
274
 
242
- `getOptionsByPreset("standard" | "balanced" | "maximum")` returns a copy of the hosted API preset options for scripts that previously used preset lookup helpers.
275
+ Network failures on `/v1/ai/usage` downgrade to WARN with a note (don't crash the build pipeline over an observability gap).
243
276
 
244
- Use `protectFile(options, sourcePath, outputPath)` for one physical source file, `protectFiles(options)` for a file or folder configured with `input` and `output`, and `planProtection(options)` when CI needs a dry plan before making the API call. The `obfuscateFile`, `obfuscateFiles`, and `obfuscateDirectory` aliases are available for teams that prefer obfuscator naming. These helpers use the same config merging, preset handling, asset copying, manifest writing, and size budget checks as the CLI.
277
+ 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.
245
278
 
246
- TypeScript declarations are included for the CLI core, Node API, Browserify, Metro/React Native, esbuild/Vite/Rollup/Webpack/Rspack/Gulp/Grunt integrations, and the Webpack/Rspack loader entrypoints. No separate `@types` package is needed.
279
+ ### Watermarking 鈥?anti-piracy + dispute proof
247
280
 
248
- ## Rspack
281
+ `--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.
249
282
 
250
- Use the Rspack entrypoint when a webpack-compatible Rust build should protect emitted JavaScript assets through the same final-asset stage used by the Webpack plugin.
283
+ ```sh
284
+ # Stamp during build:
285
+ jso-protector --config jso.config.json \
286
+ --watermark "release-2026-Q3" --watermark-key "$JSO_WATERMARK_KEY"
251
287
 
252
- ```js
253
- const JsoProtectorRspackPlugin = require("jso-protector/rspack");
288
+ # Verify a single file post-deploy:
289
+ jso-protector --verify-watermark dist-protected/app.js --watermark-key "$JSO_WATERMARK_KEY"
290
+ # OK dist-protected/app.js: valid watermark, tag=release-2026-Q3
254
291
 
255
- module.exports = {
256
- plugins: [
257
- new JsoProtectorRspackPlugin({
258
- apiKey: process.env.JSO_API_KEY,
259
- apiPassword: process.env.JSO_API_PASSWORD,
260
- preset: "balanced",
261
- exclude: ["vendor.js"],
262
- manifest: "dist/jso-manifest.json"
263
- })
264
- ]
265
- };
292
+ # Bulk-scan a directory (CDN audit / forensic inventory):
293
+ jso-protector --scan-watermarks dist-protected/ --watermark-key "$JSO_WATERMARK_KEY"
294
+ # Scanned 42 JS file(s) under dist-protected/
295
+ # Watermarked: 42 valid=42 invalid=0
266
296
  ```
267
297
 
268
- Use `jso-protector/rspack-loader` when a Rspack project needs module-level protection before bundling. For complete release bundles, prefer the Rspack plugin so final emitted assets and stale source maps are handled together.
298
+ 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.
269
299
 
270
- ## Browserify
300
+ 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.
271
301
 
272
- Use the Browserify transform when a legacy bundle protects selected modules before bundling:
302
+ Exit codes (`--scan-watermarks`): **0** all clean / **1** at least one invalid signature found / **2** no watermarks found at all.
273
303
 
274
- ```js
275
- const browserify = require("browserify");
276
- const fs = require("fs");
277
- const jsoProtector = require("jso-protector/browserify");
304
+ ### Signed release attestations 鈥?SLSA-style
278
305
 
279
- browserify("src/app.js", {
280
- transform: [[jsoProtector, {
281
- apiKey: process.env.JSO_API_KEY,
282
- apiPassword: process.env.JSO_API_PASSWORD,
283
- input: "src",
284
- preset: "balanced",
285
- include: ["**/*.js"],
286
- reservedNames: ["^PublicApi$"],
287
- manifest: "dist/jso-manifest.json"
288
- }]]
289
- })
290
- .bundle()
291
- .pipe(fs.createWriteStream("dist/app.js"));
292
- ```
293
-
294
- The transform passes excluded files through untouched, protects selected JavaScript modules, and honors config files, filters, manifests, and size budgets. It respects configured protected extensions, so `.mjs` and `.cjs` module pipelines can opt in through `extensions`.
295
-
296
- ## Next.js
306
+ `--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:
297
307
 
298
- Use the Next.js entrypoint when you want a first-class wrapper around `next.config.js` instead of wiring the Webpack plugin manually. By default, it adds protection only for production client bundles.
308
+ ```sh
309
+ # One-time: mint a keypair (writes .priv.pem 0o600, .pub.pem 0o644):
310
+ jso-protector --genkey-release ci-signing-key
299
311
 
300
- ```js
301
- const withJsoProtector = require("jso-protector/next");
312
+ # Build + sign:
313
+ jso-protector --config jso.config.json \
314
+ --manifest dist-protected/build.manifest.json \
315
+ --sign-release ci-signing-key.priv.pem
316
+ # -> dist-protected/build.manifest.json.sig
302
317
 
303
- module.exports = withJsoProtector({
304
- reactStrictMode: true
305
- }, {
306
- apiKey: process.env.JSO_API_KEY,
307
- apiPassword: process.env.JSO_API_PASSWORD,
308
- preset: "balanced",
309
- exclude: ["static/chunks/webpack*.js"],
310
- manifest: ".next/jso-manifest.json"
311
- });
318
+ # Verify post-deploy:
319
+ jso-protector --verify-release dist-protected/build.manifest.json.sig \
320
+ --public-key ci-signing-key.pub.pem \
321
+ --verify-root dist-protected/
322
+ # OK .../build.manifest.json.sig: signature valid (BuildId=...), 42 file(s) re-hashed
312
323
  ```
313
324
 
314
- Pass `target: "server"` to protect only server bundles or `target: "both"` to protect both server and client output. Development builds are skipped by default; pass `applyInDevelopment: true` only when you explicitly want protection during `next dev`.
325
+ Two-stage verification:
315
326
 
316
- ## Metro / React Native
327
+ - **Stage 1** 鈥?Ed25519 signature over canonical-JSON manifest (catches forgery + manifest tampering).
328
+ - **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.
317
329
 
318
- Use the Metro entrypoint when React Native or Expo projects need to protect the final release bundle through `serializer.customSerializer`.
330
+ Without `--public-key`, the envelope's embedded public key is trusted (signature-only verification). With it, embedded != trusted 鈫?fail fast (defeats key-substitution attacks).
319
331
 
320
- ```js
321
- const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config");
322
- const { withJsoProtectorMetro } = require("jso-protector/metro");
332
+ 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.
323
333
 
324
- const baseConfig = getDefaultConfig(__dirname);
334
+ 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.
325
335
 
326
- module.exports = withJsoProtectorMetro(mergeConfig(baseConfig, {}), {
327
- apiKey: process.env.JSO_API_KEY,
328
- apiPassword: process.env.JSO_API_PASSWORD,
329
- preset: "balanced",
330
- include: ["index.android.release.bundle.js", "index.ios.release.bundle.js"]
331
- });
332
- ```
336
+ 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.
333
337
 
334
- When you already have a serializer function, wrap it directly:
338
+ 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.
335
339
 
336
- ```js
337
- const { getDefaultConfig } = require("expo/metro-config");
338
- const { createMetroSerializer } = require("jso-protector/metro");
340
+ Use `--parse-html` when built HTML or template files contain inline scripts that should be protected. Markup files require this explicit mode before protection; the CLI will not send a whole document to the JavaScript API path by accident. Only marked inline blocks are sent to the API:
339
341
 
340
- const config = getDefaultConfig(__dirname);
341
- const expoSerializer = config.serializer.customSerializer;
342
+ ```html
343
+ <script data-javascript-obfuscator>
344
+ window.releaseWidget = createWidget();
345
+ </script>
346
+ ```
342
347
 
343
- config.serializer.customSerializer = createMetroSerializer({
344
- serializer: expoSerializer,
345
- apiKey: process.env.JSO_API_KEY,
346
- apiPassword: process.env.JSO_API_PASSWORD,
347
- fileName: "index.android.release.bundle.js"
348
- });
348
+ Unmarked inline scripts are preserved. Marked external scripts and marked module scripts fail with a clear warning because markup mode protects inline script contents only; protect referenced files directly through the JavaScript build pipeline. When `parseHtml` is enabled, the CLI automatically adds the configured `markupExtensions` list to protected extensions. By default that includes `.html`, `.htm`, `.php`, `.phtml`, `.asp`, `.aspx`, `.jsp`, `.cshtml`, and `.vbhtml`.
349
349
 
350
- module.exports = config;
351
- ```
350
+ Use `--honor-conditional-comments` to preserve source regions marked with `javascript-obfuscator:disable` and `javascript-obfuscator:enable`. Without the flag, the CLI fails with a clear warning when markers are found so protected regions are not sent unexpectedly. With the flag, enabled regions are sent as separate API items and disabled regions are copied back verbatim. Markers must be balanced; an unmatched `disable`, unmatched `enable`, or nested disabled region fails before any source is sent.
352
351
 
353
- The Metro helper protects only matching bundle names and removes stale source maps from object-style serializer results unless `removeSourceMaps: false` is set. When maps are removed, stale `sourceMappingURL` comments are stripped from the protected bundle output too.
352
+ ```js
353
+ console.log("protect this");
354
+ // javascript-obfuscator:disable
355
+ console.log("keep this exact local code");
356
+ // javascript-obfuscator:enable
357
+ console.log("protect this too");
358
+ ```
354
359
 
355
- If you prefer a framework-specific package path for React Native docs or starter templates, `jso-protector/react-native` is an alias of `jso-protector/metro`:
360
+ Use `--protect-marked-comments` when only selected sections of a file should be protected. Unmarked code is copied back verbatim, and only regions between `javascript-obfuscator:protect-begin` and `javascript-obfuscator:protect-end` are sent to the hosted API. Markers must be balanced and cannot be mixed with `disable`/`enable` markers in the same file.
356
361
 
357
362
  ```js
358
- const { withJsoProtectorMetro } = require("jso-protector/react-native");
363
+ console.log("keep this exact local code");
364
+ // javascript-obfuscator:protect-begin
365
+ console.log("protect this algorithm");
366
+ // javascript-obfuscator:protect-end
367
+ console.log("keep this exact local code too");
359
368
  ```
360
369
 
361
- ## esbuild
370
+ 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.
362
371
 
363
- Use the esbuild entrypoint for direct esbuild release builds. It protects in-memory output files when `write: false` is used, and protects written `outdir` or `outfile` assets in place for normal builds.
372
+ ### `--local`: protect without sending source
364
373
 
365
- ```js
366
- const esbuild = require("esbuild");
367
- const jsoProtector = require("jso-protector/esbuild");
374
+ `--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`:
368
375
 
369
- await esbuild.build({
370
- entryPoints: ["src/app.js"],
371
- bundle: true,
372
- outdir: "dist",
373
- plugins: [
374
- jsoProtector({
375
- apiKey: process.env.JSO_API_KEY,
376
- apiPassword: process.env.JSO_API_PASSWORD,
377
- preset: "balanced",
378
- exclude: ["vendor.js"],
379
- manifest: "dist/jso-manifest.json"
380
- })
381
- ]
382
- });
376
+ ```bash
377
+ jso-protector --config jso.config.json --local
378
+ jso-protector --config jso.config.json --local --local-exe "C:\Tools\JSObfuscator\cli\jso-local.exe"
383
379
  ```
384
380
 
385
- The esbuild plugin respects configured protected extensions, so Node-oriented bundles can opt into `.mjs` or `.cjs` outputs through `extensions`.
381
+ The executable is found via `--local-exe`, then `JSO_LOCAL_EXE`, then the usual desktop install locations. Config equivalents are `"local": true` and `"localExe"`.
386
382
 
387
- ## Parcel, Bun, and Turbopack
383
+ State it accurately when a reviewer asks:
388
384
 
389
- Parcel, Bun, and Turbopack do not need a dedicated runtime wrapper when your release flow already emits JavaScript files or chunks to disk. Run the framework build first, then protect the generated output folder through the Node API or CLI.
385
+ - **Your source stays on the machine.** The request body is written to a temporary file, handed to `jso-local`, and deleted after the run.
386
+ - **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.
387
+ - **Windows only**, because the executable ships in the Windows desktop archive.
388
+ - **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.
390
389
 
391
- For Parcel builds that write `dist/`, use a post-build release script:
390
+ 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.
392
391
 
393
- ```js
394
- const protectParcelBuild = require("jso-protector/parcel");
392
+ 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.
395
393
 
396
- const options = {
397
- apiKey: process.env.JSO_API_KEY,
398
- apiPassword: process.env.JSO_API_PASSWORD
399
- };
394
+ Use `--print-config --json` to inspect the final resolved config after presets, config files, environment variables, and CLI overrides are merged. API credentials are redacted as `[set]` or `[missing]`.
400
395
 
401
- const plan = protectParcelBuild.planParcelBuild(options);
402
- console.log(`Protecting ${plan.summary.files.length} Parcel file(s).`);
403
- await protectParcelBuild(options);
404
- ```
396
+ Use `--manifest file.json` or `"manifest": "file.json"` to write a release manifest after a successful protection run. The manifest includes project metadata, preset, enabled option names, processing metadata for virtual API items, protected file sizes and SHA-256 hashes, copied asset hashes, and any grouped migration `limitations` still present in the config so artifact review does not depend on one earlier CLI preflight step.
405
397
 
406
- For Bun builds, keep the same post-build pattern after `bun build`:
398
+ Use `--verify-manifest file.json` to verify that a protected output folder or unpacked release artifact still matches the manifest hashes. By default, verification reads each entry's recorded `outputPath`. Add `--verify-root path/to/artifact` when the protected files were moved into a different folder after the manifest was written; verification then resolves each manifest `fileName` under that alternate root. Add `--audit-source-maps` in release CI to fail when protected JavaScript still contains `sourceMappingURL` comments or when copied artifacts include `.map` files.
407
399
 
408
- ```json
409
- {
410
- "scripts": {
411
- "build": "bun build ./src/index.ts --outdir ./dist --target browser",
412
- "protect": "node ./scripts/protect-release.js",
413
- "release": "bun run build && node ./scripts/protect-release.js --plan && node ./scripts/protect-release.js"
414
- }
415
- }
416
- ```
400
+ Use `--source-map-evidence file.json --source-map-evidence-output reports/source-map-evidence.md` when a release reviewer needs a source-free packet proving protected artifacts do not expose source maps. The command reuses manifest hash verification, audits `.map` files and `sourceMappingURL` comments, emits Markdown by default or JSON with `--json`, and lists artifact names/reasons without embedding source code or source-map contents. The packet now includes a Source Map Review Assistant for BYO AI or internal reviewers, with prompts for leak cleanup, manifest verification, secure debugging exceptions, bundler cleanup order, and clean reviewer handoff without sharing raw `.map` files, original source paths, source code, protected output, customer data, or secrets. Add `--verify-root path/to/artifact` when the manifest was moved before review.
417
401
 
418
- ```js
419
- const protectBunBuild = require("jso-protector/bun");
402
+ Use `--verify-vm-proof report.json` to verify that a saved API report proves VM protection ran for at least one function. Add `--min-vm-functions 2` or a higher number when the release intentionally marks multiple functions. The check is local and source-free: it reads the report written by `--report`, then validates `UseVMProtection`, `VMProtectionApplied`, `VMProtectionVirtualizedCount`, and `VMProtectionWarnings`.
420
403
 
421
- await protectBunBuild({
422
- apiKey: process.env.JSO_API_KEY,
423
- apiPassword: process.env.JSO_API_PASSWORD
424
- });
425
- ```
404
+ VM function markers accept `// @virtualize`, `/* @virtualize */`, and `/** @virtualize */` immediately before a supported synchronous function declaration. The server normalizes block and JSDoc markers before the VM sidecar runs, so proof failures should focus on unsupported function syntax, account eligibility, or sidecar warnings instead of comment shape.
426
405
 
427
- For Next.js projects that use Turbopack in production, protect the emitted `.next/static/` chunks after `next build --turbopack` while excluding framework runtime files that should stay untouched:
406
+ Use `--vm-proof-pack report.json --vm-proof-output reports/vm-proof-pack.md` when a security reviewer needs one source-free VM evidence packet. The Markdown output includes build identity, release label, polymorphism fingerprint, VM proof checks, review decision, warnings, compatibility guidance, hot-path/cold-path performance guidance, next actions, and a VM Proof Review Assistant for BYO AI or internal reviewers. The assistant prompts owners to resolve failed proof checks, handle VM warnings, confirm cold sensitive function scope, exclude hot paths, and attach protected-build smoke results without sending source code, protected output, VM bytecode, source maps, provider keys, customer data, or secrets. Add `--json` to write the same packet as machine-readable JSON. A passing VM proof pack can still say `ready-for-manual-review` when the release owner must confirm the selected functions are cold sensitive paths and attach smoke-test results.
428
407
 
429
- ```js
430
- const protectTurbopackBuild = require("jso-protector/turbopack");
408
+ Use `--ai-resistance-evidence report.json --ai-resistance-evidence-output reports/ai-resistance-evidence.md` when a security reviewer or buyer asks what can be checked today for AI-aware protection. The command stays local, reads the saved API report, and emits a source-free evidence summary with a non-scoring attacker-model review matrix, review decision, claim boundaries, and a Review Assistant Packet for BYO AI or internal reviewers. The assistant prompts owners to resolve failed evidence, confirm missing review tracks, check VM/runtime/compatibility scope, and keep Resistance Score wording in the planned-methodology lane without pasting source code, protected output, source maps, provider keys, or secrets into a reviewer or AI prompt. The decision is `blocked` when required evidence fails, `ready-for-manual-review` when required checks pass but optional review tracks need confirmation, or `ready` when every current track is evidenced. It does not call an AI model and it does not claim the planned Resistance Score is live. Add `--json` to write the same packet as machine-readable JSON, and add `--require-vm-proof` to fail when the same report does not pass the VM proof checks.
431
409
 
432
- await protectTurbopackBuild({
433
- apiKey: process.env.JSO_API_KEY,
434
- apiPassword: process.env.JSO_API_PASSWORD
435
- });
436
- ```
410
+ Use `--script-inventory-audit inventory.json --runtime-inventory-snapshot snapshot.json` when checkout owners need a source-free reconciliation between the approved payment-page script inventory and what the browser actually observed. Markdown is emitted by default; add `--json` for automation. The command fails the gate when unknown, unauthorized, missing, changed, late-injected, or required metadata-incomplete scripts need review. Missing optional `risk`, `dataAccess`, and `approvalTicket` values are reported as review-context gaps, not blocking failures. Each audit also includes a source-free Review Assistant Packet for BYO AI or internal reviewer triage, with safe-input boundaries and prompts for owner actions, data-access review, integrity drift, and approval-ticket cleanup.
437
411
 
438
- Copyable starter files for these post-build flows are included in `examples/parcel`, `examples/bun`, and `examples/turbopack`.
412
+ Use `--payment-page-headers-from-har checkout.har --payment-page-headers-output payment-page-headers.json` when checkout owners need a source-free payment-page security-header snapshot from a browser or synthetic-monitor HAR. Add `--payment-page-headers-baseline approved-headers.json` to mark each checkout page or frame as matching, changed, or missing from the approved header baseline. The JSON output includes a source-free security-header Review Assistant Packet for BYO AI or internal reviewers, with safe-input boundaries and prompts for baseline drift, CSP/reporting gaps, HSTS coverage, and frame-policy owner actions.
439
413
 
440
- ## Vite
414
+ Use `jso-protector compliance pci-dss-v4 --script-inventory-audit audit.json` to include the JSON audit summary in the PCI evidence report alongside `--script-inventory` and `--runtime-incidents`. The generated Markdown and JSON also include a source-free PCI DSS Review Assistant for BYO AI or internal reviewers, with prompts for evidence gaps, signed-release proof, script authorization, observed script drift, header change evidence, runtime incident routing, and QSA handoff boundaries. Do not paste source code, protected output, raw script rows, raw response headers, raw incident payloads, payment-card data, provider keys, customer data, or secrets into that review.
441
415
 
442
- Protect emitted JavaScript chunks after Vite finishes bundling:
416
+ Use `--max-output-bytes` / `"maxOutputBytes"` and `--max-growth-ratio` / `"maxGrowthRatio"` to fail CI when protected output exceeds your release size budget. The same budget fields work in bundle plugins.
417
+ ## CI release tagging and crash symbolication
443
418
 
444
- ```js
445
- const jsoProtector = require("jso-protector/vite");
419
+ Two CLI flags help wire `jso-protector` into a CI pipeline that has to debug production crashes later:
446
420
 
447
- module.exports = {
448
- plugins: [
449
- jsoProtector({
450
- apiKey: process.env.JSO_API_KEY,
451
- apiPassword: process.env.JSO_API_PASSWORD,
452
- preset: "balanced",
453
- exclude: ["**/vendor/**"],
454
- manifest: "dist/jso-manifest.json"
455
- })
456
- ]
457
- };
458
- ```
421
+ - `--label <value>` tags the API request with a release label. The label appears as `ReleaseLabel` in the JSO dashboard audit log, so support tickets can be tied back to a specific commit. Typical CI usage:
459
422
 
460
- The plugin removes stale JavaScript source maps by default. Pass `removeSourceMaps: false` only when another step regenerates or removes maps. When maps are removed, stale `sourceMappingURL` comments are stripped from the protected JavaScript so release artifacts do not point at missing `.map` files.
423
+ ```bash
424
+ jso-protector --input dist --output dist-protected --label "$GITHUB_SHA"
425
+ ```
461
426
 
462
- Bundler plugins use the same protection planner as the CLI and Node API, so `honorConditionalComments` and `protectMarkedComments` preserve marked JavaScript regions before chunks are sent to the hosted API.
427
+ Also reads `JSO_LABEL` / `JAVASCRIPT_OBFUSCATOR_LABEL` from the environment, so CI runners with the variable already set don't have to add a flag.
463
428
 
464
- ## Rollup
429
+ - `--report <file>` writes the full API response JSON to a path. The report carries `BuildId`, `PolymorphismFingerprint`, the `GlobalIdentifierMap` / `MemberIdentifierMap` arrays, compatibility findings, and audit metadata. Pair with [`jso-symbolicate`](https://www.npmjs.com/package/jso-symbolicate) to demangle stack traces against the same build.
465
430
 
466
- Use the Rollup entrypoint when your release build writes Rollup chunks directly:
431
+ ```bash
432
+ jso-protector --input dist --output dist-protected --label "$GITHUB_SHA" --report dist-protected/jso-report.json
433
+ jso-protector --verify-vm-proof dist-protected/jso-report.json --json
434
+ jso-protector --vm-proof-pack dist-protected/jso-report.json --vm-proof-output reports/vm-proof-pack.md
435
+ jso-protector --ai-resistance-evidence dist-protected/jso-report.json --ai-resistance-evidence-output reports/ai-resistance-evidence.md
436
+ # later, when a crash arrives:
437
+ npx jso-symbolicate --map dist-protected/jso-report.json --stack crash.txt
438
+ npx jso-symbolicate --map dist-protected/jso-report.json --event sentry --event-file sentry-event.json > sentry-event.demangled.json
439
+ ```
467
440
 
468
- ```js
469
- const jsoProtector = require("jso-protector/rollup");
441
+ Upload `dist-protected/jso-report.json` as a build artifact alongside the protected JS so the demangling map is available wherever crash triage happens. For VM beta reviews, `--verify-vm-proof` checks that the source-free report shows `UseVMProtection`, `VMProtectionApplied`, a non-zero virtualized function count, and no unresolved VM warnings. `--vm-proof-pack` turns the same report into a Markdown or JSON reviewer packet with build identity, release label, polymorphism fingerprint, VM pass/fail checklist, review decision, warnings, hot-path/cold-path guidance, recommendations, and a VM Proof Review Assistant for BYO AI or internal reviewers.
442
+ For AI-resistance reviews, `--ai-resistance-evidence` turns the same source-free report into a current evidence checklist: build identity, strong protection options, optional VM proof, runtime-defense evidence, compatibility evidence, a non-scoring attacker-model review matrix, review decision, claim boundaries, a Review Assistant Packet for BYO AI or internal reviewers, and a clear `scoreStatus` that says the Resistance Score is still planned. Add `--ai-resistance-evidence-output reports/ai-resistance-evidence.md` for a reviewer artifact, `--json` for machine-readable evidence, and `--require-vm-proof` when VM-backed evidence must be a hard CI gate.
470
443
 
471
- module.exports = {
472
- plugins: [
473
- jsoProtector({
474
- apiKey: process.env.JSO_API_KEY,
475
- apiPassword: process.env.JSO_API_PASSWORD,
476
- preset: "balanced",
477
- exclude: ["vendor.js"],
478
- manifest: "dist/jso-manifest.json"
479
- })
480
- ]
481
- };
444
+ The GitHub Action that ships in this repository (`ci/github-actions.yml`, and
445
+ the `jso-github-action` package) wraps the saved-report workflow too: `report-path`, `vm-proof-pack-report`,
446
+ and `ai-resistance-evidence-report` outputs let CI upload source-free reviewer
447
+ artifacts beside the protected build, while `build-id` and
448
+ `polymorphism-fingerprint` remain available for runtime crash correlation.
449
+
450
+ ## npm Scripts
451
+
452
+ ```json
453
+ {
454
+ "scripts": {
455
+ "build": "vite build",
456
+ "preflight": "jso-protector --config jso.config.json --release-check --json",
457
+ "protect": "jso-protector --config jso.config.json",
458
+ "release": "npm run build && npm run preflight && npm run protect && npm run smoke"
459
+ }
460
+ }
482
461
  ```
483
462
 
484
- ## Webpack
463
+ ## Node API
485
464
 
486
- Protect emitted JavaScript assets during the final asset phase. The plugin supports Webpack 5 through `processAssets` and falls back to the legacy `emit` hook for Webpack 4 projects:
465
+ Use the API when you want to protect code or release folders from a custom build script without spawning the CLI:
487
466
 
488
467
  ```js
489
- const JsoProtectorWebpackPlugin = require("jso-protector/webpack");
468
+ const { obfuscate, obfuscateMultiple, getOptionsByPreset, protectCode, protectFiles, planProtection } = require("jso-protector");
469
+
470
+ const obfuscationResult = await obfuscate("console.log('release');", {
471
+ apiKey: process.env.JSO_API_KEY,
472
+ apiPassword: process.env.JSO_API_PASSWORD,
473
+ controlFlowFlattening: true,
474
+ identifierNamesGenerator: "hexadecimal",
475
+ reservedNames: ["^PublicApi$"],
476
+ stringArrayEncoding: ["rc4"]
477
+ }, "app.js");
478
+
479
+ console.log(obfuscationResult.getObfuscatedCode());
480
+ console.log(obfuscationResult.toString());
481
+
482
+ const multipleResults = await obfuscateMultiple({
483
+ "foo.js": "var foo = 1;",
484
+ "bar.js": "var bar = 2;"
485
+ }, {
486
+ apiKey: process.env.JSO_API_KEY,
487
+ apiPassword: process.env.JSO_API_PASSWORD,
488
+ ...getOptionsByPreset("balanced")
489
+ });
490
+
491
+ console.log(multipleResults["foo.js"].getObfuscatedCode());
492
+
493
+ const protectedCode = await protectCode({
494
+ apiKey: process.env.JSO_API_KEY,
495
+ apiPassword: process.env.JSO_API_PASSWORD,
496
+ preset: "balanced"
497
+ }, "console.log('release');", "app.js");
498
+
499
+ const plan = planProtection({
500
+ input: "dist",
501
+ output: "dist-protected",
502
+ preset: "balanced",
503
+ exclude: ["**/*.map", "**/vendor/**", "**/*-obfuscated.js"]
504
+ });
505
+
506
+ console.log(`Protecting ${plan.summary.files.length} file(s).`);
507
+
508
+ await protectFiles({
509
+ apiKey: process.env.JSO_API_KEY,
510
+ apiPassword: process.env.JSO_API_PASSWORD,
511
+ input: "dist",
512
+ output: "dist-protected",
513
+ preset: "balanced",
514
+ manifest: "dist-protected/jso-manifest.json"
515
+ });
516
+ ```
517
+
518
+ Use `obfuscate(code, options, fileName)` and `obfuscateMultiple(sourceCodesObject, options)` when migrating from `javascript-obfuscator` style Node scripts. These methods are asynchronous because they call the hosted API, and their result objects include `getObfuscatedCode()`, `toString()`, `getSourceMap()`, and `getIdentifierNamesCache()` for compatibility-friendly call sites. They use the same marked HTML and inline planning as the CLI, so `parseHtml`, `honorConditionalComments`, and `protectMarkedComments` work for object-map inputs too. Source maps and identifier caches return `null` because the hosted API workflow is designed to remove release source maps.
519
+
520
+ 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.
521
+
522
+ `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.
523
+
524
+ `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.
525
+
526
+ `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`.
527
+
528
+ `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.
529
+
530
+ `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.
531
+
532
+ `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.
533
+
534
+ 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`.
535
+
536
+ `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.
537
+
538
+ 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.
539
+
540
+ 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.
541
+
542
+ `getOptionsByPreset("standard" | "balanced" | "maximum")` returns a copy of the hosted API preset options for scripts that previously used preset lookup helpers.
543
+
544
+ Use `protectFile(options, sourcePath, outputPath)` for one physical source file, `protectFiles(options)` for a file or folder configured with `input` and `output`, and `planProtection(options)` when CI needs a dry plan before making the API call. The `obfuscateFile`, `obfuscateFiles`, and `obfuscateDirectory` aliases are available for teams that prefer obfuscator naming. These helpers use the same config merging, preset handling, asset copying, manifest writing, and size budget checks as the CLI.
545
+
546
+ TypeScript declarations are included for the CLI core, Node API, Browserify, Metro/React Native, esbuild/Vite/Rollup/Webpack/Rspack/Gulp/Grunt integrations, and the Webpack/Rspack loader entrypoints. No separate `@types` package is needed.
547
+
548
+ ## Rspack
549
+
550
+ Use the Rspack entrypoint when a webpack-compatible Rust build should protect emitted JavaScript assets through the same final-asset stage used by the Webpack plugin.
551
+
552
+ ```js
553
+ const JsoProtectorRspackPlugin = require("jso-protector/rspack");
490
554
 
491
555
  module.exports = {
492
556
  plugins: [
493
- new JsoProtectorWebpackPlugin({
557
+ new JsoProtectorRspackPlugin({
494
558
  apiKey: process.env.JSO_API_KEY,
495
559
  apiPassword: process.env.JSO_API_PASSWORD,
496
560
  preset: "balanced",
@@ -501,1152 +565,1098 @@ module.exports = {
501
565
  };
502
566
  ```
503
567
 
504
- Like the Vite plugin, the Webpack plugin removes stale emitted source maps by default and strips stale `sourceMappingURL` comments from the protected assets. It respects configured protected extensions for emitted assets, so `.mjs` and `.cjs` library outputs can use the same plugin path. One package can cover both Webpack 4 and Webpack 5 release builds.
568
+ Use `jso-protector/rspack-loader` when a Rspack project needs module-level protection before bundling. For complete release bundles, prefer the Rspack plugin so final emitted assets and stale source maps are handled together.
505
569
 
506
- ## Webpack Loader
570
+ ## Browserify
507
571
 
508
- Use the loader when a Webpack project already protects selected modules before bundling. For complete release bundles, prefer the Webpack plugin because it protects final emitted assets and removes stale source maps.
572
+ Use the Browserify transform when a legacy bundle protects selected modules before bundling:
509
573
 
510
574
  ```js
511
- module.exports = {
512
- module: {
513
- rules: [{
514
- test: /\.js$/,
515
- include: /src/,
516
- use: [{
517
- loader: "jso-protector/webpack-loader",
518
- options: {
519
- apiKey: process.env.JSO_API_KEY,
520
- apiPassword: process.env.JSO_API_PASSWORD,
521
- preset: "balanced",
522
- include: ["src/*.js"],
523
- reservedNames: ["^PublicApi$"]
524
- }
525
- }]
526
- }]
527
- }
528
- };
575
+ const browserify = require("browserify");
576
+ const fs = require("fs");
577
+ const jsoProtector = require("jso-protector/browserify");
578
+
579
+ browserify("src/app.js", {
580
+ transform: [[jsoProtector, {
581
+ apiKey: process.env.JSO_API_KEY,
582
+ apiPassword: process.env.JSO_API_PASSWORD,
583
+ input: "src",
584
+ preset: "balanced",
585
+ include: ["**/*.js"],
586
+ reservedNames: ["^PublicApi$"],
587
+ manifest: "dist/jso-manifest.json"
588
+ }]]
589
+ })
590
+ .bundle()
591
+ .pipe(fs.createWriteStream("dist/app.js"));
529
592
  ```
530
593
 
531
- The loader disables Webpack caching for protected modules, returns no source map after protection, strips stale `sourceMappingURL` comments unless `removeSourceMaps: false` is set, and honors config files, `extensions`, `include`, `exclude`, manifests, and size budgets.
594
+ The transform passes excluded files through untouched, protects selected JavaScript modules, and honors config files, filters, manifests, and size budgets. It respects configured protected extensions, so `.mjs` and `.cjs` module pipelines can opt in through `extensions`.
532
595
 
533
- ## Gulp
596
+ ## Next.js
534
597
 
535
- Use the Gulp entrypoint when a legacy release task copies files through Vinyl streams:
598
+ Use the Next.js entrypoint when you want a first-class wrapper around `next.config.js` instead of wiring the Webpack plugin manually. By default, it adds protection only for production client bundles.
536
599
 
537
600
  ```js
538
- const { dest, src } = require("gulp");
539
- const jsoProtector = require("jso-protector/gulp");
540
-
541
- function protect() {
542
- return src(["dist/**/*.js", "dist/**/*.{css,html,png,svg}", "!dist/**/*.map"], { base: "dist" })
543
- .pipe(jsoProtector({
544
- apiKey: process.env.JSO_API_KEY,
545
- apiPassword: process.env.JSO_API_PASSWORD,
546
- preset: "balanced",
547
- exclude: ["**/vendor/**"],
548
- manifest: "dist-protected/jso-manifest.json"
549
- }))
550
- .pipe(dest("dist-protected"));
551
- }
601
+ const withJsoProtector = require("jso-protector/next");
552
602
 
553
- exports.protect = protect;
603
+ module.exports = withJsoProtector({
604
+ reactStrictMode: true
605
+ }, {
606
+ apiKey: process.env.JSO_API_KEY,
607
+ apiPassword: process.env.JSO_API_PASSWORD,
608
+ preset: "balanced",
609
+ exclude: ["static/chunks/webpack*.js"],
610
+ manifest: ".next/jso-manifest.json"
611
+ });
554
612
  ```
555
613
 
556
- The Gulp transform batches buffered JavaScript files into one API request, passes non-JavaScript assets through, removes stale `.js.map` files by default, and strips stale `sourceMappingURL` comments from protected JavaScript. Pass `removeSourceMaps: false` only when another task handles maps.
614
+ Pass `target: "server"` to protect only server bundles or `target: "both"` to protect both server and client output. Development builds are skipped by default; pass `applyInDevelopment: true` only when you explicitly want protection during `next dev`.
557
615
 
558
- ## Grunt
616
+ ## Metro / React Native
559
617
 
560
- Use the Grunt entrypoint when a release pipeline already uses Grunt file mappings:
618
+ Use the Metro entrypoint when React Native or Expo projects need to protect the final release bundle through `serializer.customSerializer`.
561
619
 
562
620
  ```js
563
- module.exports = function configureGrunt(grunt) {
564
- grunt.initConfig({
565
- jsoProtector: {
566
- release: {
567
- options: {
568
- apiKey: process.env.JSO_API_KEY,
569
- apiPassword: process.env.JSO_API_PASSWORD,
570
- input: "dist",
571
- output: "dist-protected",
572
- preset: "balanced",
573
- exclude: ["**/vendor/**"],
574
- manifest: "dist-protected/jso-manifest.json"
575
- },
576
- files: [{
577
- expand: true,
578
- cwd: "dist",
579
- src: ["**/*.js", "!**/*.map"],
580
- dest: "dist-protected"
581
- }]
582
- }
583
- }
584
- });
621
+ const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config");
622
+ const { withJsoProtectorMetro } = require("jso-protector/metro");
585
623
 
586
- require("jso-protector/grunt")(grunt);
587
- grunt.registerTask("protect", ["jsoProtector:release"]);
588
- };
589
- ```
624
+ const baseConfig = getDefaultConfig(__dirname);
590
625
 
591
- The Grunt task protects JavaScript file mappings and writes protected files to each mapping's `dest`. Use a copy task for non-JavaScript assets.
626
+ module.exports = withJsoProtectorMetro(mergeConfig(baseConfig, {}), {
627
+ apiKey: process.env.JSO_API_KEY,
628
+ apiPassword: process.env.JSO_API_PASSWORD,
629
+ preset: "balanced",
630
+ include: ["index.android.release.bundle.js", "index.ios.release.bundle.js"]
631
+ });
632
+ ```
592
633
 
593
- For bundle and stream plugins, `include` and `exclude` match emitted asset names. Use them to protect first-party release chunks while leaving vendor bundles, polyfills, and framework runtime files untouched.
634
+ When you already have a serializer function, wrap it directly:
594
635
 
595
636
  ```js
596
- jsoProtector({
597
- preset: "balanced",
598
- include: ["assets/*.js"],
599
- exclude: ["**/vendor/**", "**/polyfills-*.js"],
600
- maxOutputBytes: 250000,
601
- maxGrowthRatio: 8
637
+ const { getDefaultConfig } = require("expo/metro-config");
638
+ const { createMetroSerializer } = require("jso-protector/metro");
639
+
640
+ const config = getDefaultConfig(__dirname);
641
+ const expoSerializer = config.serializer.customSerializer;
642
+
643
+ config.serializer.customSerializer = createMetroSerializer({
644
+ serializer: expoSerializer,
645
+ apiKey: process.env.JSO_API_KEY,
646
+ apiPassword: process.env.JSO_API_PASSWORD,
647
+ fileName: "index.android.release.bundle.js"
602
648
  });
649
+
650
+ module.exports = config;
603
651
  ```
604
652
 
605
- The Browserify, esbuild, Vite, Rollup, Webpack, Webpack loader, Gulp, and Grunt integrations also honor `manifest`, `maxOutputBytes`, and `maxGrowthRatio`. A failed size budget stops the build before protected chunks replace the original bundle output.
653
+ The Metro helper protects only matching bundle names and removes stale source maps from object-style serializer results unless `removeSourceMaps: false` is set. When maps are removed, stale `sourceMappingURL` comments are stripped from the protected bundle output too.
606
654
 
607
- ## Configuration
655
+ If you prefer a framework-specific package path for React Native docs or starter templates, `jso-protector/react-native` is an alias of `jso-protector/metro`:
608
656
 
609
- ```json
610
- {
611
- "$schema": "./node_modules/jso-protector/jso.config.schema.json",
612
- "endpoint": "https://javascriptobfuscator.com/HttpApi.ashx",
613
- "apiKey": "$JSO_API_KEY",
614
- "apiPassword": "$JSO_API_PASSWORD",
615
- "projectName": "browser-release",
616
- "input": "dist",
617
- "output": "dist-protected",
618
- "preset": "balanced",
619
- "extensions": [".js", ".jsx"],
620
- "markupExtensions": [".html", ".htm", ".php", ".aspx"],
621
- "exclude": ["**/*.map", "**/vendor/**", "**/*-obfuscated.js"],
622
- "copyAssets": true,
623
- "assetExclude": ["**/*.map"],
624
- "mixedServer": false,
625
- "parseHtml": false,
626
- "honorConditionalComments": false,
627
- "protectMarkedComments": false,
628
- "keepHeaderComment": true,
629
- "protectObjectDeclaration": false,
630
- "moveNestedFunction": false,
631
- "formattedOutput": false,
632
- "keepIndent": false,
633
- "lineNumbers": false,
634
- "reservedNames": ["^PublicApi$", "^keep_"],
635
- "options": {
636
- "OptimizationMode": "Web",
637
- "LockDomain": false,
638
- "LockDate": false
639
- }
640
- }
657
+ ```js
658
+ const { withJsoProtectorMetro } = require("jso-protector/react-native");
641
659
  ```
642
660
 
643
- 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`.
644
-
645
- 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.
646
-
647
- 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.
648
-
649
- `--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`.
650
-
651
- `--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.
652
-
653
- 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.
654
-
655
- 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`.
661
+ ## esbuild
656
662
 
657
- 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.
663
+ Use the esbuild entrypoint for direct esbuild release builds. It protects in-memory output files when `write: false` is used, and protects written `outdir` or `outfile` assets in place for normal builds.
658
664
 
659
665
  ```js
660
- module.exports = ({ env, mode }) => ({
661
- apiKey: "$JSO_API_KEY",
662
- apiPassword: "$JSO_API_PASSWORD",
663
- input: env.CI ? "dist" : "demo-dist",
664
- output: mode === "staging" ? "dist-staging-protected" : "dist-protected",
665
- preset: mode === "staging" ? "standard" : "balanced",
666
- reservedNames: ["^PublicApi$"],
667
- options: {
668
- LockDomain: Boolean(env.RELEASE_DOMAIN),
669
- LockDomainList: env.RELEASE_DOMAIN || ""
670
- }
666
+ const esbuild = require("esbuild");
667
+ const jsoProtector = require("jso-protector/esbuild");
668
+
669
+ await esbuild.build({
670
+ entryPoints: ["src/app.js"],
671
+ bundle: true,
672
+ outdir: "dist",
673
+ plugins: [
674
+ jsoProtector({
675
+ apiKey: process.env.JSO_API_KEY,
676
+ apiPassword: process.env.JSO_API_PASSWORD,
677
+ preset: "balanced",
678
+ exclude: ["vendor.js"],
679
+ manifest: "dist/jso-manifest.json"
680
+ })
681
+ ]
671
682
  });
672
683
  ```
673
684
 
674
- JavaScript config files execute as Node.js code, so only load config files from your own repository or another trusted source. Use JSON config when you want schema validation and no executable config logic.
675
-
676
- ES module configs can use `export default { ... }` or `export default ({ env, cwd, mode }) => ({ ... })`. This covers `jso.config.mjs` and `jso.config.js` inside repositories that already use `"type": "module"`.
677
-
678
- `apiKey` and `apiPassword` should use the base64 values copied from the JavaScript Obfuscator dashboard. Environment references in the form `$NAME` are resolved at runtime.
679
-
680
- Do not commit real API credentials. Keep `apiKey` and `apiPassword` as environment references in shared config files.
681
-
682
- The CLI reads `JSO_API_KEY`, `JSO_API_PASSWORD`, and `JSO_ENDPOINT` by default. It also accepts long-form aliases: `JAVASCRIPT_OBFUSCATOR_API_KEY`, `JAVASCRIPT_OBFUSCATOR_API_PASSWORD`, and `JAVASCRIPT_OBFUSCATOR_ENDPOINT`.
685
+ The esbuild plugin respects configured protected extensions, so Node-oriented bundles can opt into `.mjs` or `.cjs` outputs through `extensions`.
683
686
 
684
- ## Presets and Public Names
687
+ ## Parcel, Bun, and Turbopack
685
688
 
686
- Use `preset` to start from a repeatable protection profile:
689
+ Parcel, Bun, and Turbopack do not need a dedicated runtime wrapper when your release flow already emits JavaScript files or chunks to disk. Run the framework build first, then protect the generated output folder through the Node API or CLI.
687
690
 
688
- - `standard`: core string encoding, string movement, name replacement, and compression.
689
- - `balanced`: standard plus short local names, deep obfuscation, code transposition, string encryption, and flat transform.
690
- - `maximum`: balanced plus member/global renaming, member movement, and low dead-code insertion.
691
+ For Parcel builds that write `dist/`, use a post-build release script:
691
692
 
692
- Override or extend any preset with `options`. The option names are the same names sent to `HttpApi.ashx`, such as `EncodeStrings`, `DeepObfuscate`, `ReorderCode`, `FlatTransform`, `LockDomain`, and `LockDate`.
693
+ ```js
694
+ const protectParcelBuild = require("jso-protector/parcel");
693
695
 
694
- Use `reservedNames` to preserve public API names, framework entry points, globals, or names that external code calls. Each entry is a regular expression and is sent to the API as `VariableExclusion`. You can also set `variableExclusion` or `options.VariableExclusion` directly when you need a multiline value.
696
+ const options = {
697
+ apiKey: process.env.JSO_API_KEY,
698
+ apiPassword: process.env.JSO_API_PASSWORD
699
+ };
695
700
 
696
- ```json
697
- {
698
- "preset": "balanced",
699
- "reservedNames": ["^PublicApi$", "^renderWidget$", "^keep_"],
700
- "options": {
701
- "LockDomain": true,
702
- "LockDomainList": "example.com\napp.example.com",
703
- "LockDomainMsg": "This script is not licensed for this domain."
704
- }
705
- }
701
+ const plan = protectParcelBuild.planParcelBuild(options);
702
+ console.log(`Protecting ${plan.summary.files.length} Parcel file(s).`);
703
+ await protectParcelBuild(options);
706
704
  ```
707
705
 
708
- ## Named Configuration Sets
709
-
710
- Apply a different protection profile to different parts of one app in a
711
- single build with `namedSets`. Each set names an array of `match` globs and
712
- any of `preset`, `options`, and `countermeasures`; the first matching set
713
- wins per file (write sets in priority order), a set's options merge on top of
714
- the baseline, a set's preset contributes that preset's option block before
715
- the set's own options, and files matching no set keep the baseline exactly.
716
- Each set runs as its own API round, so a set your plan cannot afford fails
717
- only its own group.
706
+ For Bun builds, keep the same post-build pattern after `bun build`:
718
707
 
719
708
  ```json
720
709
  {
721
- "preset": "balanced",
722
- "namedSets": {
723
- "checkout": {
724
- "match": ["src/checkout/**", "src/wallet/**"],
725
- "preset": "maximum",
726
- "options": { "DeadcodeLevel": "High" }
727
- },
728
- "marketing": {
729
- "match": ["src/marketing/**"],
730
- "preset": "standard"
731
- }
710
+ "scripts": {
711
+ "build": "bun build ./src/index.ts --outdir ./dist --target browser",
712
+ "protect": "node ./scripts/protect-release.js",
713
+ "release": "bun run build && node ./scripts/protect-release.js --plan && node ./scripts/protect-release.js"
732
714
  }
733
715
  }
734
716
  ```
735
717
 
736
- The JSON summary reports the per-set grouping under `namedSetGroups`, and the
737
- manifest spans every group.
738
-
739
- ## Online Presets
740
-
741
- 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:
718
+ ```js
719
+ const protectBunBuild = require("jso-protector/bun");
742
720
 
743
- ```bash
744
- npx jso-protector --config jso.config.json --web-preset javascript-obfuscator-preset.json --dry-run --json
721
+ await protectBunBuild({
722
+ apiKey: process.env.JSO_API_KEY,
723
+ apiPassword: process.env.JSO_API_PASSWORD
724
+ });
745
725
  ```
746
726
 
747
- Or reference it from config:
748
-
749
- ```json
750
- {
751
- "webPreset": "javascript-obfuscator-preset.json",
752
- "input": "dist",
753
- "output": "dist-protected"
754
- }
755
- ```
727
+ For Next.js projects that use Turbopack in production, protect the emitted `.next/static/` chunks after `next build --turbopack` while excluding framework runtime files that should stay untouched:
756
728
 
757
- By default, the CLI ignores source maps, `node_modules`, and `*-obfuscated.js` files. When the output folder is nested under the input folder, reruns also skip that output folder so already protected files are not protected again. The CLI copies non-protected assets such as HTML, CSS, fonts, and images into the output folder. `assetExclude` keeps files such as source maps out of the protected release. Use `--no-copy-assets` or `"copyAssets": false` when another build step already handles assets.
729
+ ```js
730
+ const protectTurbopackBuild = require("jso-protector/turbopack");
758
731
 
759
- ## Package Verification
732
+ await protectTurbopackBuild({
733
+ apiKey: process.env.JSO_API_KEY,
734
+ apiPassword: process.env.JSO_API_PASSWORD
735
+ });
736
+ ```
760
737
 
761
- For ordinary development, run the deterministic verification chain with `npm run verify`. Before publishing or tagging an engine release, run the heavier release gate:
738
+ Copyable starter files for these post-build flows are included in `examples/parcel`, `examples/bun`, and `examples/turbopack`.
762
739
 
763
- ```bash
764
- npm run verify:release
765
- ```
740
+ ## Vite
766
741
 
767
- 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.
742
+ Protect emitted JavaScript chunks after Vite finishes bundling:
768
743
 
769
- To check only package installation behavior, run:
744
+ ```js
745
+ const jsoProtector = require("jso-protector/vite");
770
746
 
771
- ```bash
772
- npm run verify:package
747
+ module.exports = {
748
+ plugins: [
749
+ jsoProtector({
750
+ apiKey: process.env.JSO_API_KEY,
751
+ apiPassword: process.env.JSO_API_PASSWORD,
752
+ preset: "balanced",
753
+ exclude: ["**/vendor/**"],
754
+ manifest: "dist/jso-manifest.json"
755
+ })
756
+ ]
757
+ };
773
758
  ```
774
759
 
775
- The verifier packs the package, installs the tarball into a fresh temporary project, checks root and subpath exports, checks shipped example syntax/config JSON, runs the CLI through the installed bin link, and verifies the direct single-file output default.
760
+ The plugin removes stale JavaScript source maps by default. Pass `removeSourceMaps: false` only when another step regenerates or removes maps. When maps are removed, stale `sourceMappingURL` comments are stripped from the protected JavaScript so release artifacts do not point at missing `.map` files.
776
761
 
777
- ## Security and Processing
762
+ Bundler plugins use the same protection planner as the CLI and Node API, so `honorConditionalComments` and `protectMarkedComments` preserve marked JavaScript regions before chunks are sent to the hosted API.
778
763
 
779
- See `SECURITY.md` for the source-processing matrix, CI secret guidance, source-map policy, manifest metadata notes, and local-preflight guidance. Use `--release-check`, `--competitor-gap-report`, `--dry-run`, `--validate-config`, and `--doctor` when you need preflight checks before sending source code to the hosted API.
764
+ ## Rollup
780
765
 
781
- ## Live API Smoke Test
766
+ Use the Rollup entrypoint when your release build writes Rollup chunks directly:
782
767
 
783
- After setting `JSO_API_KEY` and `JSO_API_PASSWORD`, run a tiny live API check from this package directory:
768
+ ```js
769
+ const jsoProtector = require("jso-protector/rollup");
784
770
 
785
- ```bash
786
- npm run smoke:api
771
+ module.exports = {
772
+ plugins: [
773
+ jsoProtector({
774
+ apiKey: process.env.JSO_API_KEY,
775
+ apiPassword: process.env.JSO_API_PASSWORD,
776
+ preset: "balanced",
777
+ exclude: ["vendor.js"],
778
+ manifest: "dist/jso-manifest.json"
779
+ })
780
+ ]
781
+ };
787
782
  ```
788
783
 
789
- The command protects the sample file in `dist/` and writes the result to `dist-protected/`. Use `npm run smoke` when you only want offline validation and a dry run.
784
+ ## Webpack
790
785
 
791
- ## Doctor
786
+ Protect emitted JavaScript assets during the final asset phase. The plugin supports Webpack 5 through `processAssets` and falls back to the legacy `emit` hook for Webpack 4 projects:
792
787
 
793
- Run `release-check` before a release job when you want one CI-friendly report that combines config validation, dry-run file planning, and doctor checks:
788
+ ```js
789
+ const JsoProtectorWebpackPlugin = require("jso-protector/webpack");
794
790
 
795
- ```bash
796
- jso-protector --config jso.config.json --release-check
797
- jso-protector --config jso.config.json --release-check --json
798
- jso-protector --config jso.config.json --release-check --strict --json
791
+ module.exports = {
792
+ plugins: [
793
+ new JsoProtectorWebpackPlugin({
794
+ apiKey: process.env.JSO_API_KEY,
795
+ apiPassword: process.env.JSO_API_PASSWORD,
796
+ preset: "balanced",
797
+ exclude: ["vendor.js"],
798
+ manifest: "dist/jso-manifest.json"
799
+ })
800
+ ]
801
+ };
799
802
  ```
800
803
 
801
- Run `validate-config` first when you want a fast static check:
804
+ Like the Vite plugin, the Webpack plugin removes stale emitted source maps by default and strips stale `sourceMappingURL` comments from the protected assets. It respects configured protected extensions for emitted assets, so `.mjs` and `.cjs` library outputs can use the same plugin path. One package can cover both Webpack 4 and Webpack 5 release builds.
802
805
 
803
- ```bash
804
- jso-protector --config jso.config.json --validate-config
805
- jso-protector --config jso.config.json --validate-config --json
806
- jso-protector --config jso.config.json --validate-config --strict --json
807
- ```
806
+ ## Webpack Loader
808
807
 
809
- Run `doctor` before a release job to check config, credentials, paths, matched files, copied assets, output readiness, presets, and enabled options without sending source code to the API:
808
+ Use the loader when a Webpack project already protects selected modules before bundling. For complete release bundles, prefer the Webpack plugin because it protects final emitted assets and removes stale source maps.
810
809
 
811
- ```bash
812
- jso-protector --config jso.config.json --doctor
813
- jso-protector --config jso.config.json --doctor --json
810
+ ```js
811
+ module.exports = {
812
+ module: {
813
+ rules: [{
814
+ test: /\.js$/,
815
+ include: /src/,
816
+ use: [{
817
+ loader: "jso-protector/webpack-loader",
818
+ options: {
819
+ apiKey: process.env.JSO_API_KEY,
820
+ apiPassword: process.env.JSO_API_PASSWORD,
821
+ preset: "balanced",
822
+ include: ["src/*.js"],
823
+ reservedNames: ["^PublicApi$"]
824
+ }
825
+ }]
826
+ }]
827
+ }
828
+ };
814
829
  ```
815
830
 
816
- `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.
831
+ The loader disables Webpack caching for protected modules, returns no source map after protection, strips stale `sourceMappingURL` comments unless `removeSourceMaps: false` is set, and honors config files, `extensions`, `include`, `exclude`, manifests, and size budgets.
817
832
 
818
- 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.
833
+ ## Gulp
819
834
 
820
- Run the standalone competitor gap report when you want a machine-readable parity summary for migrated configs:
835
+ Use the Gulp entrypoint when a legacy release task copies files through Vinyl streams:
821
836
 
822
- ```bash
823
- jso-protector --config jso.config.json --competitor-gap-report --json
824
- ```
837
+ ```js
838
+ const { dest, src } = require("gulp");
839
+ const jsoProtector = require("jso-protector/gulp");
825
840
 
826
- When a migrated config used deterministic identifier caches or custom
827
- identifier dictionaries, generate a reviewer packet for that specific gap:
841
+ function protect() {
842
+ return src(["dist/**/*.js", "dist/**/*.{css,html,png,svg}", "!dist/**/*.map"], { base: "dist" })
843
+ .pipe(jsoProtector({
844
+ apiKey: process.env.JSO_API_KEY,
845
+ apiPassword: process.env.JSO_API_PASSWORD,
846
+ preset: "balanced",
847
+ exclude: ["**/vendor/**"],
848
+ manifest: "dist-protected/jso-manifest.json"
849
+ }))
850
+ .pipe(dest("dist-protected"));
851
+ }
828
852
 
829
- ```bash
830
- jso-protector --config jso.config.json --identifier-cache-review \
831
- --identifier-cache-review-output reports/identifier-cache-review.md
853
+ exports.protect = protect;
832
854
  ```
833
855
 
834
- The packet is source-free. It lists the migration field names, counts,
835
- replacement evidence tracks, and review decision without embedding cache
836
- contents, dictionary values, prefixes, reserved-name expressions, or source
837
- code. The Identifier Cache Review Assistant gives BYO AI or internal reviewers
838
- owner-action prompts for deterministic cache assumptions, custom dictionary
839
- replacement, reserved-name coverage, release metadata, and protected-build
840
- smoke without exposing raw config files, API credentials, provider keys,
841
- customer data, or secrets.
856
+ The Gulp transform batches buffered JavaScript files into one API request, passes non-JavaScript assets through, removes stale `.js.map` files by default, and strips stale `sourceMappingURL` comments from protected JavaScript. Pass `removeSourceMaps: false` only when another task handles maps.
842
857
 
843
- When a migrated config used anti-debug, self-defending, runtime lock, console,
844
- or countermeasure controls, generate the runtime-defense migration review:
858
+ ## Grunt
845
859
 
846
- ```bash
847
- jso-protector --config jso.config.json --runtime-defense-review \
848
- --runtime-defense-review-output reports/runtime-defense-review.md
860
+ Use the Grunt entrypoint when a release pipeline already uses Grunt file mappings:
861
+
862
+ ```js
863
+ module.exports = function configureGrunt(grunt) {
864
+ grunt.initConfig({
865
+ jsoProtector: {
866
+ release: {
867
+ options: {
868
+ apiKey: process.env.JSO_API_KEY,
869
+ apiPassword: process.env.JSO_API_PASSWORD,
870
+ input: "dist",
871
+ output: "dist-protected",
872
+ preset: "balanced",
873
+ exclude: ["**/vendor/**"],
874
+ manifest: "dist-protected/jso-manifest.json"
875
+ },
876
+ files: [{
877
+ expand: true,
878
+ cwd: "dist",
879
+ src: ["**/*.js", "!**/*.map"],
880
+ dest: "dist-protected"
881
+ }]
882
+ }
883
+ }
884
+ });
885
+
886
+ require("jso-protector/grunt")(grunt);
887
+ grunt.registerTask("protect", ["jsoProtector:release"]);
888
+ };
849
889
  ```
850
890
 
851
- The packet is source-free. It turns anti-debug, self-defending, runtime lock,
852
- console, and countermeasure migration settings into a reviewer checklist with
853
- monitoring target, customer-owned forwarding, countermeasure policy,
854
- domain/date lock, release metadata, compatibility scan, and protected-build
855
- smoke-test tracks. It omits domains, dates, redirect URLs, beacon URLs,
856
- countermeasure values, source code, protected output, and compatibility-scan
857
- source snippets. The Runtime Defense Review Assistant gives BYO AI or internal
858
- reviewers owner-action prompts for runtime behavior scope, monitoring handoff,
859
- countermeasure policy, domain/date lock smoke, source-reading compatibility
860
- scan, release metadata, and protected-build smoke without exposing raw config
861
- files, API credentials, provider keys, collector tokens, customer data, or
862
- secrets.
891
+ The Grunt task protects JavaScript file mappings and writes protected files to each mapping's `dest`. Use a copy task for non-JavaScript assets.
863
892
 
864
- Add `--check-api` to `release-check` or `doctor` when CI should send a tiny live request to verify the endpoint and credentials:
893
+ For bundle and stream plugins, `include` and `exclude` match emitted asset names. Use them to protect first-party release chunks while leaving vendor bundles, polyfills, and framework runtime files untouched.
865
894
 
866
- ```bash
867
- jso-protector --config jso.config.json --release-check --check-api --json
868
- jso-protector --config jso.config.json --doctor --check-api --json
895
+ ```js
896
+ jsoProtector({
897
+ preset: "balanced",
898
+ include: ["assets/*.js"],
899
+ exclude: ["**/vendor/**", "**/polyfills-*.js"],
900
+ maxOutputBytes: 250000,
901
+ maxGrowthRatio: 8
902
+ });
869
903
  ```
870
904
 
871
- ## Examples and CI Templates
905
+ The Browserify, esbuild, Vite, Rollup, Webpack, Webpack loader, Gulp, and Grunt integrations also honor `manifest`, `maxOutputBytes`, and `maxGrowthRatio`. A failed size budget stops the build before protected chunks replace the original bundle output.
872
906
 
873
- Copyable examples are included in `examples/`:
907
+ ## Configuration
874
908
 
875
- - `examples/cli-basic`
876
- - `examples/node-api`
877
- - `examples/parcel`
878
- - `examples/bun`
879
- - `examples/browserify`
880
- - `examples/metro.config.js`
881
- - `examples/nextjs`
882
- - `examples/turbopack`
883
- - `examples/rspack`
884
- - `examples/esbuild`
885
- - `examples/vite`
886
- - `examples/rollup`
887
- - `examples/webpack`
888
- - `examples/webpack-loader`
889
- - `examples/gulp`
890
- - `examples/grunt`
891
- - `examples/react-native/metro.config.js`
909
+ ```json
910
+ {
911
+ "$schema": "./node_modules/jso-protector/jso.config.schema.json",
912
+ "endpoint": "https://javascriptobfuscator.com/HttpApi.ashx",
913
+ "apiKey": "$JSO_API_KEY",
914
+ "apiPassword": "$JSO_API_PASSWORD",
915
+ "projectName": "browser-release",
916
+ "input": "dist",
917
+ "output": "dist-protected",
918
+ "preset": "balanced",
919
+ "extensions": [".js", ".jsx"],
920
+ "markupExtensions": [".html", ".htm", ".php", ".aspx"],
921
+ "exclude": ["**/*.map", "**/vendor/**", "**/*-obfuscated.js"],
922
+ "copyAssets": true,
923
+ "assetExclude": ["**/*.map"],
924
+ "mixedServer": false,
925
+ "parseHtml": false,
926
+ "honorConditionalComments": false,
927
+ "protectMarkedComments": false,
928
+ "keepHeaderComment": true,
929
+ "protectObjectDeclaration": false,
930
+ "moveNestedFunction": false,
931
+ "formattedOutput": false,
932
+ "keepIndent": false,
933
+ "lineNumbers": false,
934
+ "reservedNames": ["^PublicApi$", "^keep_"],
935
+ "options": {
936
+ "OptimizationMode": "Web",
937
+ "LockDomain": false,
938
+ "LockDate": false
939
+ }
940
+ }
941
+ ```
892
942
 
893
- `examples/node-api/release-summary.js` is the most complete custom-script starting point: it validates config, prints a dry release plan, protects files, and reports written files, copied assets, and manifest output.
943
+ 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`.
894
944
 
895
- CI templates are included in `ci/`:
945
+ 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.
896
946
 
897
- - `ci/github-actions.yml`
898
- - `ci/gitlab-ci.yml`
899
- - `ci/azure-pipelines.yml`
947
+ 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.
900
948
 
901
- The templates run `npm run verify:publish-metadata --if-present` so package projects can confirm the local-only metadata policy while application projects can ignore the optional script.
949
+ `--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`.
902
950
 
903
- ## Migrating from javascript-obfuscator
951
+ `--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.
904
952
 
905
- See `MIGRATION.md` when replacing the open-source `javascript-obfuscator` package or one of its bundler plugins with the hosted JavaScript Obfuscator API workflow. It covers command changes, concept mapping, direct Node API replacement, bundle-plugin replacement, and a migration checklist.
953
+ 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.
906
954
 
907
- For JS-Confuser projects, the same package now includes `--migrate-js-confuser`, `--list-js-confuser-migration-map`, `--explain-js-confuser-compat`, and `translateJsConfuserOptions(...)` so you can generate a starter `jso.config.json` and review the runtime-only gaps before switching release pipelines.
955
+ 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`.
908
956
 
909
- ## GitHub Actions
957
+ 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.
910
958
 
911
- Store `JSO_API_KEY` and `JSO_API_PASSWORD` as encrypted repository or organization secrets, then run release preflight and protection after your normal frontend build:
959
+ ```js
960
+ module.exports = ({ env, mode }) => ({
961
+ apiKey: "$JSO_API_KEY",
962
+ apiPassword: "$JSO_API_PASSWORD",
963
+ input: env.CI ? "dist" : "demo-dist",
964
+ output: mode === "staging" ? "dist-staging-protected" : "dist-protected",
965
+ preset: mode === "staging" ? "standard" : "balanced",
966
+ reservedNames: ["^PublicApi$"],
967
+ options: {
968
+ LockDomain: Boolean(env.RELEASE_DOMAIN),
969
+ LockDomainList: env.RELEASE_DOMAIN || ""
970
+ }
971
+ });
972
+ ```
912
973
 
913
- ```yaml
914
- name: protected-release
974
+ JavaScript config files execute as Node.js code, so only load config files from your own repository or another trusted source. Use JSON config when you want schema validation and no executable config logic.
915
975
 
916
- on:
917
- workflow_dispatch:
976
+ ES module configs can use `export default { ... }` or `export default ({ env, cwd, mode }) => ({ ... })`. This covers `jso.config.mjs` and `jso.config.js` inside repositories that already use `"type": "module"`.
918
977
 
919
- jobs:
920
- release:
921
- runs-on: ubuntu-latest
922
- steps:
923
- - uses: actions/checkout@v4
924
- - uses: actions/setup-node@v4
925
- with:
926
- node-version: 22
927
- cache: npm
928
- - run: npm ci
929
- - run: npm run build
930
- - run: npm run verify:package --if-present
931
- - run: npm run verify:publish-metadata --if-present
932
- - name: Release preflight
933
- run: npx jso-protector --config jso.config.json --release-check --json
934
- env:
935
- JSO_API_KEY: ${{ secrets.JSO_API_KEY }}
936
- JSO_API_PASSWORD: ${{ secrets.JSO_API_PASSWORD }}
937
- - name: Protect JavaScript
938
- run: npx jso-protector --config jso.config.json --manifest dist-protected/jso-manifest.json
939
- env:
940
- JSO_API_KEY: ${{ secrets.JSO_API_KEY }}
941
- JSO_API_PASSWORD: ${{ secrets.JSO_API_PASSWORD }}
942
- - run: npm run smoke
943
- - uses: actions/upload-artifact@v4
944
- with:
945
- name: protected-dist
946
- path: |
947
- dist-protected/
948
- dist-protected/jso-manifest.json
949
- ```
978
+ `apiKey` and `apiPassword` should use the base64 values copied from the JavaScript Obfuscator dashboard. Environment references in the form `$NAME` are resolved at runtime.
950
979
 
951
- ## Working from a local checkout
980
+ Do not commit real API credentials. Keep `apiKey` and `apiPassword` as environment references in shared config files.
952
981
 
953
- Published releases install from the registry with
954
- `npm install --save-dev jso-protector`. The paths below are for building the
955
- package from a checkout of this repository — internal testing, a release
956
- candidate, or an air-gapped install.
982
+ The CLI reads `JSO_API_KEY`, `JSO_API_PASSWORD`, and `JSO_ENDPOINT` by default. It also accepts long-form aliases: `JAVASCRIPT_OBFUSCATOR_API_KEY`, `JAVASCRIPT_OBFUSCATOR_API_PASSWORD`, and `JAVASCRIPT_OBFUSCATOR_ENDPOINT`.
957
983
 
958
- Install the workspace copy directly:
984
+ ## Presets and Public Names
959
985
 
960
- ```bash
961
- npm install --save-dev ./packages/jso-protector
962
- ```
986
+ Use `preset` to start from a repeatable protection profile:
963
987
 
964
- Or pin it from another app in the same workspace:
988
+ - `standard`: core string encoding, string movement, name replacement, and compression.
989
+ - `balanced`: standard plus short local names, deep obfuscation, code transposition, string encryption, and flat transform.
990
+ - `maximum`: balanced plus member/global renaming, member movement, and low dead-code insertion.
991
+
992
+ Override or extend any preset with `options`. The option names are the same names sent to `HttpApi.ashx`, such as `EncodeStrings`, `DeepObfuscate`, `ReorderCode`, `FlatTransform`, `LockDomain`, and `LockDate`.
993
+
994
+ Use `reservedNames` to preserve public API names, framework entry points, globals, or names that external code calls. Each entry is a regular expression and is sent to the API as `VariableExclusion`. You can also set `variableExclusion` or `options.VariableExclusion` directly when you need a multiline value.
965
995
 
966
996
  ```json
967
997
  {
968
- "devDependencies": {
969
- "jso-protector": "file:../packages/jso-protector"
998
+ "preset": "balanced",
999
+ "reservedNames": ["^PublicApi$", "^renderWidget$", "^keep_"],
1000
+ "options": {
1001
+ "LockDomain": true,
1002
+ "LockDomainList": "example.com\napp.example.com",
1003
+ "LockDomainMsg": "This script is not licensed for this domain."
970
1004
  }
971
1005
  }
972
1006
  ```
973
1007
 
974
- For internal sharing without going through the registry, build a tarball and
975
- install that artifact in the consuming project:
976
-
977
- ```bash
978
- npm pack --json
979
- npm install --save-dev path/to/jso-protector-0.4.0.tgz
980
- ```
1008
+ ## Named Configuration Sets
981
1009
 
982
- Keep those tarballs in internal storage or build artifacts. `prepublishOnly`
983
- runs the full verification chain before any real publish, so a release cannot
984
- go out on an unverified tree.
1010
+ Apply a different protection profile to different parts of one app in a
1011
+ single build with `namedSets`. Each set names an array of `match` globs and
1012
+ any of `preset`, `options`, and `countermeasures`; the first matching set
1013
+ wins per file (write sets in priority order), a set's options merge on top of
1014
+ the baseline, a set's preset contributes that preset's option block before
1015
+ the set's own options, and files matching no set keep the baseline exactly.
1016
+ Each set runs as its own API round, so a set your plan cannot afford fails
1017
+ only its own group.
985
1018
 
986
- ## Release Checklist
1019
+ ```json
1020
+ {
1021
+ "preset": "balanced",
1022
+ "namedSets": {
1023
+ "checkout": {
1024
+ "match": ["src/checkout/**", "src/wallet/**"],
1025
+ "preset": "maximum",
1026
+ "options": { "DeadcodeLevel": "High" }
1027
+ },
1028
+ "marketing": {
1029
+ "match": ["src/marketing/**"],
1030
+ "preset": "standard"
1031
+ }
1032
+ }
1033
+ }
1034
+ ```
987
1035
 
988
- 1. Build unprotected JavaScript into a temporary output folder.
989
- 2. Run `jso-protector --release-check --json` to validate config, confirm the file list, and check paths, assets, output readiness, presets, and enabled options before source is sent.
990
- 3. Protect into a separate output folder such as `dist-protected` and write `dist-protected/jso-manifest.json`.
991
- 4. Run browser smoke tests against the protected output.
992
- 5. Run `jso-protector --verify-manifest dist-protected/jso-manifest.json --audit-source-maps` before publishing or after unpacking release artifacts.
993
- 6. Publish only the protected artifacts and release manifest.
1036
+ The JSON summary reports the per-set grouping under `namedSetGroups`, and the
1037
+ manifest spans every group.
994
1038
 
995
- ## Notes
1039
+ ## Online Presets
996
1040
 
997
- - The CLI sends file contents to the configured HTTP API endpoint.
998
- - The desktop app also sends selected JavaScript to the hosted service. Use local preflight only when policy forbids source transfer; current protection workflows do not meet that requirement.
999
- - The HTTP API is for paid accounts.
1000
- - The CLI expects the API response shape used by `HttpApi.ashx`: `Type`, `Items`, `Message`, `FileName`, and optional error fields.
1041
+ 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:
1001
1042
 
1002
- ## Payment and API Access
1043
+ ```bash
1044
+ npx jso-protector --config jso.config.json --web-preset javascript-obfuscator-preset.json --dry-run --json
1045
+ ```
1003
1046
 
1004
- This package is a client. It drives the hosted API by default, or the bundled `jso-local` protector with `--local`. Protection itself, billing and every plan limit live on the server, never in this package.
1047
+ Or reference it from config:
1005
1048
 
1006
- A request with no credentials is served on the **free tier**: up to 20 files and 200 KB per request, rate limited per IP, no VM protection. Everything above that is a paid plan, enforced server-side.
1049
+ ```json
1050
+ {
1051
+ "webPreset": "javascript-obfuscator-preset.json",
1052
+ "input": "dist",
1053
+ "output": "dist-protected"
1054
+ }
1055
+ ```
1007
1056
 
1008
- Payment and account enforcement stay on `javascriptobfuscator.com`:
1057
+ By default, the CLI ignores source maps, `node_modules`, and `*-obfuscated.js` files. When the output folder is nested under the input folder, reruns also skip that output folder so already protected files are not protected again. The CLI copies non-protected assets such as HTML, CSS, fonts, and images into the output folder. `assetExclude` keeps files such as source maps out of the protected release. Use `--no-copy-assets` or `"copyAssets": false` when another build step already handles assets.
1009
1058
 
1010
- 1. The user buys a plan or credits on the JavaScript Obfuscator website.
1011
- 2. The dashboard provides `JSO_API_KEY` and `JSO_API_PASSWORD`.
1012
- 3. By default the local npm CLI sends selected JavaScript to the configured HTTPS API endpoint.
1013
- 4. The hosted API validates the account, plan, limits, and credentials before returning protected code.
1059
+ ## Package Verification
1014
1060
 
1015
- With `--local` the source body stays on the build machine and step 3 does not
1016
- happen, but entitlement is still enforced server-side: the run makes a
1017
- source-free plan/option check before protecting. Either way, billing and plan
1018
- limits live on the server, never in this package.
1061
+ For ordinary development, run the deterministic verification chain with `npm run verify`. Before publishing or tagging an engine release, run the heavier release gate:
1019
1062
 
1020
- 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.
1063
+ ```bash
1064
+ npm run verify:release
1065
+ ```
1021
1066
 
1022
- 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.
1067
+ 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.
1023
1068
 
1024
- ### Sign in once
1069
+ To check only package installation behavior, run:
1025
1070
 
1026
1071
  ```bash
1027
- npx javascriptobfuscator login
1072
+ npm run verify:package
1028
1073
  ```
1029
1074
 
1030
- This opens the dashboard, takes the API Key and API Password (the password is
1031
- not echoed), and stores them in `~/.jso-protector/credentials.json` for every
1032
- project on the machine. `npx javascriptobfuscator logout` removes them.
1075
+ The verifier packs the package, installs the tarball into a fresh temporary project, checks root and subpath exports, checks shipped example syntax/config JSON, runs the CLI through the installed bin link, and verifies the direct single-file output default.
1033
1076
 
1034
- The store is written `0600`. That is real protection on POSIX; Windows does not
1035
- honour the mode, so there the file is only as protected as your user profile
1036
- directory - the same position as `~/.npmrc`.
1077
+ ## Security and Processing
1037
1078
 
1038
- ### Or set them per shell
1079
+ See `SECURITY.md` for the source-processing matrix, CI secret guidance, source-map policy, manifest metadata notes, and local-preflight guidance. Use `--release-check`, `--competitor-gap-report`, `--dry-run`, `--validate-config`, and `--doctor` when you need preflight checks before sending source code to the hosted API.
1039
1080
 
1040
- Stored credentials are read **last**, so an explicit flag, a project config, or
1041
- these environment variables always win - a CI setup is unaffected by whatever a
1042
- developer has logged in with locally.
1081
+ ## Live API Smoke Test
1082
+
1083
+ After setting `JSO_API_KEY` and `JSO_API_PASSWORD`, run a tiny live API check from this package directory:
1043
1084
 
1044
1085
  ```bash
1045
- set JSO_API_KEY=base64-api-key-from-dashboard
1046
- set JSO_API_PASSWORD=base64-api-password-from-dashboard
1086
+ npm run smoke:api
1047
1087
  ```
1048
1088
 
1049
- For macOS/Linux shells:
1089
+ The command protects the sample file in `dist/` and writes the result to `dist-protected/`. Use `npm run smoke` when you only want offline validation and a dry run.
1090
+
1091
+ ## Doctor
1092
+
1093
+ Run `release-check` before a release job when you want one CI-friendly report that combines config validation, dry-run file planning, and doctor checks:
1050
1094
 
1051
1095
  ```bash
1052
- export JSO_API_KEY=base64-api-key-from-dashboard
1053
- export JSO_API_PASSWORD=base64-api-password-from-dashboard
1096
+ jso-protector --config jso.config.json --release-check
1097
+ jso-protector --config jso.config.json --release-check --json
1098
+ jso-protector --config jso.config.json --release-check --strict --json
1054
1099
  ```
1055
1100
 
1056
- Protect generated build output:
1101
+ Run `validate-config` first when you want a fast static check:
1057
1102
 
1058
1103
  ```bash
1059
- npx jso-protector --config jso.config.json
1104
+ jso-protector --config jso.config.json --validate-config
1105
+ jso-protector --config jso.config.json --validate-config --json
1106
+ jso-protector --config jso.config.json --validate-config --strict --json
1060
1107
  ```
1061
1108
 
1062
- ### Runtime recovery and enterprise governance foundations
1109
+ Run `doctor` before a release job to check config, credentials, paths, matched files, copied assets, output readiness, presets, and enabled options without sending source code to the API:
1063
1110
 
1064
- Browser-targeted API options now support bounded local recovery with
1065
- `SelfDefending`, `SelfHealing`, and `SelfHealingMaxAttempts`. A successful
1066
- repair emits a `self-healed-*` runtime event; when repair is unavailable or
1067
- exhausted, `RuntimeDefenseAction` can use `throw`, `blank`, `redirect`,
1068
- `reload`, `callback`, or `degrade`. Local recovery handles mutation after the
1069
- wrapper starts and does not claim to repair a bundle modified before startup.
1111
+ ```bash
1112
+ jso-protector --config jso.config.json --doctor
1113
+ jso-protector --config jso.config.json --doctor --json
1114
+ ```
1070
1115
 
1071
- Release automation can import `jso-protector/governance` for shared RBAC,
1072
- scoped-token descriptors, SHA-256 hash-chained audit events, validated
1073
- OIDC/SAML trust configuration, an organization directory, and a SCIM 2.0
1074
- `/Users` service core with bearer authentication, filtering, role updates, and
1075
- deactivation. Deployments still need to mount the service behind HTTPS and
1076
- persist directory changes in their account store.
1116
+ `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.
1077
1117
 
1078
- `jso-protector/runtime/third-party-inventory` supports
1079
- `enforcementMode: "block"` for synchronous origin and late-injection decisions
1080
- on dynamically-created scripts. `jso-protector/runtime/managed-integrity` adds
1081
- versioned monitor/block policies, inventory evaluation, deduplicated incidents,
1082
- assignment/status transitions, and JSON export for hosted or on-prem operations.
1083
- `jso-protector/runtime/data-exfiltration-guard` adds opt-in monitor/block controls
1084
- for protected-field data sent through fetch, XHR, sendBeacon, WebSocket, or
1085
- programmatic form submission. Allow approved destinations explicitly and begin
1086
- in monitor mode. Evidence contains field names and counts, never captured values
1087
- or request bodies; encoded/encrypted bodies and script attribution remain stated
1088
- browser-runtime limitations.
1118
+ 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.
1089
1119
 
1090
- Compare a migrated config against common JavaScript obfuscator capabilities:
1120
+ Run the standalone competitor gap report when you want a machine-readable parity summary for migrated configs:
1091
1121
 
1092
1122
  ```bash
1093
- npx jso-protector --config jso.config.json --competitor-gap-report
1094
- npx jso-protector --config jso.config.json --competitor-gap-report --json
1095
- npx jso-protector --config jso.config.json --migration-review \
1096
- --migration-review-output reports/migration-review.md
1097
- npx jso-protector --config jso.config.json --identifier-cache-review \
1098
- --identifier-cache-review-output reports/identifier-cache-review.md
1099
- npx jso-protector --config jso.config.json --runtime-defense-review \
1100
- --runtime-defense-review-output reports/runtime-defense-review.md
1123
+ jso-protector --config jso.config.json --competitor-gap-report --json
1101
1124
  ```
1102
1125
 
1103
- The gap report groups parity into covered, partial, and gap areas across common
1104
- competitor surfaces such as control-flow flattening, string hiding, domain/date
1105
- locks, runtime monitoring, hosted dashboard intake, countermeasures, source
1106
- maps, and release forensics. It names Obfuscator.io, javascript-obfuscator,
1107
- JS-Confuser, Jscrambler, and JSDefender so migration reviews can separate exact
1108
- matches from features that need manual validation. Runtime-defense parity is
1109
- reported as partial: route `RuntimeDefenseBeaconUrl` to your monitoring stack
1110
- or the hosted `/v1/runtime/beacon.ashx` intake for first triage, then validate
1111
- any migrated anti-debug/self-defending switches manually. Use it after
1112
- `--migrate-javascript-obfuscator` or `--migrate-js-confuser` to keep
1113
- runtime-defense, source-map, and release-readiness assumptions visible in CI.
1114
- The JSON and text output include a dated source snapshot of the public
1115
- competitor pages reviewed for this migration framing, plus a reminder to
1116
- re-check current vendor pages before publishing named competitive claims.
1117
- The report also includes a source-free Competitor Gap Review Assistant for BYO
1118
- AI or internal reviewers. It turns gap prioritization, partial-parity
1119
- validation, triggered migration limitations, source-reading scan boundaries,
1120
- vendor-claim freshness, and plan handoff into owner actions without sharing
1121
- source code, protected output, API credentials, provider keys, customer data,
1122
- or secrets.
1123
- When source-map, identifier-cache, custom-dictionary, or runtime-defense
1124
- limitations are present, the report also includes `reviewArtifacts`: source-free
1125
- release-check, competitor-gap, all-up migration-review, source-map-evidence,
1126
- and identifier-cache replacement review commands, a source-free runtime-defense
1127
- review command, and a separate source-reading compatibility scan when
1128
- runtime-defense switches need manual validation.
1129
- Use `--migration-review` when a migrated config still carries any accepted
1130
- competitor-only fields. The generated Markdown packet gives release owners one
1131
- source-free checklist across source-map policy, identifier-cache replacement,
1132
- runtime-defense behavior, CLI compatibility warnings, saved report/manifest
1133
- readiness, follow-up commands, and protected-build smoke evidence without
1134
- embedding source code, protected output, source-map contents, cache contents,
1135
- dictionary values, prefixes, domains, URLs, dates, seed values, or reserved
1136
- expressions. The packet includes a Migration Review Assistant for BYO AI or
1137
- internal reviewers, turning manual review tracks, source-map policy,
1138
- identifier-cache replacement, runtime-defense behavior, source-reading command
1139
- boundaries, release metadata, and protected-build smoke into owner actions
1140
- without sharing raw config files, API credentials, provider keys, customer data,
1141
- or secrets.
1142
- Use `--identifier-cache-review` when a migrated config still carries
1143
- `identifierNamesCache`, `identifierNamesCachePath`, `identifiersDictionary`, or
1144
- `identifiersPrefix`. The generated Markdown packet gives release owners a
1145
- source-free checklist for replacing deterministic cache assumptions with
1146
- reserved-name review, saved API report, release manifest, and protected-build
1147
- smoke evidence without embedding cache contents, dictionary values, prefixes,
1148
- reserved-name expressions, or source code. It includes an Identifier Cache
1149
- Review Assistant for BYO AI or internal reviewers, turning deterministic cache
1150
- assumptions, custom dictionary replacement, reserved-name coverage, release
1151
- metadata, and protected-build smoke into owner actions without sharing raw
1152
- config files, API credentials, provider keys, customer data, or secrets.
1153
- Use `--runtime-defense-review` when a migrated config still carries anti-debug,
1154
- self-defending, runtime lock, console, and countermeasure migration settings.
1155
- The generated packet lists field names, configured evidence tracks, review
1156
- decision, monitoring and smoke-test follow-ups, and safe-sharing boundaries
1157
- without embedding domains, dates, redirect URLs, beacon URLs, countermeasure
1158
- values, source code, or protected output. It includes a Runtime Defense Review
1159
- Assistant for BYO AI or internal reviewers, turning runtime behavior scope,
1160
- monitoring handoff, countermeasure policy, domain/date lock smoke,
1161
- source-reading compatibility scan, release metadata, and protected-build smoke
1162
- into owner actions without sharing raw config files, API credentials, provider
1163
- keys, collector tokens, customer data, or secrets.
1164
-
1165
- Protect one file through a shell pipe:
1126
+ When a migrated config used deterministic identifier caches or custom
1127
+ identifier dictionaries, generate a reviewer packet for that specific gap:
1166
1128
 
1167
1129
  ```bash
1168
- type dist\app.js | npx jso-protector --stdin --stdout --file-name app.js > dist\app.protected.js
1130
+ jso-protector --config jso.config.json --identifier-cache-review \
1131
+ --identifier-cache-review-output reports/identifier-cache-review.md
1169
1132
  ```
1170
1133
 
1171
- ## Deployment Hygiene Evidence
1134
+ The packet is source-free. It lists the migration field names, counts,
1135
+ replacement evidence tracks, and review decision without embedding cache
1136
+ contents, dictionary values, prefixes, reserved-name expressions, or source
1137
+ code. The Identifier Cache Review Assistant gives BYO AI or internal reviewers
1138
+ owner-action prompts for deterministic cache assumptions, custom dictionary
1139
+ replacement, reserved-name coverage, release metadata, and protected-build
1140
+ smoke without exposing raw config files, API credentials, provider keys,
1141
+ customer data, or secrets.
1172
1142
 
1173
- When `tools/Build-UpdatedArchives.ps1 -ReportPath _temp/archive-hygiene.json`
1174
- creates an updated-files archive hygiene report, turn it into a source-free
1175
- reviewer packet before sharing the zip:
1143
+ When a migrated config used anti-debug, self-defending, runtime lock, console,
1144
+ or countermeasure controls, generate the runtime-defense migration review:
1176
1145
 
1177
1146
  ```bash
1178
- npx jso-protector \
1179
- --deployment-hygiene-evidence _temp/archive-hygiene.json \
1180
- --deployment-hygiene-output reports/deployment-hygiene.md
1147
+ jso-protector --config jso.config.json --runtime-defense-review \
1148
+ --runtime-defense-review-output reports/runtime-defense-review.md
1181
1149
  ```
1182
1150
 
1183
- The packet summarizes archive names, entry counts, byte sizes, missing required
1184
- entries, blocked entries, blocked category booleans, the exclusion policy,
1185
- operator checklist, rotation triggers, hygiene-report SHA-256, and a Deployment Hygiene Review Assistant for BYO AI or internal reviewers. It does not include
1186
- `Web.config` contents, raw secrets, provider keys, webhook signing secrets,
1187
- database strings, host-specific deployment transforms, customer data, or source
1188
- code. It exits nonzero when the archive builder reported blocked deployment
1189
- files or missing required entries, while still writing the failed packet for
1190
- internal remediation.
1191
-
1192
- ## Payment-page evidence reports
1193
-
1194
- For checkout, wallet, subscription, activation, and license pages, pair the
1195
- signed release manifest with a payment-page script inventory and Dashboard
1196
- Monitoring incident history. Export runtime incidents CSV or JSON from the
1197
- dashboard, keep a CSV or JSON list of payment-page scripts with authorization
1198
- and written justification, and attach a payment-page security-header snapshot
1199
- when reviewers ask for CSP/header change evidence. Include these source-free
1200
- attachments in the PCI DSS v4 report. Start from
1201
- `examples/payment-page-script-inventory.json` and
1202
- `examples/payment-page-security-headers.json` when you need the expected JSON
1203
- field names, or generate a review starter from a saved
1204
- `third-party-inventory` runtime snapshot:
1151
+ The packet is source-free. It turns anti-debug, self-defending, runtime lock,
1152
+ console, and countermeasure migration settings into a reviewer checklist with
1153
+ monitoring target, customer-owned forwarding, countermeasure policy,
1154
+ domain/date lock, release metadata, compatibility scan, and protected-build
1155
+ smoke-test tracks. It omits domains, dates, redirect URLs, beacon URLs,
1156
+ countermeasure values, source code, protected output, and compatibility-scan
1157
+ source snippets. The Runtime Defense Review Assistant gives BYO AI or internal
1158
+ reviewers owner-action prompts for runtime behavior scope, monitoring handoff,
1159
+ countermeasure policy, domain/date lock smoke, source-reading compatibility
1160
+ scan, release metadata, and protected-build smoke without exposing raw config
1161
+ files, API credentials, provider keys, collector tokens, customer data, or
1162
+ secrets.
1163
+
1164
+ Add `--check-api` to `release-check` or `doctor` when CI should send a tiny live request to verify the endpoint and credentials:
1205
1165
 
1206
1166
  ```bash
1207
- npx jso-protector \
1208
- --script-inventory-from-snapshot reports/runtime-inventory.json \
1209
- --script-inventory-output reports/payment-script-inventory.json
1167
+ jso-protector --config jso.config.json --release-check --check-api --json
1168
+ jso-protector --config jso.config.json --doctor --check-api --json
1210
1169
  ```
1211
1170
 
1212
- If your checkout evidence starts as a browser or synthetic-monitor HAR export,
1213
- convert the document and iframe responses into the same source-free
1214
- security-header snapshot. The converter keeps CSP, HSTS, frame/referrer policy,
1215
- reporting endpoint, and related security headers, drops raw cookies and other
1216
- non-security headers, and stores a SHA-256 over each canonical selected-header
1217
- snapshot. Keep the last approved snapshot in your evidence repository and pass
1218
- it as `--payment-page-headers-baseline` when you want the new HAR export to
1219
- mark each checkout page or frame as `match`, `mismatch`, or `missing` for
1220
- security-header change review. The generated snapshot also includes a
1221
- source-free security-header Review Assistant Packet for BYO AI or internal
1222
- reviewers. It focuses the review on baseline drift, CSP/reporting, HSTS, and
1223
- frame-policy owner actions while reminding teams not to include
1224
- raw response headers, cookies, source code, payment data, customer data, provider keys, or
1225
- secrets.
1171
+ ## Examples and CI Templates
1226
1172
 
1227
- ```bash
1228
- npx jso-protector \
1229
- --payment-page-headers-from-har reports/checkout.har \
1230
- --payment-page-headers-baseline reports/payment-page-headers.baseline.json \
1231
- --payment-page-headers-output reports/payment-page-headers.json \
1232
- --payment-page-url-pattern "checkout|payment|wallet"
1233
- ```
1173
+ Copyable examples are included in `examples/`:
1234
1174
 
1235
- Review the generated script inventory file before audit use. Set `authorized`, add written
1236
- `justification`, assign `owner`, and fill `lastReviewedUtc` for every approved
1237
- payment-page script. Add `risk`, `dataAccess`, and `approvalTicket` when your
1238
- checkout review process tracks risk-based decisions or change approvals. Add
1239
- `checkoutSurface`, `frameContext`, `frameOwner`, `parentPageHref`, `frameHref`,
1240
- and `frameOrigin` when your payment flow has a parent page, hosted checkout
1241
- page, PSP iframe, or embedded payment frame that reviewers need to distinguish.
1242
- The
1243
- audit packet fails only on blocking script drift or required metadata gaps; it
1244
- also calls out missing optional review context so checkout owners can improve
1245
- QSA handoff quality without breaking an otherwise clean release. Before handing
1246
- the packet to reviewers, reconcile the approved inventory against a fresh
1247
- runtime snapshot:
1175
+ - `examples/cli-basic`
1176
+ - `examples/node-api`
1177
+ - `examples/parcel`
1178
+ - `examples/bun`
1179
+ - `examples/browserify`
1180
+ - `examples/metro.config.js`
1181
+ - `examples/nextjs`
1182
+ - `examples/turbopack`
1183
+ - `examples/rspack`
1184
+ - `examples/esbuild`
1185
+ - `examples/vite`
1186
+ - `examples/rollup`
1187
+ - `examples/webpack`
1188
+ - `examples/webpack-loader`
1189
+ - `examples/gulp`
1190
+ - `examples/grunt`
1191
+ - `examples/react-native/metro.config.js`
1248
1192
 
1249
- ```bash
1250
- npx jso-protector \
1251
- --script-inventory-audit reports/payment-script-inventory.json \
1252
- --runtime-inventory-snapshot reports/runtime-inventory.json \
1253
- --script-inventory-audit-output reports/payment-script-inventory-audit.json \
1254
- --json
1255
- ```
1193
+ `examples/node-api/release-summary.js` is the most complete custom-script starting point: it validates config, prints a dry release plan, protects files, and reports written files, copied assets, and manifest output.
1256
1194
 
1257
- The audit is local and source-free. It reports unknown observed scripts,
1258
- scripts observed while marked unauthorized, approved scripts missing from the
1259
- page, hash mismatches, scripts injected after page load, runtime violation
1260
- reasons, and missing inventory metadata. Omit `--json` or use a `.md` output
1261
- path when a standalone human-readable packet is preferred.
1195
+ CI templates are included in `ci/`:
1262
1196
 
1263
- In GitHub Actions, the bundled JSO action exposes the same audit,
1264
- security-header snapshot, and PCI DSS v4 reviewer packet as opt-in workflow
1265
- steps: set
1266
- `payment-script-inventory`, `runtime-inventory-snapshot`, and optionally
1267
- `script-inventory-audit-report` to fail the release job on payment-page script
1268
- drift; set `payment-page-har`, optionally `payment-page-url-pattern`, and
1269
- optionally `payment-page-headers-baseline` and `payment-page-headers-report` to
1270
- convert a checkout HAR into the same source-free header evidence artifact and
1271
- mark baseline matches, mismatches, or missing pages; set `pci-dss-v4-evidence` with
1272
- `pci-dss-v4-report` and `pci-dss-v4-json-report` to assemble the Markdown and
1273
- JSON PCI evidence report from the protected manifest plus those attachments.
1274
- Use `manifest`, `sign-release-key`, `watermark`, and `watermark-key` when this
1275
- report needs to pass rather than document incomplete evidence. The action adds
1276
- a step summary and workflow annotations for the first audit, header, or PCI
1277
- findings so reviewers can see drift directly in the CI run.
1197
+ - `ci/github-actions.yml`
1198
+ - `ci/gitlab-ci.yml`
1199
+ - `ci/azure-pipelines.yml`
1278
1200
 
1279
- ```bash
1280
- npx jso-protector compliance pci-dss-v4 \
1281
- --manifest dist-protected/jso-manifest.json.sig \
1282
- --root dist-protected \
1283
- --watermark-key "$JSO_WATERMARK_KEY" \
1284
- --beacon-url "https://javascriptobfuscator.com/v1/runtime/beacon.ashx" \
1285
- --siem splunk-hec \
1286
- --script-inventory reports/payment-script-inventory.json \
1287
- --script-inventory-audit reports/payment-script-inventory-audit.json \
1288
- --payment-page-headers reports/payment-page-headers.json \
1289
- --runtime-incidents reports/runtime-incidents.json \
1290
- --organization "Example Corp" \
1291
- --output reports/pci-dss-v4.md
1292
- ```
1201
+ The templates run `npm run verify:publish-metadata --if-present` so package projects can confirm the local-only metadata policy while application projects can ignore the optional script.
1293
1202
 
1294
- The report hashes and summarizes these attachments, then adds a source-free PCI
1295
- DSS Review Assistant for BYO AI or internal reviewers. The assistant turns
1296
- evidence gaps, signed-release proof, script authorization, observed script
1297
- drift, header change evidence, runtime incident routing, and QSA handoff
1298
- boundaries into checkout-owner actions without sharing source code, protected
1299
- output, raw script rows, raw response headers, raw incident payloads,
1300
- payment-card data, provider keys, customer data, or secrets. Script inventory evidence is
1301
- summarized by authorization, justification, owner, domain, review range, and
1302
- integrity-reference coverage. When the inventory includes `risk`, `dataAccess`,
1303
- `approvalTicket`, `checkoutSurface`, `frameContext`, and `frameOwner`, the
1304
- report summarizes those fields, including iframe-scoped script counts, without
1305
- embedding every script row. Security-header evidence is summarized by CSP,
1306
- `script-src`, `frame-src`, reporting endpoint, HSTS, referrer-policy,
1307
- baseline-hash match/mismatch/missing state, checkout surface, frame context, monitor, alert
1308
- route, domain, observed range, and SHA-256 without embedding every raw page
1309
- row. Runtime incident evidence is summarized by status, severity,
1310
- open/reviewing count, per-incident next owner and due state, repeated-signal correlation, date range, Build IDs, and SHA-256. The Markdown does not
1311
- embed every incident URL, user agent, script row, or raw header snapshot, so it
1312
- can be handed to reviewers while the CSV or JSON exports remain the source-free
1313
- attachments. The report supports QSA-led assessment; it is not itself a Report
1314
- on Compliance.
1315
- When a Dashboard Monitoring JSON export includes filters such as
1316
- `runtime_status=active`, `runtime_severity=high-critical`, or
1317
- `runtime_build=checkout-2026-06-07`, the report keeps that filter context in
1318
- the runtime incident evidence table. The Dashboard JSON export also carries a
1319
- source-free summary block with status/severity counts, active high-risk count,
1320
- payload-hash coverage, BuildIDs, event/received date ranges, per-incident action-plan owner/due/status metadata, repeated fingerprint/reason groups, a routing
1321
- recommendation, an alert routing playbook, and a response checklist before the incident rows. Dashboard
1322
- Monitoring shows the same routing recommendation on the current filtered view
1323
- before export, including response target, next status action, and playbook
1324
- lanes for security response, customer-owned alerting, support handoff, and
1325
- reviewer packets. The JSON export also includes source-free dashboard action
1326
- metadata, such as the filtered "Move open in view to Reviewing" status action,
1327
- plus per-row action plans that name the next owner, evidence packet, response due state, and status move, so support automation can tell account owners what to do next without scraping
1328
- dashboard HTML. The PCI
1329
- evidence report preserves those Dashboard JSON fields so support and reviewers
1330
- can see whether the packet belongs in runtime triage, security response, or
1331
- archive evidence. The response checklist and alert routing playbook carry
1332
- owners, response targets, scope confirmation, downstream routing, and
1333
- safe-sharing boundaries for reviewer
1334
- or on-call handoff. A single-row Dashboard Monitoring Evidence JSON packet can also be passed to
1335
- `--runtime-incidents` when the review is about one specific event.
1203
+ ## Migrating from javascript-obfuscator
1336
1204
 
1337
- For non-PCI runtime reviews, generate a standalone source-free handoff packet
1338
- directly from the Dashboard Monitoring export:
1205
+ See `MIGRATION.md` when replacing the open-source `javascript-obfuscator` package or one of its bundler plugins with the hosted JavaScript Obfuscator API workflow. It covers command changes, concept mapping, direct Node API replacement, bundle-plugin replacement, and a migration checklist.
1339
1206
 
1340
- ```bash
1341
- npx jso-protector \
1342
- --runtime-incident-evidence reports/runtime-incidents.json \
1343
- --runtime-incident-evidence-output reports/runtime-incident-evidence.md
1344
- ```
1207
+ For JS-Confuser projects, the same package now includes `--migrate-js-confuser`, `--list-js-confuser-migration-map`, `--explain-js-confuser-compat`, and `translateJsConfuserOptions(...)` so you can generate a starter `jso.config.json` and review the runtime-only gaps before switching release pipelines.
1345
1208
 
1346
- The packet summarizes status and severity counts, active high/critical count,
1347
- BuildIDs, per-incident action plans, repeated-signal correlation, routing recommendation, dashboard actions,
1348
- response window, response checklist, alert routing playbook, export SHA-256, and safe-sharing boundaries.
1349
- It also includes a source-free Runtime Incident Review Assistant for BYO AI or
1350
- internal reviewers, with prompts for urgent response, repeated-signal
1351
- correlation, overdue incident owners, dashboard status actions, response-window decisions, and
1352
- alert-routing handoff without sharing source code, raw incident payloads,
1353
- collector tokens, customer data, or secrets.
1354
- It exits nonzero when active high/critical incidents are present so CI can
1355
- block reviewer handoff until the incident is acknowledged and routed.
1209
+ ## GitHub Actions
1356
1210
 
1357
- In GitHub Actions, the bundled JSO action exposes the same gate as
1358
- `runtime-incident-export` plus `runtime-incident-evidence-report`. The action
1359
- writes a source-free JSON artifact, adds a step summary and annotations, and
1360
- fails the job when the exported packet contains active high/critical runtime
1361
- incidents that have not started response.
1211
+ Store `JSO_API_KEY` and `JSO_API_PASSWORD` as encrypted repository or organization secrets, then run release preflight and protection after your normal frontend build:
1362
1212
 
1363
- ## Commands
1213
+ ```yaml
1214
+ name: protected-release
1364
1215
 
1365
- ```bash
1366
- jso-protector --config jso.config.json
1367
- jso-protector --config jso.config.cjs
1368
- jso-protector --version
1369
- jso-protector --version --json
1370
- jso-protector src/app.js
1371
- jso-protector --input dist --output dist-protected
1372
- jso-protector --list-presets --json
1373
- jso-protector --list-options --json
1374
- jso-protector --list-migration-map --json
1375
- jso-protector --explain-compat self-defending --json
1376
- jso-protector --compat-scan --json
1377
- jso-protector --local-only --json
1378
- jso-protector --migrate-javascript-obfuscator javascript-obfuscator.json --output jso.config.json
1379
- jso-protector --migrate-javascript-obfuscator javascript-obfuscator.config.cjs --output jso.config.json
1380
- jso-protector --migrate-js-confuser js-confuser.config.cjs --output jso.config.json
1381
- jso-protector --config jso.config.json --release-check --json
1382
- jso-protector --config jso.config.json --release-check --strict --json
1383
- jso-protector --config jso.config.json --validate-config --json
1384
- jso-protector --config jso.config.json --print-config --json
1385
- jso-protector --init --init-template html-app --manifest dist-protected/jso-manifest.json
1386
- jso-protector --init --init-template electron-app --input out --output out-protected
1387
- jso-protector --init --init-template nextjs-app --manifest .next/static-protected/jso-manifest.json
1388
- jso-protector --init --init-template vite-app --manifest dist-protected/jso-manifest.json
1389
- jso-protector --init --init-template parcel-app --manifest dist-protected/jso-manifest.json
1390
- jso-protector --init --init-template bun-app --manifest dist-protected/jso-manifest.json
1391
- jso-protector --init --init-template browserify-app --manifest dist-protected/jso-manifest.json
1392
- jso-protector --init --init-template webpack-app --manifest dist-protected/jso-manifest.json
1393
- jso-protector --init --init-template rspack-app --manifest dist-protected/jso-manifest.json
1394
- jso-protector --init --init-template turbopack-app --manifest .next/static-protected/jso-manifest.json
1395
- jso-protector --init --init-template react-native-app --input dist --output dist-protected
1396
- jso-protector --verify-manifest dist-protected/jso-manifest.json
1397
- jso-protector --verify-manifest dist-protected/jso-manifest.json --verify-root protected-dist
1398
- jso-protector --verify-manifest dist-protected/jso-manifest.json --audit-source-maps
1399
- jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.md
1400
- jso-protector --runtime-incident-evidence reports/runtime-incidents.json --runtime-incident-evidence-output reports/runtime-incident-evidence.md
1401
- jso-protector --verify-vm-proof dist-protected/jso-report.json --json
1402
- jso-protector --ai-resistance-evidence dist-protected/jso-report.json --ai-resistance-evidence-output reports/ai-resistance-evidence.md
1403
- jso-protector --config jso.config.json --parse-html
1404
- jso-protector --config jso.config.json --honor-conditional-comments
1405
- jso-protector --config jso.config.json --protect-marked-comments
1406
- jso-protector --config jso.config.json --keep-header-comment --protect-object-declaration --move-nested-function
1407
- jso-protector --config jso.config.json --formatted-output --keep-indent --line-numbers
1408
- jso-protector --preset maximum --input dist --output dist-protected
1409
- jso-protector --web-preset javascript-obfuscator-preset.json --dry-run --json
1410
- jso-protector --stdin --stdout --file-name app.js < dist/app.js > dist/app.protected.js
1411
- jso-protector --stdin --file-name app.js --output dist-protected < dist/app.js
1412
- jso-protector --config jso.config.json --manifest dist-protected/jso-manifest.json
1413
- jso-protector --config jso.config.json --max-output-bytes 250000 --max-growth-ratio 8
1414
- jso-protector --config jso.config.json --option LockDomain=true --option LockDomainList=example.com
1415
- jso-protector --config jso.config.json --include "assets/*.js" --exclude "**/legacy/**" --asset-exclude "**/*.license"
1416
- jso-protector --config jso.config.json --reserved-name "^PublicApi$" --reserved-name "^renderWidget$"
1417
- jso-protector dist --output dist-protected --options-preset high-obfuscation --control-flow-flattening --string-array-encoding rc4 --reserved-names "^PublicApi$"
1418
- jso-protector --dry-run --json
1419
- jso-protector --no-copy-assets
1420
- jso-protector --init
1216
+ on:
1217
+ workflow_dispatch:
1218
+
1219
+ jobs:
1220
+ release:
1221
+ runs-on: ubuntu-latest
1222
+ steps:
1223
+ - uses: actions/checkout@v4
1224
+ - uses: actions/setup-node@v4
1225
+ with:
1226
+ node-version: 22
1227
+ cache: npm
1228
+ - run: npm ci
1229
+ - run: npm run build
1230
+ - run: npm run verify:package --if-present
1231
+ - run: npm run verify:publish-metadata --if-present
1232
+ - name: Release preflight
1233
+ run: npx jso-protector --config jso.config.json --release-check --json
1234
+ env:
1235
+ JSO_API_KEY: ${{ secrets.JSO_API_KEY }}
1236
+ JSO_API_PASSWORD: ${{ secrets.JSO_API_PASSWORD }}
1237
+ - name: Protect JavaScript
1238
+ run: npx jso-protector --config jso.config.json --manifest dist-protected/jso-manifest.json
1239
+ env:
1240
+ JSO_API_KEY: ${{ secrets.JSO_API_KEY }}
1241
+ JSO_API_PASSWORD: ${{ secrets.JSO_API_PASSWORD }}
1242
+ - run: npm run smoke
1243
+ - uses: actions/upload-artifact@v4
1244
+ with:
1245
+ name: protected-dist
1246
+ path: |
1247
+ dist-protected/
1248
+ dist-protected/jso-manifest.json
1421
1249
  ```
1422
1250
 
1423
- Use `--stdin` for small custom scripts and build steps that already know which single file should be protected. Use `--stdout` to compose with other shell commands, or omit it and pass `--output` to write the result as `output/file-name`.
1424
-
1425
- For direct single-file migration scripts, `jso-protector src/app.js` writes `src/app-obfuscated.js` when no `--output` or config `output` is set. Folder and config-file workflows keep using the configured output folder, usually `dist-protected`.
1426
-
1427
- Use repeatable `--option Name=value` flags to override API options from CI without editing shared config. Values `true`, `false`, `null`, and numbers are parsed into their JSON equivalents; other values are sent as strings.
1428
-
1429
- Use repeatable `--include pattern` flags to replace the configured protected-file include list for one job. Use repeatable `--exclude pattern` and `--asset-exclude pattern` flags to add job-specific file and asset exclusions without removing the config defaults. Use repeatable `--reserved-name pattern` flags to override `reservedNames` for a release job.
1251
+ ## Working from a local checkout
1430
1252
 
1431
- When replacing existing `javascript-obfuscator` package scripts, the CLI accepts familiar flags and maps them to hosted API options. Supported mapped compatibility flags include `--options-preset`, `--string-array`, `--string-array-encoding`, `--unicode-escape-sequence`, `--control-flow-flattening`, `--dead-code-injection`, `--dead-code-injection-threshold`, `--identifier-names-generator`, `--rename-globals`, `--rename-properties`, `--reserved-names`, `--domain-lock`, `--target`, and `--compact`. Config and Node API `domainLock` arrays map to `LockDomain` plus newline-delimited `LockDomainList`; review redirect behavior separately. Config-level compatibility fields are also accepted and covered by the shipped JSON schema. `--options-preset default`, `low-obfuscation`, `vm-default`, and `vm-low-obfuscation` map to `standard`; `medium-obfuscation` and `vm-medium-obfuscation` map to `balanced`; `high-obfuscation`, `vm-high-obfuscation`, `vm-ultra-high-obfuscation`, and `vm-anti-llm` map to `maximum`.
1253
+ Published releases install from the registry with
1254
+ `npm install --save-dev jso-protector`. The paths below are for building the
1255
+ package from a checkout of this repository — internal testing, a release
1256
+ candidate, or an air-gapped install.
1432
1257
 
1433
- `--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.
1258
+ Install the workspace copy directly:
1434
1259
 
1435
- 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.
1260
+ ```bash
1261
+ npm install --save-dev ./packages/jso-protector
1262
+ ```
1436
1263
 
1437
- Specifically, it maps `--self-defending`, `--debug-protection`, `--debug-protection-interval`, `--disable-console-output`, and `--domain-lock-redirect-url` directly.
1264
+ Or pin it from another app in the same workspace:
1438
1265
 
1439
- Use `--version` for a quick CLI parity check in scripts. Add `--json` to print package metadata and the default hosted API endpoint.
1266
+ ```json
1267
+ {
1268
+ "devDependencies": {
1269
+ "jso-protector": "file:../packages/jso-protector"
1270
+ }
1271
+ }
1272
+ ```
1440
1273
 
1441
- 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.
1274
+ For internal sharing without going through the registry, build a tarball and
1275
+ install that artifact in the consuming project:
1442
1276
 
1443
- 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.
1277
+ ```bash
1278
+ npm pack --json
1279
+ npm install --save-dev path/to/jso-protector-0.4.0.tgz
1280
+ ```
1444
1281
 
1445
- ### AI precheck 鈥?gate the obfuscation API call on AI compat-check findings
1282
+ Keep those tarballs in internal storage or build artifacts. `prepublishOnly`
1283
+ runs the full verification chain before any real publish, so a release cannot
1284
+ go out on an unverified tree.
1446
1285
 
1447
- 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.
1286
+ ## Release Checklist
1448
1287
 
1449
- ```sh
1450
- # Single command, single round-trip. Add to any CI step you already run:
1451
- jso-protector --config jso.config.json --ai-precheck --ai-precheck-fail-on error
1288
+ 1. Build unprotected JavaScript into a temporary output folder.
1289
+ 2. Run `jso-protector --release-check --json` to validate config, confirm the file list, and check paths, assets, output readiness, presets, and enabled options before source is sent.
1290
+ 3. Protect into a separate output folder such as `dist-protected` and write `dist-protected/jso-manifest.json`.
1291
+ 4. Run browser smoke tests against the protected output.
1292
+ 5. Run `jso-protector --verify-manifest dist-protected/jso-manifest.json --audit-source-maps` before publishing or after unpacking release artifacts.
1293
+ 6. Publish only the protected artifacts and release manifest.
1452
1294
 
1453
- # JSON output for machine consumers (CI annotations, GitHub status checks):
1454
- jso-protector --config jso.config.json --ai-precheck --json
1455
- ```
1295
+ ## Notes
1456
1296
 
1457
- Gate levels for `--ai-precheck-fail-on`:
1297
+ - The CLI sends file contents to the configured HTTP API endpoint.
1298
+ - The desktop app also sends selected JavaScript to the hosted service. Use local preflight only when policy forbids source transfer; current protection workflows do not meet that requirement.
1299
+ - The HTTP API is for paid accounts.
1300
+ - The CLI expects the API response shape used by `HttpApi.ashx`: `Type`, `Items`, `Message`, `FileName`, and optional error fields.
1458
1301
 
1459
- - `error` (default): build aborts on any error-severity finding.
1460
- - `warning`: build aborts on any error or warning finding (paranoid mode).
1461
- - `never`: print findings, never fail (advisory mode).
1302
+ ## Payment and API Access
1462
1303
 
1463
- For projects that want to run the gate stand-alone 鈥?pre-commit hooks, IDE integrations, ad-hoc audits 鈥?use the companion sub-command:
1304
+ This package is a client. It drives the hosted API by default, or the bundled `jso-local` protector with `--local`. Protection itself, billing and every plan limit live on the server, never in this package.
1464
1305
 
1465
- ```sh
1466
- jso ai compat-scan --config jso.config.json --fail-on error
1467
- jso ai compat-scan --config jso.config.json --max-files 50 # cap quota burn on huge repos
1468
- ```
1306
+ A request with no credentials is served on the **free tier**: up to 20 files and 200 KB per request, rate limited per IP, no VM protection. Everything above that is a paid plan, enforced server-side.
1469
1307
 
1470
- 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.
1308
+ Payment and account enforcement stay on `javascriptobfuscator.com`:
1471
1309
 
1472
- ### AI usage and BYO key health
1310
+ 1. The user buys a plan or credits on the JavaScript Obfuscator website.
1311
+ 2. The dashboard provides `JSO_API_KEY` and `JSO_API_PASSWORD`.
1312
+ 3. By default the local npm CLI sends selected JavaScript to the configured HTTPS API endpoint.
1313
+ 4. The hosted API validates the account, plan, limits, and credentials before returning protected code.
1473
1314
 
1474
- Use the bundled AI CLI when an account owner or release job needs to confirm quota and BYO provider-key readiness without opening the dashboard.
1315
+ With `--local` the source body stays on the build machine and step 3 does not
1316
+ happen, but entitlement is still enforced server-side: the run makes a
1317
+ source-free plan/option check before protecting. Either way, billing and plan
1318
+ limits live on the server, never in this package.
1475
1319
 
1476
- ```sh
1477
- jso ai usage --pretty
1478
- # tier: Pro
1479
- # actions: 12 / 500 (488 remaining)
1480
- # AI key health: Key ready (openai) [ready]
1481
- # next key test: 2026-06-25T00:00:00Z
1482
- # rotation review: 2026-08-24T00:00:00Z
1483
- ```
1320
+ 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.
1484
1321
 
1485
- Programmatic callers get the same source-free state from the typed Node client:
1322
+ 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.
1486
1323
 
1487
- ```js
1488
- const { ai } = require("jso-protector");
1324
+ ### Sign in once
1489
1325
 
1490
- const usage = await ai.usage();
1491
- if (usage.providerKey && usage.providerKey.status !== "ready") {
1492
- console.warn("AI key health:", usage.providerKey.label);
1493
- }
1326
+ ```bash
1327
+ npx javascriptobfuscator login
1494
1328
  ```
1495
1329
 
1496
- 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.
1330
+ This opens the dashboard, takes the API Key and API Password (the password is
1331
+ not echoed), and stores them in `~/.jso-protector/credentials.json` for every
1332
+ project on the machine. `npx javascriptobfuscator logout` removes them.
1497
1333
 
1498
- ### Pre-flight quota gate 鈥?`--estimate`
1334
+ The store is written `0600`. That is real protection on POSIX; Windows does not
1335
+ honour the mode, so there the file is only as protected as your user profile
1336
+ directory - the same position as `~/.npmrc`.
1499
1337
 
1500
- 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:
1338
+ ### Or set them per shell
1501
1339
 
1502
- - **OK** (exit 0) 鈥?quota healthy, build can proceed.
1503
- - **WARN** (exit 0) 鈥?fewer than 5 actions remaining OR cost cap below 20%. Print, don't block.
1504
- - **FAIL** (exit 1) 鈥?actions remaining = 0. Block the build before it consumes any more.
1340
+ Stored credentials are read **last**, so an explicit flag, a project config, or
1341
+ these environment variables always win - a CI setup is unaffected by whatever a
1342
+ developer has logged in with locally.
1505
1343
 
1506
- ```sh
1507
- jso-protector --config jso.config.json --estimate
1508
- jso-protector --config jso.config.json --estimate --json # machine-readable
1344
+ ```bash
1345
+ set JSO_API_KEY=base64-api-key-from-dashboard
1346
+ set JSO_API_PASSWORD=base64-api-password-from-dashboard
1509
1347
  ```
1510
1348
 
1511
- Network failures on `/v1/ai/usage` downgrade to WARN with a note (don't crash the build pipeline over an observability gap).
1512
-
1513
- 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.
1514
-
1515
- ### Watermarking 鈥?anti-piracy + dispute proof
1516
-
1517
- `--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.
1349
+ For macOS/Linux shells:
1518
1350
 
1519
- ```sh
1520
- # Stamp during build:
1521
- jso-protector --config jso.config.json \
1522
- --watermark "release-2026-Q3" --watermark-key "$JSO_WATERMARK_KEY"
1351
+ ```bash
1352
+ export JSO_API_KEY=base64-api-key-from-dashboard
1353
+ export JSO_API_PASSWORD=base64-api-password-from-dashboard
1354
+ ```
1523
1355
 
1524
- # Verify a single file post-deploy:
1525
- jso-protector --verify-watermark dist-protected/app.js --watermark-key "$JSO_WATERMARK_KEY"
1526
- # OK dist-protected/app.js: valid watermark, tag=release-2026-Q3
1356
+ Protect generated build output:
1527
1357
 
1528
- # Bulk-scan a directory (CDN audit / forensic inventory):
1529
- jso-protector --scan-watermarks dist-protected/ --watermark-key "$JSO_WATERMARK_KEY"
1530
- # Scanned 42 JS file(s) under dist-protected/
1531
- # Watermarked: 42 valid=42 invalid=0
1358
+ ```bash
1359
+ npx jso-protector --config jso.config.json
1532
1360
  ```
1533
1361
 
1534
- 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.
1362
+ ### Runtime recovery and enterprise governance foundations
1535
1363
 
1536
- 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.
1364
+ Browser-targeted API options now support bounded local recovery with
1365
+ `SelfDefending`, `SelfHealing`, and `SelfHealingMaxAttempts`. A successful
1366
+ repair emits a `self-healed-*` runtime event; when repair is unavailable or
1367
+ exhausted, `RuntimeDefenseAction` can use `throw`, `blank`, `redirect`,
1368
+ `reload`, `callback`, or `degrade`. Local recovery handles mutation after the
1369
+ wrapper starts and does not claim to repair a bundle modified before startup.
1537
1370
 
1538
- Exit codes (`--scan-watermarks`): **0** all clean / **1** at least one invalid signature found / **2** no watermarks found at all.
1371
+ Release automation can import `jso-protector/governance` for shared RBAC,
1372
+ scoped-token descriptors, SHA-256 hash-chained audit events, validated
1373
+ OIDC/SAML trust configuration, an organization directory, and a SCIM 2.0
1374
+ `/Users` service core with bearer authentication, filtering, role updates, and
1375
+ deactivation. Deployments still need to mount the service behind HTTPS and
1376
+ persist directory changes in their account store.
1539
1377
 
1540
- ### Signed release attestations 鈥?SLSA-style
1378
+ `jso-protector/runtime/third-party-inventory` supports
1379
+ `enforcementMode: "block"` for synchronous origin and late-injection decisions
1380
+ on dynamically-created scripts. `jso-protector/runtime/managed-integrity` adds
1381
+ versioned monitor/block policies, inventory evaluation, deduplicated incidents,
1382
+ assignment/status transitions, and JSON export for hosted or on-prem operations.
1383
+ `jso-protector/runtime/data-exfiltration-guard` adds opt-in monitor/block controls
1384
+ for protected-field data sent through fetch, XHR, sendBeacon, WebSocket, or
1385
+ programmatic form submission. Allow approved destinations explicitly and begin
1386
+ in monitor mode. Evidence contains field names and counts, never captured values
1387
+ or request bodies; encoded/encrypted bodies and script attribution remain stated
1388
+ browser-runtime limitations.
1541
1389
 
1542
- `--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:
1390
+ Compare a migrated config against common JavaScript obfuscator capabilities:
1543
1391
 
1544
- ```sh
1545
- # One-time: mint a keypair (writes .priv.pem 0o600, .pub.pem 0o644):
1546
- jso-protector --genkey-release ci-signing-key
1392
+ ```bash
1393
+ npx jso-protector --config jso.config.json --competitor-gap-report
1394
+ npx jso-protector --config jso.config.json --competitor-gap-report --json
1395
+ npx jso-protector --config jso.config.json --migration-review \
1396
+ --migration-review-output reports/migration-review.md
1397
+ npx jso-protector --config jso.config.json --identifier-cache-review \
1398
+ --identifier-cache-review-output reports/identifier-cache-review.md
1399
+ npx jso-protector --config jso.config.json --runtime-defense-review \
1400
+ --runtime-defense-review-output reports/runtime-defense-review.md
1401
+ ```
1402
+
1403
+ The gap report groups parity into covered, partial, and gap areas across common
1404
+ competitor surfaces such as control-flow flattening, string hiding, domain/date
1405
+ locks, runtime monitoring, hosted dashboard intake, countermeasures, source
1406
+ maps, and release forensics. It names Obfuscator.io, javascript-obfuscator,
1407
+ JS-Confuser, Jscrambler, and JSDefender so migration reviews can separate exact
1408
+ matches from features that need manual validation. Runtime-defense parity is
1409
+ reported as partial: route `RuntimeDefenseBeaconUrl` to your monitoring stack
1410
+ or the hosted `/v1/runtime/beacon.ashx` intake for first triage, then validate
1411
+ any migrated anti-debug/self-defending switches manually. Use it after
1412
+ `--migrate-javascript-obfuscator` or `--migrate-js-confuser` to keep
1413
+ runtime-defense, source-map, and release-readiness assumptions visible in CI.
1414
+ The JSON and text output include a dated source snapshot of the public
1415
+ competitor pages reviewed for this migration framing, plus a reminder to
1416
+ re-check current vendor pages before publishing named competitive claims.
1417
+ The report also includes a source-free Competitor Gap Review Assistant for BYO
1418
+ AI or internal reviewers. It turns gap prioritization, partial-parity
1419
+ validation, triggered migration limitations, source-reading scan boundaries,
1420
+ vendor-claim freshness, and plan handoff into owner actions without sharing
1421
+ source code, protected output, API credentials, provider keys, customer data,
1422
+ or secrets.
1423
+ When source-map, identifier-cache, custom-dictionary, or runtime-defense
1424
+ limitations are present, the report also includes `reviewArtifacts`: source-free
1425
+ release-check, competitor-gap, all-up migration-review, source-map-evidence,
1426
+ and identifier-cache replacement review commands, a source-free runtime-defense
1427
+ review command, and a separate source-reading compatibility scan when
1428
+ runtime-defense switches need manual validation.
1429
+ Use `--migration-review` when a migrated config still carries any accepted
1430
+ competitor-only fields. The generated Markdown packet gives release owners one
1431
+ source-free checklist across source-map policy, identifier-cache replacement,
1432
+ runtime-defense behavior, CLI compatibility warnings, saved report/manifest
1433
+ readiness, follow-up commands, and protected-build smoke evidence without
1434
+ embedding source code, protected output, source-map contents, cache contents,
1435
+ dictionary values, prefixes, domains, URLs, dates, seed values, or reserved
1436
+ expressions. The packet includes a Migration Review Assistant for BYO AI or
1437
+ internal reviewers, turning manual review tracks, source-map policy,
1438
+ identifier-cache replacement, runtime-defense behavior, source-reading command
1439
+ boundaries, release metadata, and protected-build smoke into owner actions
1440
+ without sharing raw config files, API credentials, provider keys, customer data,
1441
+ or secrets.
1442
+ Use `--identifier-cache-review` when a migrated config still carries
1443
+ `identifierNamesCache`, `identifierNamesCachePath`, `identifiersDictionary`, or
1444
+ `identifiersPrefix`. The generated Markdown packet gives release owners a
1445
+ source-free checklist for replacing deterministic cache assumptions with
1446
+ reserved-name review, saved API report, release manifest, and protected-build
1447
+ smoke evidence without embedding cache contents, dictionary values, prefixes,
1448
+ reserved-name expressions, or source code. It includes an Identifier Cache
1449
+ Review Assistant for BYO AI or internal reviewers, turning deterministic cache
1450
+ assumptions, custom dictionary replacement, reserved-name coverage, release
1451
+ metadata, and protected-build smoke into owner actions without sharing raw
1452
+ config files, API credentials, provider keys, customer data, or secrets.
1453
+ Use `--runtime-defense-review` when a migrated config still carries anti-debug,
1454
+ self-defending, runtime lock, console, and countermeasure migration settings.
1455
+ The generated packet lists field names, configured evidence tracks, review
1456
+ decision, monitoring and smoke-test follow-ups, and safe-sharing boundaries
1457
+ without embedding domains, dates, redirect URLs, beacon URLs, countermeasure
1458
+ values, source code, or protected output. It includes a Runtime Defense Review
1459
+ Assistant for BYO AI or internal reviewers, turning runtime behavior scope,
1460
+ monitoring handoff, countermeasure policy, domain/date lock smoke,
1461
+ source-reading compatibility scan, release metadata, and protected-build smoke
1462
+ into owner actions without sharing raw config files, API credentials, provider
1463
+ keys, collector tokens, customer data, or secrets.
1547
1464
 
1548
- # Build + sign:
1549
- jso-protector --config jso.config.json \
1550
- --manifest dist-protected/build.manifest.json \
1551
- --sign-release ci-signing-key.priv.pem
1552
- # -> dist-protected/build.manifest.json.sig
1465
+ Protect one file through a shell pipe:
1553
1466
 
1554
- # Verify post-deploy:
1555
- jso-protector --verify-release dist-protected/build.manifest.json.sig \
1556
- --public-key ci-signing-key.pub.pem \
1557
- --verify-root dist-protected/
1558
- # OK .../build.manifest.json.sig: signature valid (BuildId=...), 42 file(s) re-hashed
1467
+ ```bash
1468
+ type dist\app.js | npx jso-protector --stdin --stdout --file-name app.js > dist\app.protected.js
1559
1469
  ```
1560
1470
 
1561
- Two-stage verification:
1562
-
1563
- - **Stage 1** 鈥?Ed25519 signature over canonical-JSON manifest (catches forgery + manifest tampering).
1564
- - **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.
1565
-
1566
- Without `--public-key`, the envelope's embedded public key is trusted (signature-only verification). With it, embedded != trusted 鈫?fail fast (defeats key-substitution attacks).
1471
+ ## Deployment Hygiene Evidence
1567
1472
 
1568
- 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.
1473
+ When `tools/Build-UpdatedArchives.ps1 -ReportPath _temp/archive-hygiene.json`
1474
+ creates an updated-files archive hygiene report, turn it into a source-free
1475
+ reviewer packet before sharing the zip:
1569
1476
 
1570
- 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.
1477
+ ```bash
1478
+ npx jso-protector \
1479
+ --deployment-hygiene-evidence _temp/archive-hygiene.json \
1480
+ --deployment-hygiene-output reports/deployment-hygiene.md
1481
+ ```
1571
1482
 
1572
- 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.
1483
+ The packet summarizes archive names, entry counts, byte sizes, missing required
1484
+ entries, blocked entries, blocked category booleans, the exclusion policy,
1485
+ operator checklist, rotation triggers, hygiene-report SHA-256, and a Deployment Hygiene Review Assistant for BYO AI or internal reviewers. It does not include
1486
+ `Web.config` contents, raw secrets, provider keys, webhook signing secrets,
1487
+ database strings, host-specific deployment transforms, customer data, or source
1488
+ code. It exits nonzero when the archive builder reported blocked deployment
1489
+ files or missing required entries, while still writing the failed packet for
1490
+ internal remediation.
1573
1491
 
1574
- 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.
1492
+ ## Payment-page evidence reports
1575
1493
 
1576
- Use `--parse-html` when built HTML or template files contain inline scripts that should be protected. Markup files require this explicit mode before protection; the CLI will not send a whole document to the JavaScript API path by accident. Only marked inline blocks are sent to the API:
1494
+ For checkout, wallet, subscription, activation, and license pages, pair the
1495
+ signed release manifest with a payment-page script inventory and Dashboard
1496
+ Monitoring incident history. Export runtime incidents CSV or JSON from the
1497
+ dashboard, keep a CSV or JSON list of payment-page scripts with authorization
1498
+ and written justification, and attach a payment-page security-header snapshot
1499
+ when reviewers ask for CSP/header change evidence. Include these source-free
1500
+ attachments in the PCI DSS v4 report. Start from
1501
+ `examples/payment-page-script-inventory.json` and
1502
+ `examples/payment-page-security-headers.json` when you need the expected JSON
1503
+ field names, or generate a review starter from a saved
1504
+ `third-party-inventory` runtime snapshot:
1577
1505
 
1578
- ```html
1579
- <script data-javascript-obfuscator>
1580
- window.releaseWidget = createWidget();
1581
- </script>
1506
+ ```bash
1507
+ npx jso-protector \
1508
+ --script-inventory-from-snapshot reports/runtime-inventory.json \
1509
+ --script-inventory-output reports/payment-script-inventory.json
1582
1510
  ```
1583
1511
 
1584
- Unmarked inline scripts are preserved. Marked external scripts and marked module scripts fail with a clear warning because markup mode protects inline script contents only; protect referenced files directly through the JavaScript build pipeline. When `parseHtml` is enabled, the CLI automatically adds the configured `markupExtensions` list to protected extensions. By default that includes `.html`, `.htm`, `.php`, `.phtml`, `.asp`, `.aspx`, `.jsp`, `.cshtml`, and `.vbhtml`.
1585
-
1586
- Use `--honor-conditional-comments` to preserve source regions marked with `javascript-obfuscator:disable` and `javascript-obfuscator:enable`. Without the flag, the CLI fails with a clear warning when markers are found so protected regions are not sent unexpectedly. With the flag, enabled regions are sent as separate API items and disabled regions are copied back verbatim. Markers must be balanced; an unmatched `disable`, unmatched `enable`, or nested disabled region fails before any source is sent.
1512
+ If your checkout evidence starts as a browser or synthetic-monitor HAR export,
1513
+ convert the document and iframe responses into the same source-free
1514
+ security-header snapshot. The converter keeps CSP, HSTS, frame/referrer policy,
1515
+ reporting endpoint, and related security headers, drops raw cookies and other
1516
+ non-security headers, and stores a SHA-256 over each canonical selected-header
1517
+ snapshot. Keep the last approved snapshot in your evidence repository and pass
1518
+ it as `--payment-page-headers-baseline` when you want the new HAR export to
1519
+ mark each checkout page or frame as `match`, `mismatch`, or `missing` for
1520
+ security-header change review. The generated snapshot also includes a
1521
+ source-free security-header Review Assistant Packet for BYO AI or internal
1522
+ reviewers. It focuses the review on baseline drift, CSP/reporting, HSTS, and
1523
+ frame-policy owner actions while reminding teams not to include
1524
+ raw response headers, cookies, source code, payment data, customer data, provider keys, or
1525
+ secrets.
1587
1526
 
1588
- ```js
1589
- console.log("protect this");
1590
- // javascript-obfuscator:disable
1591
- console.log("keep this exact local code");
1592
- // javascript-obfuscator:enable
1593
- console.log("protect this too");
1527
+ ```bash
1528
+ npx jso-protector \
1529
+ --payment-page-headers-from-har reports/checkout.har \
1530
+ --payment-page-headers-baseline reports/payment-page-headers.baseline.json \
1531
+ --payment-page-headers-output reports/payment-page-headers.json \
1532
+ --payment-page-url-pattern "checkout|payment|wallet"
1594
1533
  ```
1595
1534
 
1596
- Use `--protect-marked-comments` when only selected sections of a file should be protected. Unmarked code is copied back verbatim, and only regions between `javascript-obfuscator:protect-begin` and `javascript-obfuscator:protect-end` are sent to the hosted API. Markers must be balanced and cannot be mixed with `disable`/`enable` markers in the same file.
1535
+ Review the generated script inventory file before audit use. Set `authorized`, add written
1536
+ `justification`, assign `owner`, and fill `lastReviewedUtc` for every approved
1537
+ payment-page script. Add `risk`, `dataAccess`, and `approvalTicket` when your
1538
+ checkout review process tracks risk-based decisions or change approvals. Add
1539
+ `checkoutSurface`, `frameContext`, `frameOwner`, `parentPageHref`, `frameHref`,
1540
+ and `frameOrigin` when your payment flow has a parent page, hosted checkout
1541
+ page, PSP iframe, or embedded payment frame that reviewers need to distinguish.
1542
+ The
1543
+ audit packet fails only on blocking script drift or required metadata gaps; it
1544
+ also calls out missing optional review context so checkout owners can improve
1545
+ QSA handoff quality without breaking an otherwise clean release. Before handing
1546
+ the packet to reviewers, reconcile the approved inventory against a fresh
1547
+ runtime snapshot:
1597
1548
 
1598
- ```js
1599
- console.log("keep this exact local code");
1600
- // javascript-obfuscator:protect-begin
1601
- console.log("protect this algorithm");
1602
- // javascript-obfuscator:protect-end
1603
- console.log("keep this exact local code too");
1549
+ ```bash
1550
+ npx jso-protector \
1551
+ --script-inventory-audit reports/payment-script-inventory.json \
1552
+ --runtime-inventory-snapshot reports/runtime-inventory.json \
1553
+ --script-inventory-audit-output reports/payment-script-inventory-audit.json \
1554
+ --json
1604
1555
  ```
1605
1556
 
1606
- 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.
1607
-
1608
- ### `--local`: protect without sending source
1557
+ The audit is local and source-free. It reports unknown observed scripts,
1558
+ scripts observed while marked unauthorized, approved scripts missing from the
1559
+ page, hash mismatches, scripts injected after page load, runtime violation
1560
+ reasons, and missing inventory metadata. Omit `--json` or use a `.md` output
1561
+ path when a standalone human-readable packet is preferred.
1609
1562
 
1610
- `--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`:
1563
+ In GitHub Actions, the bundled JSO action exposes the same audit,
1564
+ security-header snapshot, and PCI DSS v4 reviewer packet as opt-in workflow
1565
+ steps: set
1566
+ `payment-script-inventory`, `runtime-inventory-snapshot`, and optionally
1567
+ `script-inventory-audit-report` to fail the release job on payment-page script
1568
+ drift; set `payment-page-har`, optionally `payment-page-url-pattern`, and
1569
+ optionally `payment-page-headers-baseline` and `payment-page-headers-report` to
1570
+ convert a checkout HAR into the same source-free header evidence artifact and
1571
+ mark baseline matches, mismatches, or missing pages; set `pci-dss-v4-evidence` with
1572
+ `pci-dss-v4-report` and `pci-dss-v4-json-report` to assemble the Markdown and
1573
+ JSON PCI evidence report from the protected manifest plus those attachments.
1574
+ Use `manifest`, `sign-release-key`, `watermark`, and `watermark-key` when this
1575
+ report needs to pass rather than document incomplete evidence. The action adds
1576
+ a step summary and workflow annotations for the first audit, header, or PCI
1577
+ findings so reviewers can see drift directly in the CI run.
1611
1578
 
1612
1579
  ```bash
1613
- jso-protector --config jso.config.json --local
1614
- jso-protector --config jso.config.json --local --local-exe "C:\Tools\JSObfuscator\cli\jso-local.exe"
1580
+ npx jso-protector compliance pci-dss-v4 \
1581
+ --manifest dist-protected/jso-manifest.json.sig \
1582
+ --root dist-protected \
1583
+ --watermark-key "$JSO_WATERMARK_KEY" \
1584
+ --beacon-url "https://javascriptobfuscator.com/v1/runtime/beacon.ashx" \
1585
+ --siem splunk-hec \
1586
+ --script-inventory reports/payment-script-inventory.json \
1587
+ --script-inventory-audit reports/payment-script-inventory-audit.json \
1588
+ --payment-page-headers reports/payment-page-headers.json \
1589
+ --runtime-incidents reports/runtime-incidents.json \
1590
+ --organization "Example Corp" \
1591
+ --output reports/pci-dss-v4.md
1615
1592
  ```
1616
1593
 
1617
- The executable is found via `--local-exe`, then `JSO_LOCAL_EXE`, then the usual desktop install locations. Config equivalents are `"local": true` and `"localExe"`.
1618
-
1619
- State it accurately when a reviewer asks:
1620
-
1621
- - **Your source stays on the machine.** The request body is written to a temporary file, handed to `jso-local`, and deleted after the run.
1622
- - **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.
1623
- - **Windows only**, because the executable ships in the Windows desktop archive.
1624
- - **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.
1625
-
1626
- 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.
1627
-
1628
- 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.
1629
-
1630
- Use `--print-config --json` to inspect the final resolved config after presets, config files, environment variables, and CLI overrides are merged. API credentials are redacted as `[set]` or `[missing]`.
1631
-
1632
- Use `--manifest file.json` or `"manifest": "file.json"` to write a release manifest after a successful protection run. The manifest includes project metadata, preset, enabled option names, processing metadata for virtual API items, protected file sizes and SHA-256 hashes, copied asset hashes, and any grouped migration `limitations` still present in the config so artifact review does not depend on one earlier CLI preflight step.
1633
-
1634
- Use `--verify-manifest file.json` to verify that a protected output folder or unpacked release artifact still matches the manifest hashes. By default, verification reads each entry's recorded `outputPath`. Add `--verify-root path/to/artifact` when the protected files were moved into a different folder after the manifest was written; verification then resolves each manifest `fileName` under that alternate root. Add `--audit-source-maps` in release CI to fail when protected JavaScript still contains `sourceMappingURL` comments or when copied artifacts include `.map` files.
1635
-
1636
- Use `--source-map-evidence file.json --source-map-evidence-output reports/source-map-evidence.md` when a release reviewer needs a source-free packet proving protected artifacts do not expose source maps. The command reuses manifest hash verification, audits `.map` files and `sourceMappingURL` comments, emits Markdown by default or JSON with `--json`, and lists artifact names/reasons without embedding source code or source-map contents. The packet now includes a Source Map Review Assistant for BYO AI or internal reviewers, with prompts for leak cleanup, manifest verification, secure debugging exceptions, bundler cleanup order, and clean reviewer handoff without sharing raw `.map` files, original source paths, source code, protected output, customer data, or secrets. Add `--verify-root path/to/artifact` when the manifest was moved before review.
1637
-
1638
- Use `--verify-vm-proof report.json` to verify that a saved API report proves VM protection ran for at least one function. Add `--min-vm-functions 2` or a higher number when the release intentionally marks multiple functions. The check is local and source-free: it reads the report written by `--report`, then validates `UseVMProtection`, `VMProtectionApplied`, `VMProtectionVirtualizedCount`, and `VMProtectionWarnings`.
1639
-
1640
- VM function markers accept `// @virtualize`, `/* @virtualize */`, and `/** @virtualize */` immediately before a supported synchronous function declaration. The server normalizes block and JSDoc markers before the VM sidecar runs, so proof failures should focus on unsupported function syntax, account eligibility, or sidecar warnings instead of comment shape.
1641
-
1642
- Use `--vm-proof-pack report.json --vm-proof-output reports/vm-proof-pack.md` when a security reviewer needs one source-free VM evidence packet. The Markdown output includes build identity, release label, polymorphism fingerprint, VM proof checks, review decision, warnings, compatibility guidance, hot-path/cold-path performance guidance, next actions, and a VM Proof Review Assistant for BYO AI or internal reviewers. The assistant prompts owners to resolve failed proof checks, handle VM warnings, confirm cold sensitive function scope, exclude hot paths, and attach protected-build smoke results without sending source code, protected output, VM bytecode, source maps, provider keys, customer data, or secrets. Add `--json` to write the same packet as machine-readable JSON. A passing VM proof pack can still say `ready-for-manual-review` when the release owner must confirm the selected functions are cold sensitive paths and attach smoke-test results.
1594
+ The report hashes and summarizes these attachments, then adds a source-free PCI
1595
+ DSS Review Assistant for BYO AI or internal reviewers. The assistant turns
1596
+ evidence gaps, signed-release proof, script authorization, observed script
1597
+ drift, header change evidence, runtime incident routing, and QSA handoff
1598
+ boundaries into checkout-owner actions without sharing source code, protected
1599
+ output, raw script rows, raw response headers, raw incident payloads,
1600
+ payment-card data, provider keys, customer data, or secrets. Script inventory evidence is
1601
+ summarized by authorization, justification, owner, domain, review range, and
1602
+ integrity-reference coverage. When the inventory includes `risk`, `dataAccess`,
1603
+ `approvalTicket`, `checkoutSurface`, `frameContext`, and `frameOwner`, the
1604
+ report summarizes those fields, including iframe-scoped script counts, without
1605
+ embedding every script row. Security-header evidence is summarized by CSP,
1606
+ `script-src`, `frame-src`, reporting endpoint, HSTS, referrer-policy,
1607
+ baseline-hash match/mismatch/missing state, checkout surface, frame context, monitor, alert
1608
+ route, domain, observed range, and SHA-256 without embedding every raw page
1609
+ row. Runtime incident evidence is summarized by status, severity,
1610
+ open/reviewing count, per-incident next owner and due state, repeated-signal correlation, date range, Build IDs, and SHA-256. The Markdown does not
1611
+ embed every incident URL, user agent, script row, or raw header snapshot, so it
1612
+ can be handed to reviewers while the CSV or JSON exports remain the source-free
1613
+ attachments. The report supports QSA-led assessment; it is not itself a Report
1614
+ on Compliance.
1615
+ When a Dashboard Monitoring JSON export includes filters such as
1616
+ `runtime_status=active`, `runtime_severity=high-critical`, or
1617
+ `runtime_build=checkout-2026-06-07`, the report keeps that filter context in
1618
+ the runtime incident evidence table. The Dashboard JSON export also carries a
1619
+ source-free summary block with status/severity counts, active high-risk count,
1620
+ payload-hash coverage, BuildIDs, event/received date ranges, per-incident action-plan owner/due/status metadata, repeated fingerprint/reason groups, a routing
1621
+ recommendation, an alert routing playbook, and a response checklist before the incident rows. Dashboard
1622
+ Monitoring shows the same routing recommendation on the current filtered view
1623
+ before export, including response target, next status action, and playbook
1624
+ lanes for security response, customer-owned alerting, support handoff, and
1625
+ reviewer packets. The JSON export also includes source-free dashboard action
1626
+ metadata, such as the filtered "Move open in view to Reviewing" status action,
1627
+ plus per-row action plans that name the next owner, evidence packet, response due state, and status move, so support automation can tell account owners what to do next without scraping
1628
+ dashboard HTML. The PCI
1629
+ evidence report preserves those Dashboard JSON fields so support and reviewers
1630
+ can see whether the packet belongs in runtime triage, security response, or
1631
+ archive evidence. The response checklist and alert routing playbook carry
1632
+ owners, response targets, scope confirmation, downstream routing, and
1633
+ safe-sharing boundaries for reviewer
1634
+ or on-call handoff. A single-row Dashboard Monitoring Evidence JSON packet can also be passed to
1635
+ `--runtime-incidents` when the review is about one specific event.
1643
1636
 
1644
- Use `--ai-resistance-evidence report.json --ai-resistance-evidence-output reports/ai-resistance-evidence.md` when a security reviewer or buyer asks what can be checked today for AI-aware protection. The command stays local, reads the saved API report, and emits a source-free evidence summary with a non-scoring attacker-model review matrix, review decision, claim boundaries, and a Review Assistant Packet for BYO AI or internal reviewers. The assistant prompts owners to resolve failed evidence, confirm missing review tracks, check VM/runtime/compatibility scope, and keep Resistance Score wording in the planned-methodology lane without pasting source code, protected output, source maps, provider keys, or secrets into a reviewer or AI prompt. The decision is `blocked` when required evidence fails, `ready-for-manual-review` when required checks pass but optional review tracks need confirmation, or `ready` when every current track is evidenced. It does not call an AI model and it does not claim the planned Resistance Score is live. Add `--json` to write the same packet as machine-readable JSON, and add `--require-vm-proof` to fail when the same report does not pass the VM proof checks.
1637
+ For non-PCI runtime reviews, generate a standalone source-free handoff packet
1638
+ directly from the Dashboard Monitoring export:
1645
1639
 
1646
- Use `--script-inventory-audit inventory.json --runtime-inventory-snapshot snapshot.json` when checkout owners need a source-free reconciliation between the approved payment-page script inventory and what the browser actually observed. Markdown is emitted by default; add `--json` for automation. The command fails the gate when unknown, unauthorized, missing, changed, late-injected, or required metadata-incomplete scripts need review. Missing optional `risk`, `dataAccess`, and `approvalTicket` values are reported as review-context gaps, not blocking failures. Each audit also includes a source-free Review Assistant Packet for BYO AI or internal reviewer triage, with safe-input boundaries and prompts for owner actions, data-access review, integrity drift, and approval-ticket cleanup.
1640
+ ```bash
1641
+ npx jso-protector \
1642
+ --runtime-incident-evidence reports/runtime-incidents.json \
1643
+ --runtime-incident-evidence-output reports/runtime-incident-evidence.md
1644
+ ```
1647
1645
 
1648
- Use `--payment-page-headers-from-har checkout.har --payment-page-headers-output payment-page-headers.json` when checkout owners need a source-free payment-page security-header snapshot from a browser or synthetic-monitor HAR. Add `--payment-page-headers-baseline approved-headers.json` to mark each checkout page or frame as matching, changed, or missing from the approved header baseline. The JSON output includes a source-free security-header Review Assistant Packet for BYO AI or internal reviewers, with safe-input boundaries and prompts for baseline drift, CSP/reporting gaps, HSTS coverage, and frame-policy owner actions.
1646
+ The packet summarizes status and severity counts, active high/critical count,
1647
+ BuildIDs, per-incident action plans, repeated-signal correlation, routing recommendation, dashboard actions,
1648
+ response window, response checklist, alert routing playbook, export SHA-256, and safe-sharing boundaries.
1649
+ It also includes a source-free Runtime Incident Review Assistant for BYO AI or
1650
+ internal reviewers, with prompts for urgent response, repeated-signal
1651
+ correlation, overdue incident owners, dashboard status actions, response-window decisions, and
1652
+ alert-routing handoff without sharing source code, raw incident payloads,
1653
+ collector tokens, customer data, or secrets.
1654
+ It exits nonzero when active high/critical incidents are present so CI can
1655
+ block reviewer handoff until the incident is acknowledged and routed.
1649
1656
 
1650
- Use `jso-protector compliance pci-dss-v4 --script-inventory-audit audit.json` to include the JSON audit summary in the PCI evidence report alongside `--script-inventory` and `--runtime-incidents`. The generated Markdown and JSON also include a source-free PCI DSS Review Assistant for BYO AI or internal reviewers, with prompts for evidence gaps, signed-release proof, script authorization, observed script drift, header change evidence, runtime incident routing, and QSA handoff boundaries. Do not paste source code, protected output, raw script rows, raw response headers, raw incident payloads, payment-card data, provider keys, customer data, or secrets into that review.
1657
+ In GitHub Actions, the bundled JSO action exposes the same gate as
1658
+ `runtime-incident-export` plus `runtime-incident-evidence-report`. The action
1659
+ writes a source-free JSON artifact, adds a step summary and annotations, and
1660
+ fails the job when the exported packet contains active high/critical runtime
1661
+ incidents that have not started response.
1651
1662
 
1652
- Use `--max-output-bytes` / `"maxOutputBytes"` and `--max-growth-ratio` / `"maxGrowthRatio"` to fail CI when protected output exceeds your release size budget. The same budget fields work in bundle plugins.