jso-protector 0.2.0

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.
Files changed (119) hide show
  1. package/CHANGELOG.md +960 -0
  2. package/LICENSE +90 -0
  3. package/MIGRATION.md +207 -0
  4. package/README.md +1477 -0
  5. package/RELEASE.md +82 -0
  6. package/SECURITY.md +71 -0
  7. package/ai-cli.js +392 -0
  8. package/ai.js +176 -0
  9. package/bin/jso-protector.js +12066 -0
  10. package/browserify.d.ts +10 -0
  11. package/browserify.js +88 -0
  12. package/bun.d.ts +10 -0
  13. package/bun.js +41 -0
  14. package/ci/Jenkinsfile +82 -0
  15. package/ci/argo-workflows.yaml +121 -0
  16. package/ci/azure-pipelines.yml +56 -0
  17. package/ci/bitbucket-pipelines.yml +43 -0
  18. package/ci/buildkite.yml +50 -0
  19. package/ci/circleci.yml +60 -0
  20. package/ci/drone.yml +67 -0
  21. package/ci/github-actions.yml +51 -0
  22. package/ci/gitlab-ci.yml +39 -0
  23. package/ci/gocd.yaml +79 -0
  24. package/ci/teamcity.kts +79 -0
  25. package/ci/tekton.yaml +106 -0
  26. package/ci/verify-package.js +748 -0
  27. package/ci/verify-publish-metadata.js +147 -0
  28. package/ci/verify-templates.js +195 -0
  29. package/ci/woodpecker.yml +53 -0
  30. package/compliance/cli.js +204 -0
  31. package/compliance/evidence-forwarder.js +209 -0
  32. package/compliance/pci-dss-v4/controls.json +75 -0
  33. package/compliance/pci-dss-v4/index.js +2613 -0
  34. package/config/named-sets.js +185 -0
  35. package/esbuild.d.ts +16 -0
  36. package/esbuild.js +190 -0
  37. package/examples/README.md +78 -0
  38. package/examples/browserify/build.js +20 -0
  39. package/examples/bun/package.json +13 -0
  40. package/examples/bun/scripts/protect-release.js +28 -0
  41. package/examples/cli-basic/jso.config.cjs +23 -0
  42. package/examples/cli-basic/jso.config.json +15 -0
  43. package/examples/cli-basic/package.json +14 -0
  44. package/examples/cli-basic/scripts/build.js +10 -0
  45. package/examples/curl/README.md +55 -0
  46. package/examples/curl/protect.sh +106 -0
  47. package/examples/esbuild/build.js +19 -0
  48. package/examples/grunt/Gruntfile.js +29 -0
  49. package/examples/gulp/gulpfile.js +19 -0
  50. package/examples/helm/Chart.yaml +27 -0
  51. package/examples/helm/README.md +69 -0
  52. package/examples/helm/templates/_helpers.tpl +23 -0
  53. package/examples/helm/templates/_podtemplate.tpl +64 -0
  54. package/examples/helm/templates/job.yaml +39 -0
  55. package/examples/helm/templates/secret.yaml +17 -0
  56. package/examples/helm/values.yaml +54 -0
  57. package/examples/kubernetes/job.yaml +123 -0
  58. package/examples/metro.config.js +11 -0
  59. package/examples/nextjs/next.config.js +11 -0
  60. package/examples/node-api/protect-release.js +28 -0
  61. package/examples/node-api/release-summary.js +59 -0
  62. package/examples/parcel/package.json +13 -0
  63. package/examples/parcel/scripts/protect-release.js +28 -0
  64. package/examples/payment-page-script-inventory.json +62 -0
  65. package/examples/payment-page-security-headers.json +46 -0
  66. package/examples/pre-commit/.pre-commit-config.yaml +33 -0
  67. package/examples/pre-commit/README.md +45 -0
  68. package/examples/react-native/README.md +208 -0
  69. package/examples/react-native/metro.config.js +11 -0
  70. package/examples/rollup/rollup.config.js +20 -0
  71. package/examples/rspack/rspack.config.js +28 -0
  72. package/examples/turbopack/package.json +13 -0
  73. package/examples/turbopack/scripts/protect-release.js +28 -0
  74. package/examples/vite/vite.config.js +18 -0
  75. package/examples/webpack/webpack.config.js +21 -0
  76. package/examples/webpack-loader/webpack.config.js +22 -0
  77. package/governance/index.d.ts +18 -0
  78. package/governance/index.js +309 -0
  79. package/grunt.d.ts +4 -0
  80. package/grunt.js +111 -0
  81. package/gulp.d.ts +10 -0
  82. package/gulp.js +106 -0
  83. package/index.d.ts +879 -0
  84. package/index.js +607 -0
  85. package/jso.config.example.json +29 -0
  86. package/jso.config.schema.json +548 -0
  87. package/metro.d.ts +43 -0
  88. package/metro.js +117 -0
  89. package/next.d.ts +24 -0
  90. package/next.js +64 -0
  91. package/package.json +241 -0
  92. package/parcel.d.ts +10 -0
  93. package/parcel.js +40 -0
  94. package/react-native.d.ts +2 -0
  95. package/react-native.js +3 -0
  96. package/release-signer.js +245 -0
  97. package/rollup.d.ts +13 -0
  98. package/rollup.js +71 -0
  99. package/rspack-loader.d.ts +13 -0
  100. package/rspack-loader.js +11 -0
  101. package/rspack.d.ts +11 -0
  102. package/rspack.js +9 -0
  103. package/runtime/ai-script-governance.js +379 -0
  104. package/runtime/countermeasures.js +0 -0
  105. package/runtime/data-exfiltration-guard.d.ts +7 -0
  106. package/runtime/data-exfiltration-guard.js +161 -0
  107. package/runtime/environment-integrity.js +389 -0
  108. package/runtime/managed-integrity.d.ts +4 -0
  109. package/runtime/managed-integrity.js +108 -0
  110. package/runtime/third-party-inventory.js +437 -0
  111. package/turbopack.d.ts +10 -0
  112. package/turbopack.js +41 -0
  113. package/vite.d.ts +16 -0
  114. package/vite.js +78 -0
  115. package/watermark.js +126 -0
  116. package/webpack-loader.d.ts +15 -0
  117. package/webpack-loader.js +97 -0
  118. package/webpack.d.ts +13 -0
  119. package/webpack.js +143 -0
@@ -0,0 +1,548 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://www.javascriptobfuscator.com/schemas/jso-protector-config.schema.json",
4
+ "title": "jso-protector configuration",
5
+ "description": "Configuration for the jso-protector CLI and JavaScript Obfuscator HTTP API workflows.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "$defs": {
9
+ "countermeasures": {
10
+ "type": "object",
11
+ "additionalProperties": false,
12
+ "description": "RASP active countermeasures fired on tamper detection. See runtime/countermeasures.js.",
13
+ "properties": {
14
+ "onTamper": {
15
+ "oneOf": [
16
+ { "type": "string", "enum": ["log", "break", "deleteCookies", "selfDestruct", "redirect", "callback"] },
17
+ { "type": "array", "items": { "type": "string", "enum": ["log", "break", "deleteCookies", "selfDestruct", "redirect", "callback"] } }
18
+ ],
19
+ "description": "Action(s) fired on a tamper event. 'log' is always implicit. Array values fire in order."
20
+ },
21
+ "redirectUrl": {
22
+ "type": "string",
23
+ "format": "uri",
24
+ "pattern": "^https?://",
25
+ "description": "Safe redirect target. http:// or https:// only; javascript: schemes are rejected."
26
+ },
27
+ "selfDestruct": {
28
+ "type": "object",
29
+ "additionalProperties": false,
30
+ "properties": {
31
+ "mode": { "type": "string", "enum": ["blank-body", "crashWithMemory", "crashTimeout"] }
32
+ },
33
+ "description": "Escalation tier for the selfDestruct action."
34
+ },
35
+ "allowList": {
36
+ "type": "array",
37
+ "items": { "type": "string" },
38
+ "description": "Whitelist of actions allowed in this environment. onTamper is rejected if it references actions outside this list. Use in dev to prevent destructive escalations."
39
+ }
40
+ }
41
+ }
42
+ },
43
+ "properties": {
44
+ "$schema": {
45
+ "type": "string",
46
+ "description": "JSON schema reference used by editors."
47
+ },
48
+ "endpoint": {
49
+ "type": "string",
50
+ "format": "uri",
51
+ "default": "https://www.javascriptobfuscator.com/HttpApi.ashx"
52
+ },
53
+ "apiKey": {
54
+ "type": "string",
55
+ "description": "Base64 API key copied from the dashboard, or an environment reference such as $JSO_API_KEY."
56
+ },
57
+ "apiPassword": {
58
+ "type": "string",
59
+ "description": "Base64 API password copied from the dashboard, or an environment reference such as $JSO_API_PASSWORD."
60
+ },
61
+ "projectName": {
62
+ "type": "string",
63
+ "default": "browser-release"
64
+ },
65
+ "input": {
66
+ "type": "string",
67
+ "default": "dist"
68
+ },
69
+ "output": {
70
+ "type": "string",
71
+ "default": "dist-protected"
72
+ },
73
+ "preset": {
74
+ "type": "string",
75
+ "enum": ["standard", "balanced", "maximum"],
76
+ "default": "balanced"
77
+ },
78
+ "optionsPreset": {
79
+ "type": "string",
80
+ "description": "javascript-obfuscator compatibility preset. default/low maps to standard, medium maps to balanced, high maps to maximum."
81
+ },
82
+ "stringArray": {
83
+ "type": "boolean",
84
+ "description": "javascript-obfuscator compatibility option mapped to MoveStrings."
85
+ },
86
+ "stringArrayEncoding": {
87
+ "oneOf": [
88
+ { "type": "string" },
89
+ { "type": "array", "items": { "type": "string" } }
90
+ ],
91
+ "description": "javascript-obfuscator compatibility option mapped to EncodeStrings or EncryptStrings."
92
+ },
93
+ "stringArrayThreshold": {
94
+ "type": "number",
95
+ "minimum": 0,
96
+ "description": "javascript-obfuscator compatibility option that enables MoveStrings when greater than zero."
97
+ },
98
+ "unicodeEscapeSequence": {
99
+ "type": "boolean",
100
+ "description": "javascript-obfuscator compatibility option mapped to EncodeStrings."
101
+ },
102
+ "controlFlowFlattening": {
103
+ "type": "boolean",
104
+ "description": "javascript-obfuscator compatibility option mapped to DeepObfuscate and FlatTransform."
105
+ },
106
+ "deadCodeInjection": {
107
+ "type": "boolean",
108
+ "description": "javascript-obfuscator compatibility option mapped to AddDeadCode."
109
+ },
110
+ "deadCodeInjectionThreshold": {
111
+ "type": "number",
112
+ "minimum": 0,
113
+ "description": "javascript-obfuscator compatibility threshold mapped to DeadcodeLevel."
114
+ },
115
+ "identifierNamesGenerator": {
116
+ "type": "string",
117
+ "description": "javascript-obfuscator compatibility option mapped to IdentityStyle."
118
+ },
119
+ "renameGlobals": {
120
+ "type": "boolean",
121
+ "description": "javascript-obfuscator compatibility option mapped to RenameGlobals."
122
+ },
123
+ "renameProperties": {
124
+ "type": "boolean",
125
+ "description": "javascript-obfuscator compatibility option mapped to RenameMembers."
126
+ },
127
+ "domainLock": {
128
+ "oneOf": [
129
+ { "type": "string" },
130
+ { "type": "array", "items": { "type": "string" } }
131
+ ],
132
+ "description": "javascript-obfuscator compatibility option mapped to LockDomain and LockDomainList."
133
+ },
134
+ "compact": {
135
+ "type": "boolean",
136
+ "description": "javascript-obfuscator compatibility option mapped to compression or formatted output."
137
+ },
138
+ "target": {
139
+ "type": "string",
140
+ "description": "javascript-obfuscator compatibility runtime target mapped to OptimizationMode."
141
+ },
142
+ "debugProtection": {
143
+ "type": "boolean",
144
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
145
+ },
146
+ "debugProtectionInterval": {
147
+ "type": "number",
148
+ "minimum": 0,
149
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
150
+ },
151
+ "disableConsoleOutput": {
152
+ "type": "boolean",
153
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
154
+ },
155
+ "domainLockRedirectUrl": {
156
+ "type": "string",
157
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
158
+ },
159
+ "forceTransformStrings": {
160
+ "type": "array",
161
+ "items": { "type": "string" },
162
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
163
+ },
164
+ "identifiersDictionary": {
165
+ "type": "array",
166
+ "items": { "type": "string" },
167
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
168
+ },
169
+ "identifiersPrefix": {
170
+ "type": "string",
171
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
172
+ },
173
+ "identifierNamesCache": {
174
+ "type": ["object", "null"],
175
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
176
+ },
177
+ "identifierNamesCachePath": {
178
+ "type": "string",
179
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
180
+ },
181
+ "inputFileName": {
182
+ "type": "string",
183
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
184
+ },
185
+ "log": {
186
+ "type": "boolean",
187
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
188
+ },
189
+ "numbersToExpressions": {
190
+ "type": "boolean",
191
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
192
+ },
193
+ "renamePropertiesMode": {
194
+ "type": "string",
195
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
196
+ },
197
+ "reservedStrings": {
198
+ "type": "array",
199
+ "items": { "type": "string" },
200
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
201
+ },
202
+ "seed": {
203
+ "type": ["string", "number"],
204
+ "description": "Deterministic seed for reproducible builds: the same input, options, and seed produce byte-identical output. Omit for the default per-build polymorphic output. An integer is used directly; any other string folds to a stable value. Forwarded to the engine as the Seed option (also settable via --seed or options.Seed)."
205
+ },
206
+ "selfDefending": {
207
+ "type": "boolean",
208
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
209
+ },
210
+ "simplify": {
211
+ "type": "boolean",
212
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
213
+ },
214
+ "sourceMap": {
215
+ "type": "boolean",
216
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
217
+ },
218
+ "sourceMapBaseUrl": {
219
+ "type": "string",
220
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
221
+ },
222
+ "sourceMapFileName": {
223
+ "type": "string",
224
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
225
+ },
226
+ "sourceMapMode": {
227
+ "type": "string",
228
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
229
+ },
230
+ "sourceMapSourcesMode": {
231
+ "type": "string",
232
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
233
+ },
234
+ "strictMode": {
235
+ "type": ["boolean", "null"],
236
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
237
+ },
238
+ "splitStrings": {
239
+ "type": "boolean",
240
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
241
+ },
242
+ "splitStringsChunkLength": {
243
+ "type": "number",
244
+ "minimum": 0,
245
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
246
+ },
247
+ "stringArrayCallsTransform": {
248
+ "type": "boolean",
249
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
250
+ },
251
+ "stringArrayCallsTransformThreshold": {
252
+ "type": "number",
253
+ "minimum": 0,
254
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
255
+ },
256
+ "stringArrayIndexShift": {
257
+ "type": "boolean",
258
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
259
+ },
260
+ "stringArrayIndexesType": {
261
+ "oneOf": [
262
+ { "type": "string" },
263
+ { "type": "array", "items": { "type": "string" } }
264
+ ],
265
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
266
+ },
267
+ "stringArrayRotate": {
268
+ "type": "boolean",
269
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
270
+ },
271
+ "stringArrayShuffle": {
272
+ "type": "boolean",
273
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
274
+ },
275
+ "stringArrayWrappersChainedCalls": {
276
+ "type": "boolean",
277
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
278
+ },
279
+ "stringArrayWrappersCount": {
280
+ "type": "number",
281
+ "minimum": 0,
282
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
283
+ },
284
+ "stringArrayWrappersParametersMaxCount": {
285
+ "type": "number",
286
+ "minimum": 0,
287
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
288
+ },
289
+ "stringArrayWrappersType": {
290
+ "type": "string",
291
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
292
+ },
293
+ "ignoreImports": {
294
+ "type": "boolean",
295
+ "description": "javascript-obfuscator compatibility field. Preserves import/export-from statements and common static require/import() statements before sending the remaining code to the hosted API."
296
+ },
297
+ "transformObjectKeys": {
298
+ "type": "boolean",
299
+ "description": "javascript-obfuscator review-only compatibility field. Accepted for migration review."
300
+ },
301
+ "webPreset": {
302
+ "type": "string",
303
+ "description": "Path to an exported online-obfuscator JSON preset."
304
+ },
305
+ "extensions": {
306
+ "type": "array",
307
+ "items": { "type": "string" },
308
+ "default": [".js", ".jsx"]
309
+ },
310
+ "markupExtensions": {
311
+ "type": "array",
312
+ "items": { "type": "string" },
313
+ "description": "Template/markup extensions that use parseHtml inline-script protection. Defaults include .html, .htm, .php, .phtml, .asp, .aspx, .jsp, .cshtml, and .vbhtml."
314
+ },
315
+ "include": {
316
+ "type": "array",
317
+ "items": { "type": "string" },
318
+ "description": "Bundle-plugin include patterns matched against emitted asset names."
319
+ },
320
+ "exclude": {
321
+ "type": "array",
322
+ "items": { "type": "string" },
323
+ "default": ["**/*.map", "**/node_modules/**", "**/*-obfuscated.js"]
324
+ },
325
+ "copyAssets": {
326
+ "type": "boolean",
327
+ "default": true
328
+ },
329
+ "parseHtml": {
330
+ "type": "boolean",
331
+ "default": false,
332
+ "description": "Protect inline scripts marked with data-javascript-obfuscator in configured markup/template files."
333
+ },
334
+ "honorConditionalComments": {
335
+ "type": "boolean",
336
+ "default": false,
337
+ "description": "Preserve code between javascript-obfuscator:disable and javascript-obfuscator:enable comments instead of failing on those markers."
338
+ },
339
+ "protectMarkedComments": {
340
+ "type": "boolean",
341
+ "default": false,
342
+ "description": "Protect only code between javascript-obfuscator:protect-begin and javascript-obfuscator:protect-end comments instead of sending the whole file."
343
+ },
344
+ "keepHeaderComment": {
345
+ "type": "boolean",
346
+ "description": "Convenience alias for options.KeepComment."
347
+ },
348
+ "protectObjectDeclaration": {
349
+ "type": "boolean",
350
+ "description": "Convenience alias for options.ReorderCodeObjectDeclare."
351
+ },
352
+ "moveNestedFunction": {
353
+ "type": "boolean",
354
+ "description": "Convenience alias for options.MoveNested."
355
+ },
356
+ "formattedOutput": {
357
+ "type": "boolean",
358
+ "description": "Convenience alias for options.WriteFormats."
359
+ },
360
+ "keepIndent": {
361
+ "type": "boolean",
362
+ "description": "Convenience alias for options.WriteFormats_KeepIndent."
363
+ },
364
+ "lineNumbers": {
365
+ "type": "boolean",
366
+ "description": "Convenience alias for options.WriteFormats_LineNumbers."
367
+ },
368
+ "lockDomainSubdomains": {
369
+ "type": "boolean",
370
+ "description": "Convenience alias for options.LockDomainSubs."
371
+ },
372
+ "lockDomainMessage": {
373
+ "type": "string",
374
+ "description": "Convenience alias for options.LockDomainMsg."
375
+ },
376
+ "lockDate": {
377
+ "type": "boolean",
378
+ "description": "Convenience alias for options.LockDate."
379
+ },
380
+ "lockDateValue": {
381
+ "type": "string",
382
+ "pattern": "^[0-9]{8}$",
383
+ "description": "Convenience alias for options.LockDateValue."
384
+ },
385
+ "lockDateMessage": {
386
+ "type": "string",
387
+ "description": "Convenience alias for options.LockDateMsg."
388
+ },
389
+ "jsConfuserLockAntiDebug": {
390
+ "oneOf": [
391
+ { "type": "boolean" },
392
+ { "type": "number", "minimum": 0 }
393
+ ],
394
+ "description": "JS-Confuser review-only compatibility field. Preserves lock.antiDebug intent for manual review."
395
+ },
396
+ "jsConfuserLockIntegrity": {
397
+ "oneOf": [
398
+ { "type": "boolean" },
399
+ { "type": "number", "minimum": 0 }
400
+ ],
401
+ "description": "JS-Confuser review-only compatibility field. Preserves lock.integrity intent for manual review."
402
+ },
403
+ "jsConfuserLockSelfDefending": {
404
+ "oneOf": [
405
+ { "type": "boolean" },
406
+ { "type": "number", "minimum": 0 }
407
+ ],
408
+ "description": "JS-Confuser review-only compatibility field. Preserves lock.selfDefending intent for manual review."
409
+ },
410
+ "jsConfuserLockStartDate": {
411
+ "type": "string",
412
+ "description": "JS-Confuser review-only compatibility field. Preserves lock.startDate intent for manual review."
413
+ },
414
+ "jsConfuserLockCountermeasures": {
415
+ "type": "string",
416
+ "description": "JS-Confuser review-only compatibility field. Preserves lock.countermeasures intent for manual review."
417
+ },
418
+ "jsConfuserLockTamperProtection": {
419
+ "oneOf": [
420
+ { "type": "boolean" },
421
+ { "type": "number", "minimum": 0 }
422
+ ],
423
+ "description": "JS-Confuser review-only compatibility field. Preserves lock.tamperProtection intent for manual review."
424
+ },
425
+ "assetExclude": {
426
+ "type": "array",
427
+ "items": { "type": "string" },
428
+ "default": ["**/*.map"]
429
+ },
430
+ "mixedServer": {
431
+ "type": "boolean",
432
+ "default": false
433
+ },
434
+ "reservedNames": {
435
+ "type": "array",
436
+ "items": { "type": "string" },
437
+ "description": "Regular expressions for public names to preserve. Mapped to VariableExclusion."
438
+ },
439
+ "variableExclusion": {
440
+ "type": "string",
441
+ "description": "Multiline Variable Exclusion List sent directly to the API."
442
+ },
443
+ "removeSourceMaps": {
444
+ "type": "boolean",
445
+ "default": true,
446
+ "description": "Bundle-plugin option. Removes stale JavaScript source maps after protection."
447
+ },
448
+ "manifest": {
449
+ "type": "string",
450
+ "description": "Path to a JSON protection manifest written after a successful CLI or bundle-plugin run."
451
+ },
452
+ "report": {
453
+ "type": "string",
454
+ "description": "Path to write the full API response JSON (BuildId, PolymorphismFingerprint, identifier maps, audit metadata). Pair with jso-symbolicate for stack-trace demangling."
455
+ },
456
+ "label": {
457
+ "type": "string",
458
+ "description": "Release label tagged on the API request as ReleaseLabel (e.g. git SHA or CI build number). Surfaces in the JSO dashboard audit log. Reads JSO_LABEL / JAVASCRIPT_OBFUSCATOR_LABEL from env when omitted."
459
+ },
460
+ "namedSets": {
461
+ "type": "object",
462
+ "description": "Named configuration sets - apply different protection profiles to different parts of one app. Each set has a 'match' array of globs and any subset of the top-level keys (preset, options, countermeasures). First-matching set wins; write sets in priority order. See /Docs/NamedSets.aspx.",
463
+ "additionalProperties": {
464
+ "type": "object",
465
+ "properties": {
466
+ "match": {
467
+ "type": "array",
468
+ "items": { "type": "string" },
469
+ "description": "File globs that select this set. Supports **, *, ?, [a-z], {a,b}."
470
+ },
471
+ "preset": {
472
+ "type": "string",
473
+ "enum": ["standard", "balanced", "maximum"]
474
+ },
475
+ "options": {
476
+ "type": "object",
477
+ "description": "Per-set options. Merged on top of the top-level options."
478
+ },
479
+ "countermeasures": { "$ref": "#/$defs/countermeasures" }
480
+ },
481
+ "required": ["match"],
482
+ "additionalProperties": false
483
+ }
484
+ },
485
+ "countermeasures": {
486
+ "$ref": "#/$defs/countermeasures",
487
+ "description": "Top-level RASP active countermeasures applied to every file unless overridden by a namedSets entry. See /Docs/RuntimeDefense.aspx#countermeasures."
488
+ },
489
+ "watermark": {
490
+ "type": "string",
491
+ "description": "Tag to embed as an HMAC-SHA256 watermark in every protected file's header comment. Requires watermarkKey. Verifiable with --verify-watermark / --scan-watermarks. Wire format: /Docs/WireFormat.aspx#watermark"
492
+ },
493
+ "watermarkKey": {
494
+ "type": "string",
495
+ "description": "HMAC secret for watermark signing. Reads JSO_WATERMARK_KEY from env when omitted. Should be stored in a CI secret, not committed to the config file."
496
+ },
497
+ "maxOutputBytes": {
498
+ "type": "number",
499
+ "exclusiveMinimum": 0,
500
+ "description": "Fail the CLI or bundle-plugin run if any protected JavaScript file is larger than this many bytes."
501
+ },
502
+ "maxGrowthRatio": {
503
+ "type": "number",
504
+ "exclusiveMinimum": 0,
505
+ "description": "Fail the CLI or bundle-plugin run if any protected JavaScript file grows beyond sourceBytes multiplied by this ratio."
506
+ },
507
+ "options": {
508
+ "type": "object",
509
+ "description": "Advanced HTTP API options. Explicit values override the selected preset.",
510
+ "additionalProperties": {
511
+ "type": ["string", "number", "boolean", "null", "array", "object"]
512
+ },
513
+ "properties": {
514
+ "EncodeStrings": { "type": "boolean" },
515
+ "MoveStrings": { "type": "boolean" },
516
+ "ReplaceNames": { "type": "boolean" },
517
+ "RenameGlobals": { "type": "boolean" },
518
+ "RenameMembers": { "type": "boolean" },
519
+ "MoveMembers": { "type": "boolean" },
520
+ "SelfCompression": { "type": "boolean" },
521
+ "SelfCompressionMinSize": { "type": "number" },
522
+ "CompressionRatio": { "type": "string", "enum": ["Auto", "Low", "Medium", "High", "Best"] },
523
+ "DeepObfuscate": { "type": "boolean" },
524
+ "ReorderCode": { "type": "boolean" },
525
+ "AddDeadCode": { "type": "boolean" },
526
+ "DeadcodeLevel": { "type": "string", "enum": ["Low", "Medium", "High"] },
527
+ "EncryptStrings": { "type": "boolean" },
528
+ "FlatTransform": { "type": "boolean" },
529
+ "IdentityStyle": { "type": "string", "enum": ["v1hex", "v2abcd"] },
530
+ "OptimizationMode": { "type": "string", "enum": ["Auto", "Web", "Html5", "Game", "Mobile", "NodeJS"] },
531
+ "VariableExclusion": { "type": "string" },
532
+ "WriteFormats": { "type": "boolean" },
533
+ "WriteFormats_KeepIndent": { "type": "boolean" },
534
+ "WriteFormats_LineNumbers": { "type": "boolean" },
535
+ "KeepComment": { "type": "boolean" },
536
+ "ReorderCodeObjectDeclare": { "type": "boolean" },
537
+ "MoveNested": { "type": "boolean" },
538
+ "LockDomain": { "type": "boolean" },
539
+ "LockDomainSubs": { "type": "boolean" },
540
+ "LockDomainList": { "type": "string" },
541
+ "LockDomainMsg": { "type": "string" },
542
+ "LockDate": { "type": "boolean" },
543
+ "LockDateValue": { "type": "string", "pattern": "^[0-9]{8}$" },
544
+ "LockDateMsg": { "type": "string" }
545
+ }
546
+ }
547
+ }
548
+ }
package/metro.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ import type { HttpFileItem, HttpResult, ProtectionOptions } from "./index";
2
+
3
+ export interface MetroSerializerOptionsLike {
4
+ dev?: boolean;
5
+ platform?: string | null;
6
+ projectRoot?: string;
7
+ [key: string]: unknown;
8
+ }
9
+
10
+ export interface MetroSerializerResultLike {
11
+ code: string | Buffer;
12
+ map?: unknown;
13
+ assets?: readonly unknown[];
14
+ [key: string]: unknown;
15
+ }
16
+
17
+ export type MetroSerializerLike = (
18
+ entryPoint: string,
19
+ preModules: readonly unknown[],
20
+ graph: unknown,
21
+ options: MetroSerializerOptionsLike
22
+ ) => string | Buffer | MetroSerializerResultLike | Promise<string | Buffer | MetroSerializerResultLike>;
23
+
24
+ export interface JsoProtectorMetroOptions extends ProtectionOptions {
25
+ fileName?: string;
26
+ removeSourceMaps?: boolean;
27
+ serializer?: MetroSerializerLike;
28
+ protectItems?: (config: ProtectionOptions, items: HttpFileItem[]) => Promise<HttpResult>;
29
+ }
30
+
31
+ export interface MetroConfigLike {
32
+ serializer?: {
33
+ customSerializer?: MetroSerializerLike;
34
+ [key: string]: unknown;
35
+ };
36
+ [key: string]: unknown;
37
+ }
38
+
39
+ declare function createMetroSerializer(options?: JsoProtectorMetroOptions): MetroSerializerLike;
40
+ declare function withJsoProtectorMetro(baseConfig?: MetroConfigLike, options?: JsoProtectorMetroOptions): MetroConfigLike;
41
+
42
+ export { createMetroSerializer, withJsoProtectorMetro };
43
+ export default createMetroSerializer;