jso-protector 0.2.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +108 -0
- package/MIGRATION.md +27 -2
- package/README.md +203 -75
- package/RELEASE.md +58 -65
- package/ai.js +2 -2
- package/bin/jso-protector.js +852 -119
- package/ci/Jenkinsfile +5 -4
- package/ci/argo-workflows.yaml +5 -4
- package/ci/azure-pipelines.yml +5 -4
- package/ci/bitbucket-pipelines.yml +6 -5
- package/ci/buildkite.yml +5 -4
- package/ci/circleci.yml +5 -4
- package/ci/drone.yml +5 -4
- package/ci/github-actions.yml +5 -4
- package/ci/gitlab-ci.yml +5 -4
- package/ci/gocd.yaml +5 -4
- package/ci/teamcity.kts +6 -5
- package/ci/tekton.yaml +5 -4
- package/ci/verify-examples.js +80 -0
- package/ci/verify-package.js +8 -1
- package/ci/woodpecker.yml +6 -5
- package/examples/README.md +6 -2
- package/examples/curl/README.md +2 -2
- package/examples/helm/README.md +1 -1
- package/examples/pre-commit/README.md +2 -2
- package/examples/react-native/README.md +3 -3
- package/index.d.ts +26 -2
- package/index.js +135 -12
- package/jso.config.example.json +1 -1
- package/jso.config.schema.json +164 -42
- package/package.json +60 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,113 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.1 - 2026-08-27
|
|
4
|
+
|
|
5
|
+
Documentation only. No behaviour changes: the CLI, the Node API, the plugins,
|
|
6
|
+
and the protection engine are byte-for-byte the same as 0.4.0.
|
|
7
|
+
|
|
8
|
+
- **The npm page told visitors to install from a local path.** The README's
|
|
9
|
+
first instruction was `npm install --save-dev ./packages/jso-protector`, and
|
|
10
|
+
a later paragraph said the package was "intentionally local-only" and should
|
|
11
|
+
not go in a public registry — text written while it was, and left in place
|
|
12
|
+
when it was published. Someone arriving from npm search read an install
|
|
13
|
+
command that could not work and a claim that this was not a real product.
|
|
14
|
+
The first screen now says what the package does, installs from the registry,
|
|
15
|
+
and shows a two-line example.
|
|
16
|
+
- **Migration from another obfuscator is no longer buried.**
|
|
17
|
+
`--migrate-javascript-obfuscator` and `--migrate-js-confuser` convert an
|
|
18
|
+
existing config in one command; that was documented 1,500 lines down. It is
|
|
19
|
+
now on the first screen, with `--list-migration-map`, `--explain-compat`,
|
|
20
|
+
and `--competitor-gap-report` beside it.
|
|
21
|
+
- **`RELEASE.md` ships in the tarball and described the opposite of reality** —
|
|
22
|
+
`private: true`, `UNLICENSED`, and a publish guard that "should fail". It is
|
|
23
|
+
now the actual release runbook, including the site artifacts and checksums a
|
|
24
|
+
version bump has to keep in step.
|
|
25
|
+
- **Package metadata**: the description names what the tool does and the
|
|
26
|
+
toolchain it plugs into rather than calling itself an HTTP API wrapper, and
|
|
27
|
+
the keywords gained the terms people actually search for (`obfuscator`,
|
|
28
|
+
`code-protection`, `source-code-protection`, `anti-tamper`, `typescript`).
|
|
29
|
+
- Workspace and tarball install instructions still exist, under "Working from
|
|
30
|
+
a local checkout", where they belong.
|
|
31
|
+
|
|
32
|
+
## 0.4.0 - 2026-08-26
|
|
33
|
+
|
|
34
|
+
- **Named configuration sets now protect.** `namedSets` — different protection
|
|
35
|
+
profiles for different parts of one app in a single build — had its schema,
|
|
36
|
+
resolver and tests in the package since the baseline but was never wired
|
|
37
|
+
into the protect flow; a config carrying it validated and was silently
|
|
38
|
+
ignored. It now works in both the CLI and the Node API (`protectFiles`):
|
|
39
|
+
each named set becomes its own API round with the baseline options plus the
|
|
40
|
+
set's preset block plus the set's own options; first matching set wins per
|
|
41
|
+
file; files matching no set keep the baseline exactly. The JSON summary
|
|
42
|
+
gains `namedSetGroups` (and `buildIds` when rounds produce multiple
|
|
43
|
+
reports); the manifest spans every group. A set the plan cannot afford
|
|
44
|
+
fails its own round with the normal API error and leaves other groups
|
|
45
|
+
untouched.
|
|
46
|
+
- **`TargetVersion` and `DownlevelIteration` are now first-class.** Both
|
|
47
|
+
engine options appear in `--list-options` (category `output`) and gain
|
|
48
|
+
camelCase config aliases `targetVersion` (`"es5"`/`"modern"`) and
|
|
49
|
+
`downlevelIteration` (spec-faithful ES5 for-of lowering: lazy stepping +
|
|
50
|
+
IteratorClose, like TypeScript's `downlevelIteration`; off by default
|
|
51
|
+
because it adds a per-step call on arrays; no effect on the modern target).
|
|
52
|
+
The raw option names worked before through generic passthrough; now they
|
|
53
|
+
are documented and validated.
|
|
54
|
+
- `--seed` is documented in `--help` (reproducible builds; omit for the
|
|
55
|
+
default polymorphic output).
|
|
56
|
+
|
|
57
|
+
## 0.3.2 - 2026-08-10
|
|
58
|
+
|
|
59
|
+
- The shipped CI templates (all 13) now list `--local` in their
|
|
60
|
+
"Optional: migration and supply-chain checks" discovery block, with its
|
|
61
|
+
constraint attached: on-runner protection, no source upload, Windows agents
|
|
62
|
+
only. That block exists so users of non-GitHub CI systems can find a
|
|
63
|
+
capability without reading the docs site, and source-local protection was
|
|
64
|
+
the one capability missing from it.
|
|
65
|
+
|
|
66
|
+
## 0.3.1 - 2026-08-10
|
|
67
|
+
|
|
68
|
+
- Documentation accuracy only, no behaviour change. The "Payment and API
|
|
69
|
+
Access" section still described the package as a client for the hosted API
|
|
70
|
+
and listed uploading source as an unconditional step, which stopped being
|
|
71
|
+
true in 0.3.0. It now states that `--local` keeps the source body on the
|
|
72
|
+
build machine while entitlement is still enforced server-side by a
|
|
73
|
+
source-free plan check.
|
|
74
|
+
|
|
75
|
+
## 0.3.0 - 2026-08-10
|
|
76
|
+
|
|
77
|
+
- **`--local` protects without sending source.** The CLI can now run the
|
|
78
|
+
`jso-local` executable from the Windows desktop download (`cli/jso-local.exe`)
|
|
79
|
+
instead of POSTing source to the hosted API. Resolution order is
|
|
80
|
+
`--local-exe`, `JSO_LOCAL_EXE`, then the usual desktop install locations;
|
|
81
|
+
config equivalents are `local` and `localExe`.
|
|
82
|
+
- The local path is a transport swap, not a second implementation: it exchanges
|
|
83
|
+
the same request and response shapes the hosted endpoint uses, so options,
|
|
84
|
+
manifests, evidence packets, and size budgets behave identically. An option
|
|
85
|
+
that works hosted works locally by construction.
|
|
86
|
+
- Honest boundaries, enforced rather than documented: a source-free plan check
|
|
87
|
+
still runs online (Local Advanced is a paid capability), the payload holding
|
|
88
|
+
source and credentials is deleted after each run, and a build that asks for
|
|
89
|
+
VM bytecode protection fails with a clear message instead of silently
|
|
90
|
+
shipping weaker output.
|
|
91
|
+
- Corrected README copy that said protection workflows "do not meet a policy
|
|
92
|
+
that forbids source transfer" - true when written, false as of this release.
|
|
93
|
+
|
|
94
|
+
## Native string splitting (2026-08-03)
|
|
95
|
+
|
|
96
|
+
- `splitStrings` and `splitStringsChunkLength` now map directly to native `SplitStrings` and `SplitStringsChunkLength` engine options instead of migration-review warnings.
|
|
97
|
+
- Eligible literals split into fixed-length concatenated chunks. Chunk length is bounded to 1-1024 and defaults to 10; directives, reserved literals, object keys, template segments, and mixed-server markers remain intact.
|
|
98
|
+
- CLI/config/Node API mappings, wire schemas, option discovery, ASP.NET model binding, and executable engine regression coverage ship together.
|
|
99
|
+
- JS-Confuser `stringSplitting` now maps approximately to the same native transform: booleans map directly, positive probabilities enable it, and custom selector functions remain explicit manual-review inputs.
|
|
100
|
+
- Splitting preserves dynamic-import and static-require specifiers for bundler discovery and never cuts a UTF-16 surrogate pair; executable regressions cover module linking, CommonJS resolution text, emoji values, and self-compressed output.
|
|
101
|
+
- Quoted class method, accessor, and field definition names remain literal. An adversarial class-field case previously failed during protection after the name became a binary expression; normal and self-compressed class-member execution now have permanent coverage.
|
|
102
|
+
- `stringArrayIndexShift` now maps approximately to native `StringArrayIndexShift`. Enabling it adds a deterministic nonzero one-slot offset to plain and encrypted string tables; it does not reproduce the competitor's randomized shift magnitude.
|
|
103
|
+
- `stringArrayShuffle` now maps directly to native `StringArrayShuffle`. The engine shuffles unique moved strings with per-build entropy, or reproducibly under `Seed`, and rewrites every lookup before plain or encrypted table emission.
|
|
104
|
+
- `stringArrayRotate` now maps directly to native `StringArrayRotate`. It applies a nonzero per-build cyclic rotation, rewrites every lookup, and composes with shuffle, index shifting, encryption, and seeded builds.
|
|
105
|
+
- `stringArrayIndexesType` now maps directly to native `StringArrayIndexesType`, supporting `hexadecimal-number`, `hexadecimal-numeric-string`, and mixed lists. Numeric strings are explicitly coerced before array lookup so hexadecimal property text cannot silently return `undefined`.
|
|
106
|
+
- `stringArrayThreshold` now maps directly to a native 0-1 per-unique-literal probability gate. Duplicate values receive one stable decision, zero moves nothing, one moves everything eligible, and `Seed` makes partial selection reproducible.
|
|
107
|
+
- `stringArrayCallsTransform` and `stringArrayCallsTransformThreshold` now map directly to native secondary index-table indirection. The engine emits nested lookups for selected calls, supports 0-1 probability, and composes with shifting, shuffling, rotation, encryption, index representations, compression, and seeded builds.
|
|
108
|
+
- String-array wrapper count, chaining, parameter ceiling, and type now map to native root-level wrappers. Variable aliases and multi-parameter function wrappers execute through optional predecessor chains; count is approximate because competitor per-function-scope placement is not reproduced.
|
|
109
|
+
- `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__` remain literal to preserve semantics.
|
|
110
|
+
|
|
3
111
|
## 0.2.1 - 2026-07-13
|
|
4
112
|
|
|
5
113
|
- Added OIDC/SAML configuration validation, organization directory behavior, and a bearer-authenticated SCIM 2.0 user lifecycle core to governance.
|
package/MIGRATION.md
CHANGED
|
@@ -43,6 +43,9 @@ set JAVASCRIPT_OBFUSCATOR_API_PASSWORD=base64-api-password
|
|
|
43
43
|
| javascript-obfuscator concept | jso-protector / HTTP API direction |
|
|
44
44
|
| --- | --- |
|
|
45
45
|
| `stringArray`, `stringArrayEncoding` | `MoveStrings`, `EncodeStrings`, `EncryptStrings` |
|
|
46
|
+
| `reservedStrings` | `ReservedStrings` (matching literals remain verbatim; bounded regex input) |
|
|
47
|
+
| `numbersToExpressions` | `EncodeNumbers` (approximate: obscures numeric literals but does not preserve expression shape) |
|
|
48
|
+
| `forceTransformStrings` | `ForceTransformStrings` (matching literals override `ReservedStrings`) |
|
|
46
49
|
| Identifier rename settings | `ReplaceNames`, `RenameGlobals`, `RenameMembers`, `IdentityStyle` |
|
|
47
50
|
| `reservedNames` | `reservedNames`, `--reserved-name`, or `VariableExclusion` |
|
|
48
51
|
| Control-flow and dead-code transforms | `DeepObfuscate`, `ReorderCode`, `FlatTransform`, `AddDeadCode`, `DeadcodeLevel` |
|
|
@@ -90,7 +93,11 @@ Mapped compatibility flags include `--options-preset`, `--parse-html`, `--string
|
|
|
90
93
|
|
|
91
94
|
The same mapped compatibility keys can live in `jso.config.json` while you are migrating. Explicit `options` values override the compatibility mapping, so you can start familiar and then tune exact hosted API fields without changing scripts.
|
|
92
95
|
|
|
93
|
-
The CLI
|
|
96
|
+
The CLI maps `--self-defending`, `--debug-protection`, `--debug-protection-interval`, `--disable-console-output`, `--domain-lock-redirect-url`, `--seed`, `--reserved-strings`, `--force-transform-strings`, `--split-strings`, and `--split-strings-chunk-length` directly to hosted engine options. String splitting uses fixed chunks from 1 through 1024 characters (default 10) and preserves directives, reserved literals, object keys, template segments, import/require specifiers, mixed-server markers, and Unicode surrogate pairs. 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` remains an approximate mapping. Source-map, identifier-cache/dictionary, rename-mode, strict-mode, and simplify workflow fields remain review-only. `--ignore-imports` is handled directly. Review-only fields emit compatibility warnings, and vendor-specific runtime behavior still requires validation.
|
|
97
|
+
|
|
98
|
+
For string-selection controls, the CLI maps `--reserved-strings`, and `--force-transform-strings` directly.
|
|
99
|
+
|
|
100
|
+
Quoted class method, accessor, and field names remain literal because class definition grammar does not accept concatenation expressions in those positions.
|
|
94
101
|
|
|
95
102
|
## Start with a conservative config
|
|
96
103
|
|
|
@@ -147,6 +154,22 @@ const multipleResults = await obfuscateMultiple({
|
|
|
147
154
|
|
|
148
155
|
Use `getOptionsByPreset("standard" | "balanced" | "maximum")` when replacing preset lookup helpers, and `translateJavascriptObfuscatorOptions(sourceOptions, overrides)` when migration tooling needs to inspect the mapped hosted API config before making the API call.
|
|
149
156
|
|
|
157
|
+
`stringArrayIndexShift` maps approximately to native `StringArrayIndexShift`. When enabled, references use a deterministic nonzero one-slot offset in both plain and encrypted string tables. This preserves the index-shifting protection shape, but does not reproduce `javascript-obfuscator`'s randomized shift magnitude; run the protected application in its target runtime before release.
|
|
158
|
+
|
|
159
|
+
`stringArrayShuffle` maps directly to native `StringArrayShuffle`. It randomizes the order of unique moved strings and rewrites every generated lookup before plain or encrypted table emission. Builds use fresh entropy by default; supplying `Seed` makes the shuffled artifact reproducible.
|
|
160
|
+
|
|
161
|
+
`stringArrayRotate` maps directly to native `StringArrayRotate`. For tables with multiple values it applies a nonzero cyclic offset chosen per build, then rewrites every generated lookup. It uses an independent entropy stream and remains reproducible when `Seed` is supplied.
|
|
162
|
+
|
|
163
|
+
`stringArrayIndexesType` maps directly to native `StringArrayIndexesType`. Both documented values are supported: `hexadecimal-number` emits numeric hexadecimal indexes, while `hexadecimal-numeric-string` emits hexadecimal strings with explicit numeric coercion before lookup. Mixed arrays select a representation per lookup from an independent entropy stream and remain reproducible under `Seed`.
|
|
164
|
+
|
|
165
|
+
`stringArrayThreshold` maps directly to native `StringArrayThreshold`. Values must be from 0 through 1. Each unique eligible literal receives one stable probability decision, so duplicate literals cannot split between moved and verbatim forms; zero disables moving, one moves every eligible literal, and partial selection is reproducible under `Seed`.
|
|
166
|
+
|
|
167
|
+
`stringArrayCallsTransform` and `stringArrayCallsTransformThreshold` map directly to native secondary index-table indirection. Selected lookups become `stringTable[indexTable[n]]`; the threshold accepts 0 through 1, defaults to 0.5 when transformation is enabled, and uses an independent entropy stream that is reproducible under `Seed`. It composes with shifting, shuffle, rotation, encryption, index representation, and compression.
|
|
168
|
+
|
|
169
|
+
The wrapper controls map to native root-level string-table wrappers. `stringArrayWrappersType` supports `variable` aliases and `function` wrappers; count is bounded to 0-10, function parameters to 2-5, and chained calls delegate through predecessors. Noise arguments and wrapper selection use isolated seeded entropy. Wrapper type, chaining, and parameter behavior map directly, while count is approximate because the competitor places wrappers inside each root or function scope and JSO deliberately emits them only at the protected root.
|
|
170
|
+
|
|
171
|
+
`transformObjectKeys` maps approximately to native `TransformObjectKeys`. Safe identifier and quoted object-literal data keys become computed string-table lookups. Numeric keys, method/accessor definitions, shorthand-sensitive members, and `__proto__` remain literal because converting those shapes can change JavaScript property or prototype semantics.
|
|
172
|
+
|
|
150
173
|
## JS-Confuser migration
|
|
151
174
|
|
|
152
175
|
Use the dedicated JS-Confuser helpers when the current project is built around `js-confuser` rather than `javascript-obfuscator`:
|
|
@@ -157,7 +180,9 @@ jso-protector --explain-js-confuser-compat lock.endDate --json
|
|
|
157
180
|
jso-protector --migrate-js-confuser js-confuser.config.cjs --output jso.config.json
|
|
158
181
|
```
|
|
159
182
|
|
|
160
|
-
The current JS-Confuser migration path maps common preset, lock, identifier, string, minify, and control-flow settings into the nearest hosted API equivalents.
|
|
183
|
+
The current JS-Confuser migration path maps common preset, lock, identifier, string, minify, and control-flow settings into the nearest hosted API equivalents. Anti-debugging, integrity/self-defending, start-date, and tamper-protection locks map approximately to native `DebugProtection`, `SelfDefending`, `LockStartDate`, and `AntiMonkeyPatching` controls. Numeric probability values collapse to enabled/disabled, so validate the protected build in its target browser. Arbitrary countermeasure functions, custom locks, opaque predicates, dispatcher mode, and similar JS-Confuser-specific behavior remain review items rather than being executed or guessed automatically.
|
|
184
|
+
|
|
185
|
+
`stringSplitting` maps approximately to native `SplitStrings`: booleans map directly and numeric probabilities greater than zero enable fixed-length splitting. Custom selector functions remain manual-review inputs and are not executed by migration tooling.
|
|
161
186
|
|
|
162
187
|
Existing custom build scripts can also use `protectCode(options, code, fileName)` when they prefer the JavaScript Obfuscator API naming:
|
|
163
188
|
|