jso-protector 0.2.0 → 0.4.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.
- package/CHANGELOG.md +79 -0
- package/MIGRATION.md +27 -2
- package/README.md +119 -29
- 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 +47 -4
package/ci/Jenkinsfile
CHANGED
|
@@ -51,14 +51,15 @@ pipeline {
|
|
|
51
51
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
52
52
|
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
53
53
|
# store ci-key.priv.pem in a CI file secret. See WireFormat.aspx#watermark.
|
|
54
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
55
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
56
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
57
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
54
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
55
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
56
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
57
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
58
58
|
# --ai-precheck --ai-precheck-fail-on error // AI compat scan gate
|
|
59
59
|
# --estimate // pre-flight quota gate
|
|
60
60
|
# --watermark "$COMMIT_SHA" // HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
61
61
|
# --sign-release ci-key.priv.pem // Ed25519 attestation -> .manifest.json.sig
|
|
62
|
+
# --local // protect on the runner, no source upload (Windows agents only)
|
|
62
63
|
'''
|
|
63
64
|
}
|
|
64
65
|
}
|
package/ci/argo-workflows.yaml
CHANGED
|
@@ -98,14 +98,15 @@ spec:
|
|
|
98
98
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
99
99
|
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
100
100
|
# store ci-key.priv.pem in a CI file secret. See WireFormat.aspx#watermark.
|
|
101
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
102
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
103
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
104
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
101
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
102
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
103
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
104
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
105
105
|
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
106
106
|
# --estimate # pre-flight quota gate
|
|
107
107
|
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
108
108
|
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
109
|
+
# --local # protect on the runner, no source upload (Windows agents only)
|
|
109
110
|
npm run smoke --if-present
|
|
110
111
|
volumeMounts:
|
|
111
112
|
- name: workspace
|
package/ci/azure-pipelines.yml
CHANGED
|
@@ -36,14 +36,15 @@ steps:
|
|
|
36
36
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
37
37
|
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
38
38
|
# store ci-key.priv.pem in a CI file secret. See WireFormat.aspx#watermark.
|
|
39
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
40
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
41
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
42
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
39
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
40
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
41
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
42
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
43
43
|
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
44
44
|
# --estimate # pre-flight quota gate
|
|
45
45
|
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
46
46
|
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
47
|
+
# --local # protect on the runner, no source upload (Windows agents only)
|
|
47
48
|
displayName: Protect JavaScript
|
|
48
49
|
env:
|
|
49
50
|
JSO_API_KEY: $(JSO_API_KEY)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Bitbucket Pipelines template for jso-protector.
|
|
2
2
|
#
|
|
3
3
|
# Drop this at bitbucket-pipelines.yml in your repo. Add JSO_API_KEY and
|
|
4
|
-
# JSO_API_PASSWORD as repository variables (Settings �?Pipelines �?Repository
|
|
4
|
+
# JSO_API_PASSWORD as repository variables (Settings �?Pipelines �?Repository
|
|
5
5
|
# variables, secured).
|
|
6
6
|
#
|
|
7
7
|
# Every protection run is tagged with $BITBUCKET_COMMIT and the API report
|
|
@@ -30,14 +30,15 @@ pipelines:
|
|
|
30
30
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
31
31
|
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
32
32
|
# store ci-key.priv.pem in a CI file secret. See WireFormat.aspx#watermark.
|
|
33
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
34
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
35
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
36
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
33
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
34
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
35
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
36
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
37
37
|
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
38
38
|
# --estimate # pre-flight quota gate
|
|
39
39
|
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
40
40
|
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
41
|
+
# --local # protect on the runner, no source upload (Windows agents only)
|
|
41
42
|
- npm run smoke --if-present
|
|
42
43
|
artifacts:
|
|
43
44
|
- dist-protected/**
|
package/ci/buildkite.yml
CHANGED
|
@@ -31,14 +31,15 @@ steps:
|
|
|
31
31
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
32
32
|
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
33
33
|
# store ci-key.priv.pem in a CI file secret. See WireFormat.aspx#watermark.
|
|
34
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
35
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
36
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
37
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
34
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
35
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
36
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
37
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
38
38
|
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
39
39
|
# --estimate # pre-flight quota gate
|
|
40
40
|
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
41
41
|
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
42
|
+
# --local # protect on the runner, no source upload (Windows agents only)
|
|
42
43
|
npm run smoke --if-present
|
|
43
44
|
artifact_paths:
|
|
44
45
|
- "dist-protected/**/*"
|
package/ci/circleci.yml
CHANGED
|
@@ -34,14 +34,15 @@ jobs:
|
|
|
34
34
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
35
35
|
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
36
36
|
# store ci-key.priv.pem in a CI file secret. See WireFormat.aspx#watermark.
|
|
37
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
38
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
39
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
40
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
37
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
38
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
39
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
40
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
41
41
|
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
42
42
|
# --estimate # pre-flight quota gate
|
|
43
43
|
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
44
44
|
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
45
|
+
# --local # protect on the runner, no source upload (Windows agents only)
|
|
45
46
|
- run:
|
|
46
47
|
name: Smoke test protected output
|
|
47
48
|
command: npm run smoke --if-present
|
package/ci/drone.yml
CHANGED
|
@@ -43,14 +43,15 @@ steps:
|
|
|
43
43
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
44
44
|
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
45
45
|
# store ci-key.priv.pem in a CI file secret. See WireFormat.aspx#watermark.
|
|
46
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
47
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
48
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
49
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
46
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
47
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
48
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
49
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
50
50
|
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
51
51
|
# --estimate # pre-flight quota gate
|
|
52
52
|
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
53
53
|
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
54
|
+
# --local # protect on the runner, no source upload (Windows agents only)
|
|
54
55
|
- npm run smoke --if-present
|
|
55
56
|
|
|
56
57
|
- name: archive
|
package/ci/github-actions.yml
CHANGED
|
@@ -31,14 +31,15 @@ jobs:
|
|
|
31
31
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
32
32
|
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
33
33
|
# store ci-key.priv.pem in a CI file secret. See WireFormat.aspx#watermark.
|
|
34
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
35
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
36
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
37
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
34
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
35
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
36
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
37
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
38
38
|
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
39
39
|
# --estimate # pre-flight quota gate
|
|
40
40
|
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
41
41
|
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
42
|
+
# --local # protect on the runner, no source upload (Windows agents only)
|
|
42
43
|
env:
|
|
43
44
|
JSO_API_KEY: ${{ secrets.JSO_API_KEY }}
|
|
44
45
|
JSO_API_PASSWORD: ${{ secrets.JSO_API_PASSWORD }}
|
package/ci/gitlab-ci.yml
CHANGED
|
@@ -20,14 +20,15 @@ protected-release:
|
|
|
20
20
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
21
21
|
# Configure JSO_WATERMARK_KEY as a masked variable; check in ci-key.pub.pem,
|
|
22
22
|
# store ci-key.priv.pem as a file variable. See WireFormat.aspx#watermark.
|
|
23
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
24
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
25
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
26
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
23
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
24
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
25
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
26
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
27
27
|
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
28
28
|
# --estimate # pre-flight quota gate
|
|
29
29
|
# --watermark "$CI_COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
30
30
|
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
31
|
+
# --local # protect on the runner, no source upload (Windows agents only)
|
|
31
32
|
- npm run smoke
|
|
32
33
|
artifacts:
|
|
33
34
|
paths:
|
package/ci/gocd.yaml
CHANGED
|
@@ -66,14 +66,15 @@ pipelines:
|
|
|
66
66
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
67
67
|
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
68
68
|
# store ci-key.priv.pem in a CI file secret. See WireFormat.aspx#watermark.
|
|
69
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
70
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
71
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
72
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
69
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
70
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
71
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
72
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
73
73
|
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
74
74
|
# --estimate # pre-flight quota gate
|
|
75
75
|
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
76
76
|
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
77
|
+
# --local # protect on the runner, no source upload (Windows agents only)
|
|
77
78
|
- exec:
|
|
78
79
|
command: npm
|
|
79
80
|
arguments: [ "run", "smoke", "--if-present" ]
|
package/ci/teamcity.kts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// TeamCity Kotlin DSL template for jso-protector.
|
|
2
2
|
//
|
|
3
3
|
// Drop this at .teamcity/settings.kts in your repo and enable
|
|
4
|
-
// Versioned Settings �?Kotlin DSL in your TeamCity project. Add JSO_API_KEY
|
|
4
|
+
// Versioned Settings �?Kotlin DSL in your TeamCity project. Add JSO_API_KEY
|
|
5
5
|
// and JSO_API_PASSWORD as project-level parameters with the password type
|
|
6
6
|
// so they're masked in logs.
|
|
7
7
|
//
|
|
@@ -61,14 +61,15 @@ object ProtectedRelease : BuildType({
|
|
|
61
61
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
62
62
|
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
63
63
|
# store ci-key.priv.pem in a CI file secret. See WireFormat.aspx#watermark.
|
|
64
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
65
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
66
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
67
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
64
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
65
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
66
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
67
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
68
68
|
# --ai-precheck --ai-precheck-fail-on error // AI compat scan gate
|
|
69
69
|
# --estimate // pre-flight quota gate
|
|
70
70
|
# --watermark "$COMMIT_SHA" // HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
71
71
|
# --sign-release ci-key.priv.pem // Ed25519 attestation -> .manifest.json.sig
|
|
72
|
+
# --local // protect on the runner, no source upload (Windows agents only)
|
|
72
73
|
""".trimIndent()
|
|
73
74
|
}
|
|
74
75
|
script {
|
package/ci/tekton.yaml
CHANGED
|
@@ -74,14 +74,15 @@ spec:
|
|
|
74
74
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
75
75
|
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
76
76
|
# store ci-key.priv.pem in a CI file secret. See WireFormat.aspx#watermark.
|
|
77
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
78
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
79
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
80
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
77
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
78
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
79
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
80
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
81
81
|
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
82
82
|
# --estimate # pre-flight quota gate
|
|
83
83
|
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
84
84
|
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
85
|
+
# --local # protect on the runner, no source upload (Windows agents only)
|
|
85
86
|
npm run smoke --if-present
|
|
86
87
|
---
|
|
87
88
|
apiVersion: tekton.dev/v1
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const childProcess = require("node:child_process");
|
|
6
|
+
const fs = require("node:fs");
|
|
7
|
+
const os = require("node:os");
|
|
8
|
+
const path = require("node:path");
|
|
9
|
+
|
|
10
|
+
const root = path.resolve(__dirname, "..");
|
|
11
|
+
const examplesRoot = path.join(root, "examples");
|
|
12
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
|
|
13
|
+
const expectedVersion = packageJson.version;
|
|
14
|
+
|
|
15
|
+
function fail(message) {
|
|
16
|
+
process.stderr.write(`verify-examples: FAIL: ${message}\n`);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function walk(folder) {
|
|
21
|
+
return fs.readdirSync(folder, { withFileTypes: true }).flatMap((entry) => {
|
|
22
|
+
const full = path.join(folder, entry.name);
|
|
23
|
+
return entry.isDirectory() ? walk(full) : [full];
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function runNode(args, options = {}) {
|
|
28
|
+
const result = childProcess.spawnSync(process.execPath, args, { encoding: "utf8", ...options });
|
|
29
|
+
if (result.status !== 0) fail(`${args.join(" ")} failed: ${(result.stderr || result.stdout || result.error || "unknown error").toString().trim()}`);
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const files = walk(examplesRoot);
|
|
34
|
+
const scripts = files.filter((file) => /\.(?:js|cjs)$/.test(file));
|
|
35
|
+
const jsonFiles = files.filter((file) => path.extname(file) === ".json");
|
|
36
|
+
|
|
37
|
+
for (const file of scripts) runNode(["--check", file]);
|
|
38
|
+
for (const file of jsonFiles) {
|
|
39
|
+
try { JSON.parse(fs.readFileSync(file, "utf8")); }
|
|
40
|
+
catch (error) { fail(`${path.relative(root, file)} is invalid JSON: ${error.message}`); }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const readme = fs.readFileSync(path.join(examplesRoot, "README.md"), "utf8");
|
|
44
|
+
if (!readme.includes(`npm install --save-dev jso-protector@${expectedVersion}`)) fail("examples README does not install the current public version");
|
|
45
|
+
if (readme.includes("intentionally not published to npm")) fail("examples README still says the public package is unpublished");
|
|
46
|
+
|
|
47
|
+
const reactNativeReadme = fs.readFileSync(path.join(examplesRoot, "react-native", "README.md"), "utf8");
|
|
48
|
+
for (const stale of ["jso-protector/metro.js", "npx jso ai compat-scan"]) {
|
|
49
|
+
if (reactNativeReadme.includes(stale)) fail(`React Native guide contains stale command ${JSON.stringify(stale)}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const exportKeys = new Set(Object.keys(packageJson.exports));
|
|
53
|
+
for (const file of files.filter((candidate) => /\.(?:js|cjs|md)$/.test(candidate))) {
|
|
54
|
+
const source = fs.readFileSync(file, "utf8");
|
|
55
|
+
for (const match of source.matchAll(/(?:require\(|from\s+)["']jso-protector(\/[a-z0-9-]+)?["']/gi)) {
|
|
56
|
+
const key = match[1] ? `.${match[1]}` : ".";
|
|
57
|
+
if (!exportKeys.has(key)) fail(`${path.relative(root, file)} references undeclared package export ${key}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const configPath = path.join(examplesRoot, "cli-basic", "jso.config.json");
|
|
62
|
+
if (!fs.existsSync(configPath)) fail("cli-basic/jso.config.json is missing");
|
|
63
|
+
|
|
64
|
+
const temp = fs.mkdtempSync(path.join(os.tmpdir(), "jso-example-"));
|
|
65
|
+
const copied = path.join(temp, "cli-basic");
|
|
66
|
+
fs.cpSync(path.join(examplesRoot, "cli-basic"), copied, { recursive: true });
|
|
67
|
+
runNode([path.join(copied, "scripts", "build.js")], { cwd: copied });
|
|
68
|
+
for (const relative of ["dist/app.js", "dist/index.html"]) {
|
|
69
|
+
if (!fs.existsSync(path.join(copied, relative))) fail(`cli-basic build did not produce ${relative}`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const planScript = [
|
|
73
|
+
`const { planProtection } = require(${JSON.stringify(root)});`,
|
|
74
|
+
`const plan = planProtection({ input: "dist", output: "dist-protected", extensions: [".js"], copyAssets: true });`,
|
|
75
|
+
`if (plan.summary.files.length !== 1) throw new Error("expected one JS input");`,
|
|
76
|
+
`if (!plan.summary.assets.some((item) => item.endsWith("index.html"))) throw new Error("expected copied HTML asset");`
|
|
77
|
+
].join("\n");
|
|
78
|
+
runNode(["-e", planScript], { cwd: copied });
|
|
79
|
+
|
|
80
|
+
process.stdout.write(`verify-examples: PASS (${scripts.length} scripts, ${jsonFiles.length} JSON files, CLI build and offline plan)\n`);
|
package/ci/verify-package.js
CHANGED
|
@@ -28,6 +28,7 @@ const REQUIRED_PACKED_FILES = [
|
|
|
28
28
|
"ci/github-actions.yml",
|
|
29
29
|
"ci/gitlab-ci.yml",
|
|
30
30
|
"ci/verify-package.js",
|
|
31
|
+
"ci/verify-examples.js",
|
|
31
32
|
"ci/verify-publish-metadata.js",
|
|
32
33
|
"esbuild.d.ts",
|
|
33
34
|
"esbuild.js",
|
|
@@ -286,7 +287,13 @@ assert.equal(typeof schema.properties.endpoint, "object");
|
|
|
286
287
|
}
|
|
287
288
|
|
|
288
289
|
const explainCompat = JSON.parse(exec(npm, ["exec", "--", "jso-protector", "--explain-compat", "self-defending", "--json"], { cwd: projectDir }));
|
|
289
|
-
if (
|
|
290
|
+
if (
|
|
291
|
+
explainCompat.option !== "selfDefending" ||
|
|
292
|
+
explainCompat.status !== "mapped" ||
|
|
293
|
+
explainCompat.confidence !== "direct" ||
|
|
294
|
+
!Array.isArray(explainCompat.target) ||
|
|
295
|
+
!explainCompat.target.includes("SelfDefending")
|
|
296
|
+
) {
|
|
290
297
|
throw new Error(`Compatibility explanation output is wrong: ${JSON.stringify(explainCompat)}`);
|
|
291
298
|
}
|
|
292
299
|
|
package/ci/woodpecker.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Woodpecker CI template for jso-protector.
|
|
2
2
|
#
|
|
3
3
|
# Drop this at .woodpecker.yml in your repo. Add JSO_API_KEY and
|
|
4
|
-
# JSO_API_PASSWORD as Woodpecker secrets (Settings �?Secrets, scoped to the
|
|
4
|
+
# JSO_API_PASSWORD as Woodpecker secrets (Settings �?Secrets, scoped to the
|
|
5
5
|
# repo or organization).
|
|
6
6
|
#
|
|
7
7
|
# Every protection run is tagged with $CI_COMMIT_SHA via --label, and the
|
|
@@ -42,12 +42,13 @@ steps:
|
|
|
42
42
|
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
43
43
|
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
44
44
|
# store ci-key.priv.pem in a CI file secret. See WireFormat.aspx#watermark.
|
|
45
|
-
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
46
|
-
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
47
|
-
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
48
|
-
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
45
|
+
# npx jso-protector --config jso.config.json --competitor-gap-report --json # competitor migration gap report
|
|
46
|
+
# npx jso-protector --source-map-evidence dist-protected/jso-manifest.json --source-map-evidence-output reports/source-map-evidence.json --json # source-map absence evidence
|
|
47
|
+
# npx jso-protector --script-inventory-audit reports/payment-script-inventory.json --runtime-inventory-snapshot reports/runtime-inventory.json --script-inventory-audit-output reports/payment-script-inventory-audit.json --json # payment-page script drift gate
|
|
48
|
+
# npx jso-protector --payment-page-headers-from-har reports/checkout.har --payment-page-headers-baseline reports/payment-page-headers.baseline.json --payment-page-headers-output reports/payment-page-headers.json --payment-page-url-pattern "checkout|payment|wallet" --json # payment-page security-header evidence
|
|
49
49
|
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
50
50
|
# --estimate # pre-flight quota gate
|
|
51
51
|
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
52
52
|
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
53
|
+
# --local # protect on the runner, no source upload (Windows agents only)
|
|
53
54
|
- npm run smoke --if-present
|
package/examples/README.md
CHANGED
|
@@ -34,12 +34,16 @@ These examples show the common release patterns:
|
|
|
34
34
|
`matchesBaseline` uses `match`, `mismatch`, or `missing` so reviewers can
|
|
35
35
|
see whether a checkout page or frame changed from the approved baseline.
|
|
36
36
|
|
|
37
|
-
Install
|
|
37
|
+
Install the published package before running examples:
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
npm install --save-dev
|
|
40
|
+
npm install --save-dev jso-protector@0.4.0
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
Repository contributors can instead use the existing `file:../..` development
|
|
44
|
+
dependency in the self-contained example projects. Customer projects should use
|
|
45
|
+
the pinned registry version above.
|
|
46
|
+
|
|
43
47
|
All examples expect API credentials in environment variables:
|
|
44
48
|
|
|
45
49
|
```bash
|
package/examples/curl/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# curl / bash reference implementation
|
|
2
2
|
|
|
3
|
-
The smallest possible compliant client of the [JSO HTTP API](https://
|
|
3
|
+
The smallest possible compliant client of the [JSO HTTP API](https://javascriptobfuscator.com/Docs/WireFormat.aspx). Use this when:
|
|
4
4
|
|
|
5
5
|
- You need to add JSO protection to a build pipeline written in a language we don't ship a client for.
|
|
6
6
|
- You want a copy-paste reference for what the wire format actually looks like on the network.
|
|
@@ -42,7 +42,7 @@ This is a 100-line shell script. It deliberately doesn't implement:
|
|
|
42
42
|
- The bundler-plugin integration surface (`vite`, `webpack`, `rollup`, ...).
|
|
43
43
|
- Retry logic, exponential backoff, or rate-limit handling.
|
|
44
44
|
|
|
45
|
-
For a production CI integration, use one of the [shipped language clients](https://
|
|
45
|
+
For a production CI integration, use one of the [shipped language clients](https://javascriptobfuscator.com/Docs/Clients.aspx) instead. The shell script is a reference, not a target.
|
|
46
46
|
|
|
47
47
|
## Verify the response shape
|
|
48
48
|
|
package/examples/helm/README.md
CHANGED
|
@@ -58,7 +58,7 @@ Concurrency policy is `Forbid` — if last night's run is still going, tonight's
|
|
|
58
58
|
This chart deliberately does NOT include:
|
|
59
59
|
|
|
60
60
|
- **Artifact upload to S3 / GCS / Azure Blob.** Add a second container after the protect step, or pipe the report up via your existing CI artifact step. The chart focuses on running the protection cleanly — what you do with the output is a per-team decision.
|
|
61
|
-
- **Service / Ingress / Deployment.** JSO isn't a long-running service; it's a build step. If you find yourself wanting a Deployment here, you probably want the [hosted JSO API](https://
|
|
61
|
+
- **Service / Ingress / Deployment.** JSO isn't a long-running service; it's a build step. If you find yourself wanting a Deployment here, you probably want the [hosted JSO API](https://javascriptobfuscator.com/) directly instead.
|
|
62
62
|
|
|
63
63
|
## Uninstall
|
|
64
64
|
|
|
@@ -41,5 +41,5 @@ The CI templates in `node_modules/jso-protector/ci/` all run `--release-check` B
|
|
|
41
41
|
|
|
42
42
|
## See also
|
|
43
43
|
|
|
44
|
-
- [npm CLI workflow](https://
|
|
45
|
-
- [Build integrations hub](https://
|
|
44
|
+
- [npm CLI workflow](https://javascriptobfuscator.com/Docs/NpmCli.aspx)
|
|
45
|
+
- [Build integrations hub](https://javascriptobfuscator.com/build-integrations.aspx)
|
|
@@ -23,7 +23,7 @@ what's current as of June 2026.
|
|
|
23
23
|
|
|
24
24
|
```
|
|
25
25
|
src/*.{js,ts,jsx,tsx}
|
|
26
|
-
| Metro + jso-protector/metro
|
|
26
|
+
| Metro + jso-protector/metro serializer
|
|
27
27
|
v
|
|
28
28
|
.build/bundle.js <-- obfuscated, watermarked,
|
|
29
29
|
| release-signed
|
|
@@ -37,7 +37,7 @@ container -> device attestation.
|
|
|
37
37
|
|
|
38
38
|
## Step 1 - JSO via the Metro serializer
|
|
39
39
|
|
|
40
|
-
`jso-protector/metro
|
|
40
|
+
`jso-protector/metro` plugs into Metro's `serializer.customSerializer`.
|
|
41
41
|
The serializer intercepts the bundle on its way to Hermes, sends it to
|
|
42
42
|
the JSO HTTP API, and replaces the bundle's `code` with the protected
|
|
43
43
|
output before Hermes byte-codes it.
|
|
@@ -67,7 +67,7 @@ module.exports = mergeConfig(defaultConfig, {
|
|
|
67
67
|
});
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
Validate locally with `npx jso ai compat-scan` BEFORE shipping. The
|
|
70
|
+
Validate locally with `npx jso-protector ai compat-scan` BEFORE shipping. The
|
|
71
71
|
compat scanner flags obfuscation pitfalls (eval, Function constructor,
|
|
72
72
|
hot-loaded modules) the bundle is using.
|
|
73
73
|
|
package/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface ProtectionOptions {
|
|
|
11
11
|
controlFlowFlattening?: boolean;
|
|
12
12
|
debugProtection?: boolean;
|
|
13
13
|
debugProtectionInterval?: number;
|
|
14
|
+
debugProtectionIntervalMilliseconds?: number;
|
|
14
15
|
deadCodeInjection?: boolean;
|
|
15
16
|
deadCodeInjectionThreshold?: number;
|
|
16
17
|
disableConsoleOutput?: boolean;
|
|
@@ -33,6 +34,16 @@ export interface ProtectionOptions {
|
|
|
33
34
|
reservedStrings?: string[];
|
|
34
35
|
seed?: string | number;
|
|
35
36
|
selfDefending?: boolean;
|
|
37
|
+
selfDefendingIntervalSeconds?: number;
|
|
38
|
+
selfHealing?: boolean;
|
|
39
|
+
selfHealingMaxAttempts?: number;
|
|
40
|
+
antiMonkeyPatching?: boolean;
|
|
41
|
+
antiMonkeyPatchingCleanRealm?: boolean;
|
|
42
|
+
antiMonkeyPatchingIncludeGlobals?: string;
|
|
43
|
+
antiMonkeyPatchingExcludeGlobals?: string;
|
|
44
|
+
runtimeDefenseAction?: "throw" | "blank" | "redirect" | "reload" | "callback" | "degrade";
|
|
45
|
+
runtimeDefenseCallback?: string;
|
|
46
|
+
runtimeDefenseRedirectUrl?: string;
|
|
36
47
|
simplify?: boolean;
|
|
37
48
|
sourceMap?: boolean;
|
|
38
49
|
sourceMapBaseUrl?: string;
|
|
@@ -47,14 +58,24 @@ export interface ProtectionOptions {
|
|
|
47
58
|
stringArrayCallsTransformThreshold?: number;
|
|
48
59
|
stringArrayEncoding?: string | string[];
|
|
49
60
|
stringArrayIndexShift?: boolean;
|
|
61
|
+
stringArrayShuffle?: boolean;
|
|
62
|
+
stringArrayRotate?: boolean;
|
|
63
|
+
stringArrayIndexesType?: "hexadecimal-number" | "hexadecimal-numeric-string" | Array<"hexadecimal-number" | "hexadecimal-numeric-string">;
|
|
64
|
+
stringArrayCallsTransform?: boolean;
|
|
65
|
+
stringArrayCallsTransformThreshold?: number;
|
|
50
66
|
stringArrayIndexesType?: string | string[];
|
|
51
67
|
stringArrayRotate?: boolean;
|
|
68
|
+
stringArrayIndexesType?: "hexadecimal-number" | "hexadecimal-numeric-string" | Array<"hexadecimal-number" | "hexadecimal-numeric-string">;
|
|
69
|
+
stringArrayCallsTransform?: boolean;
|
|
70
|
+
stringArrayCallsTransformThreshold?: number;
|
|
52
71
|
stringArrayShuffle?: boolean;
|
|
72
|
+
stringArrayRotate?: boolean;
|
|
53
73
|
stringArrayThreshold?: number;
|
|
54
74
|
stringArrayWrappersChainedCalls?: boolean;
|
|
55
75
|
stringArrayWrappersCount?: number;
|
|
56
76
|
stringArrayWrappersParametersMaxCount?: number;
|
|
57
|
-
stringArrayWrappersType?:
|
|
77
|
+
stringArrayWrappersType?: "variable" | "function";
|
|
78
|
+
transformObjectKeys?: boolean;
|
|
58
79
|
target?: string;
|
|
59
80
|
transformObjectKeys?: boolean;
|
|
60
81
|
unicodeEscapeSequence?: boolean;
|
|
@@ -142,6 +163,7 @@ export interface JsConfuserCompatibilityOptions {
|
|
|
142
163
|
stringCompression?: boolean | number;
|
|
143
164
|
stringConcealing?: boolean | number;
|
|
144
165
|
stringEncoding?: boolean | number | ((value: string) => boolean);
|
|
166
|
+
stringSplitting?: boolean | number | ((value: string) => boolean);
|
|
145
167
|
target?: "browser" | "node" | string;
|
|
146
168
|
variableMasking?: boolean | number;
|
|
147
169
|
}
|
|
@@ -180,6 +202,7 @@ export interface JavascriptObfuscatorCompatibilityOptions {
|
|
|
180
202
|
stringArrayCallsTransformThreshold?: number;
|
|
181
203
|
stringArrayEncoding?: string | string[];
|
|
182
204
|
stringArrayIndexShift?: boolean;
|
|
205
|
+
stringArrayShuffle?: boolean;
|
|
183
206
|
stringArrayIndexesType?: string | string[];
|
|
184
207
|
stringArrayRotate?: boolean;
|
|
185
208
|
stringArrayShuffle?: boolean;
|
|
@@ -187,7 +210,8 @@ export interface JavascriptObfuscatorCompatibilityOptions {
|
|
|
187
210
|
stringArrayWrappersChainedCalls?: boolean;
|
|
188
211
|
stringArrayWrappersCount?: number;
|
|
189
212
|
stringArrayWrappersParametersMaxCount?: number;
|
|
190
|
-
stringArrayWrappersType?:
|
|
213
|
+
stringArrayWrappersType?: "variable" | "function";
|
|
214
|
+
transformObjectKeys?: boolean;
|
|
191
215
|
target?: string;
|
|
192
216
|
transformObjectKeys?: boolean;
|
|
193
217
|
unicodeEscapeSequence?: boolean;
|