jso-protector 0.4.11 → 0.4.12

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