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.
- package/CHANGELOG.md +960 -0
- package/LICENSE +90 -0
- package/MIGRATION.md +207 -0
- package/README.md +1477 -0
- package/RELEASE.md +82 -0
- package/SECURITY.md +71 -0
- package/ai-cli.js +392 -0
- package/ai.js +176 -0
- package/bin/jso-protector.js +12066 -0
- package/browserify.d.ts +10 -0
- package/browserify.js +88 -0
- package/bun.d.ts +10 -0
- package/bun.js +41 -0
- package/ci/Jenkinsfile +82 -0
- package/ci/argo-workflows.yaml +121 -0
- package/ci/azure-pipelines.yml +56 -0
- package/ci/bitbucket-pipelines.yml +43 -0
- package/ci/buildkite.yml +50 -0
- package/ci/circleci.yml +60 -0
- package/ci/drone.yml +67 -0
- package/ci/github-actions.yml +51 -0
- package/ci/gitlab-ci.yml +39 -0
- package/ci/gocd.yaml +79 -0
- package/ci/teamcity.kts +79 -0
- package/ci/tekton.yaml +106 -0
- package/ci/verify-package.js +748 -0
- package/ci/verify-publish-metadata.js +147 -0
- package/ci/verify-templates.js +195 -0
- package/ci/woodpecker.yml +53 -0
- package/compliance/cli.js +204 -0
- package/compliance/evidence-forwarder.js +209 -0
- package/compliance/pci-dss-v4/controls.json +75 -0
- package/compliance/pci-dss-v4/index.js +2613 -0
- package/config/named-sets.js +185 -0
- package/esbuild.d.ts +16 -0
- package/esbuild.js +190 -0
- package/examples/README.md +78 -0
- package/examples/browserify/build.js +20 -0
- package/examples/bun/package.json +13 -0
- package/examples/bun/scripts/protect-release.js +28 -0
- package/examples/cli-basic/jso.config.cjs +23 -0
- package/examples/cli-basic/jso.config.json +15 -0
- package/examples/cli-basic/package.json +14 -0
- package/examples/cli-basic/scripts/build.js +10 -0
- package/examples/curl/README.md +55 -0
- package/examples/curl/protect.sh +106 -0
- package/examples/esbuild/build.js +19 -0
- package/examples/grunt/Gruntfile.js +29 -0
- package/examples/gulp/gulpfile.js +19 -0
- package/examples/helm/Chart.yaml +27 -0
- package/examples/helm/README.md +69 -0
- package/examples/helm/templates/_helpers.tpl +23 -0
- package/examples/helm/templates/_podtemplate.tpl +64 -0
- package/examples/helm/templates/job.yaml +39 -0
- package/examples/helm/templates/secret.yaml +17 -0
- package/examples/helm/values.yaml +54 -0
- package/examples/kubernetes/job.yaml +123 -0
- package/examples/metro.config.js +11 -0
- package/examples/nextjs/next.config.js +11 -0
- package/examples/node-api/protect-release.js +28 -0
- package/examples/node-api/release-summary.js +59 -0
- package/examples/parcel/package.json +13 -0
- package/examples/parcel/scripts/protect-release.js +28 -0
- package/examples/payment-page-script-inventory.json +62 -0
- package/examples/payment-page-security-headers.json +46 -0
- package/examples/pre-commit/.pre-commit-config.yaml +33 -0
- package/examples/pre-commit/README.md +45 -0
- package/examples/react-native/README.md +208 -0
- package/examples/react-native/metro.config.js +11 -0
- package/examples/rollup/rollup.config.js +20 -0
- package/examples/rspack/rspack.config.js +28 -0
- package/examples/turbopack/package.json +13 -0
- package/examples/turbopack/scripts/protect-release.js +28 -0
- package/examples/vite/vite.config.js +18 -0
- package/examples/webpack/webpack.config.js +21 -0
- package/examples/webpack-loader/webpack.config.js +22 -0
- package/governance/index.d.ts +18 -0
- package/governance/index.js +309 -0
- package/grunt.d.ts +4 -0
- package/grunt.js +111 -0
- package/gulp.d.ts +10 -0
- package/gulp.js +106 -0
- package/index.d.ts +879 -0
- package/index.js +607 -0
- package/jso.config.example.json +29 -0
- package/jso.config.schema.json +548 -0
- package/metro.d.ts +43 -0
- package/metro.js +117 -0
- package/next.d.ts +24 -0
- package/next.js +64 -0
- package/package.json +241 -0
- package/parcel.d.ts +10 -0
- package/parcel.js +40 -0
- package/react-native.d.ts +2 -0
- package/react-native.js +3 -0
- package/release-signer.js +245 -0
- package/rollup.d.ts +13 -0
- package/rollup.js +71 -0
- package/rspack-loader.d.ts +13 -0
- package/rspack-loader.js +11 -0
- package/rspack.d.ts +11 -0
- package/rspack.js +9 -0
- package/runtime/ai-script-governance.js +379 -0
- package/runtime/countermeasures.js +0 -0
- package/runtime/data-exfiltration-guard.d.ts +7 -0
- package/runtime/data-exfiltration-guard.js +161 -0
- package/runtime/environment-integrity.js +389 -0
- package/runtime/managed-integrity.d.ts +4 -0
- package/runtime/managed-integrity.js +108 -0
- package/runtime/third-party-inventory.js +437 -0
- package/turbopack.d.ts +10 -0
- package/turbopack.js +41 -0
- package/vite.d.ts +16 -0
- package/vite.js +78 -0
- package/watermark.js +126 -0
- package/webpack-loader.d.ts +15 -0
- package/webpack-loader.js +97 -0
- package/webpack.d.ts +13 -0
- package/webpack.js +143 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: protected-release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
release:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@v4
|
|
11
|
+
- uses: actions/setup-node@v4
|
|
12
|
+
with:
|
|
13
|
+
node-version: 22
|
|
14
|
+
cache: npm
|
|
15
|
+
- run: npm ci
|
|
16
|
+
- run: npm run build
|
|
17
|
+
- run: npm run verify:package --if-present
|
|
18
|
+
- run: npm run verify:publish-metadata --if-present
|
|
19
|
+
- name: Release preflight
|
|
20
|
+
run: npx jso-protector --config jso.config.json --release-check --json
|
|
21
|
+
env:
|
|
22
|
+
JSO_API_KEY: ${{ secrets.JSO_API_KEY }}
|
|
23
|
+
JSO_API_PASSWORD: ${{ secrets.JSO_API_PASSWORD }}
|
|
24
|
+
- name: Protect JavaScript
|
|
25
|
+
run: |
|
|
26
|
+
npx jso-protector \
|
|
27
|
+
--config jso.config.json \
|
|
28
|
+
--label "${{ github.sha }}" \
|
|
29
|
+
--manifest dist-protected/jso-manifest.json \
|
|
30
|
+
--report dist-protected/jso-report.json
|
|
31
|
+
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
32
|
+
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
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
|
|
38
|
+
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
39
|
+
# --estimate # pre-flight quota gate
|
|
40
|
+
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
41
|
+
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
42
|
+
env:
|
|
43
|
+
JSO_API_KEY: ${{ secrets.JSO_API_KEY }}
|
|
44
|
+
JSO_API_PASSWORD: ${{ secrets.JSO_API_PASSWORD }}
|
|
45
|
+
- run: npm run smoke
|
|
46
|
+
- uses: actions/upload-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: protected-dist
|
|
49
|
+
path: |
|
|
50
|
+
dist-protected/
|
|
51
|
+
dist-protected/jso-manifest.json
|
package/ci/gitlab-ci.yml
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- build
|
|
3
|
+
- protect
|
|
4
|
+
|
|
5
|
+
protected-release:
|
|
6
|
+
image: node:22
|
|
7
|
+
stage: protect
|
|
8
|
+
script:
|
|
9
|
+
- npm ci
|
|
10
|
+
- npm run build
|
|
11
|
+
- npm run verify:package --if-present
|
|
12
|
+
- npm run verify:publish-metadata --if-present
|
|
13
|
+
- npx jso-protector --config jso.config.json --release-check --json
|
|
14
|
+
- >
|
|
15
|
+
npx jso-protector
|
|
16
|
+
--config jso.config.json
|
|
17
|
+
--label "$CI_COMMIT_SHA"
|
|
18
|
+
--manifest dist-protected/jso-manifest.json
|
|
19
|
+
--report dist-protected/jso-report.json
|
|
20
|
+
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
21
|
+
# Configure JSO_WATERMARK_KEY as a masked variable; check in ci-key.pub.pem,
|
|
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
|
|
27
|
+
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
28
|
+
# --estimate # pre-flight quota gate
|
|
29
|
+
# --watermark "$CI_COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
30
|
+
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
31
|
+
- npm run smoke
|
|
32
|
+
artifacts:
|
|
33
|
+
paths:
|
|
34
|
+
- dist-protected/
|
|
35
|
+
- dist-protected/jso-manifest.json
|
|
36
|
+
rules:
|
|
37
|
+
- if: $CI_COMMIT_TAG
|
|
38
|
+
|
|
39
|
+
# Configure JSO_API_KEY and JSO_API_PASSWORD as masked protected CI/CD variables.
|
package/ci/gocd.yaml
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# GoCD pipeline template for jso-protector.
|
|
2
|
+
#
|
|
3
|
+
# Drop this at .gocd.yaml in your repo and enable GoCD's YAML config plugin.
|
|
4
|
+
# Configure JSO_API_KEY and JSO_API_PASSWORD as secure environment variables
|
|
5
|
+
# at the pipeline level (or in a secrets management config repo).
|
|
6
|
+
#
|
|
7
|
+
# Every protection run is tagged with $GO_REVISION via --label and the API
|
|
8
|
+
# report is published as a pipeline artifact for later symbolication.
|
|
9
|
+
|
|
10
|
+
format_version: 10
|
|
11
|
+
|
|
12
|
+
pipelines:
|
|
13
|
+
protected-release:
|
|
14
|
+
group: release
|
|
15
|
+
materials:
|
|
16
|
+
git:
|
|
17
|
+
type: git
|
|
18
|
+
url: https://github.com/your-org/your-repo
|
|
19
|
+
environment_variables:
|
|
20
|
+
NODE_VERSION: "22"
|
|
21
|
+
secure_variables:
|
|
22
|
+
JSO_API_KEY: "" # Set in pipeline config / secrets plugin.
|
|
23
|
+
JSO_API_PASSWORD: ""
|
|
24
|
+
stages:
|
|
25
|
+
- build:
|
|
26
|
+
jobs:
|
|
27
|
+
build:
|
|
28
|
+
tasks:
|
|
29
|
+
- exec:
|
|
30
|
+
command: npm
|
|
31
|
+
arguments: [ "ci" ]
|
|
32
|
+
- exec:
|
|
33
|
+
command: npm
|
|
34
|
+
arguments: [ "run", "build" ]
|
|
35
|
+
- protect:
|
|
36
|
+
jobs:
|
|
37
|
+
protect:
|
|
38
|
+
artifacts:
|
|
39
|
+
- build:
|
|
40
|
+
source: dist-protected/*
|
|
41
|
+
destination: protected
|
|
42
|
+
- build:
|
|
43
|
+
source: dist-protected/jso-report.json
|
|
44
|
+
destination: protected
|
|
45
|
+
tasks:
|
|
46
|
+
- exec:
|
|
47
|
+
command: npx
|
|
48
|
+
arguments:
|
|
49
|
+
- jso-protector
|
|
50
|
+
- "--config"
|
|
51
|
+
- jso.config.json
|
|
52
|
+
- "--release-check"
|
|
53
|
+
- "--json"
|
|
54
|
+
- exec:
|
|
55
|
+
command: npx
|
|
56
|
+
arguments:
|
|
57
|
+
- jso-protector
|
|
58
|
+
- "--config"
|
|
59
|
+
- jso.config.json
|
|
60
|
+
- "--label"
|
|
61
|
+
- "$GO_REVISION"
|
|
62
|
+
- "--manifest"
|
|
63
|
+
- dist-protected/jso-manifest.json
|
|
64
|
+
- "--report"
|
|
65
|
+
- dist-protected/jso-report.json
|
|
66
|
+
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
67
|
+
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
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
|
|
73
|
+
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
74
|
+
# --estimate # pre-flight quota gate
|
|
75
|
+
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
76
|
+
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
77
|
+
- exec:
|
|
78
|
+
command: npm
|
|
79
|
+
arguments: [ "run", "smoke", "--if-present" ]
|
package/ci/teamcity.kts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// TeamCity Kotlin DSL template for jso-protector.
|
|
2
|
+
//
|
|
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
|
|
5
|
+
// and JSO_API_PASSWORD as project-level parameters with the password type
|
|
6
|
+
// so they're masked in logs.
|
|
7
|
+
//
|
|
8
|
+
// Every protection run is tagged with %build.vcs.number% via --label and
|
|
9
|
+
// the API report is published as a build artifact for later symbolication.
|
|
10
|
+
|
|
11
|
+
import jetbrains.buildServer.configs.kotlin.*
|
|
12
|
+
import jetbrains.buildServer.configs.kotlin.buildSteps.script
|
|
13
|
+
|
|
14
|
+
version = "2024.03"
|
|
15
|
+
|
|
16
|
+
project {
|
|
17
|
+
buildType(ProtectedRelease)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
object ProtectedRelease : BuildType({
|
|
21
|
+
name = "Protected release"
|
|
22
|
+
description = "Protect built JavaScript with JavaScript Obfuscator and archive the API report for later symbolication."
|
|
23
|
+
|
|
24
|
+
vcs {
|
|
25
|
+
// Wire your VCS root here.
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
artifactRules = """
|
|
29
|
+
dist-protected/** => dist-protected
|
|
30
|
+
dist-protected/jso-report.json => jso-report.json
|
|
31
|
+
""".trimIndent()
|
|
32
|
+
|
|
33
|
+
params {
|
|
34
|
+
// Override these as Project-level password parameters in the TeamCity UI.
|
|
35
|
+
password("env.JSO_API_KEY", "")
|
|
36
|
+
password("env.JSO_API_PASSWORD", "")
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
steps {
|
|
40
|
+
script {
|
|
41
|
+
name = "Install"
|
|
42
|
+
scriptContent = "npm ci"
|
|
43
|
+
}
|
|
44
|
+
script {
|
|
45
|
+
name = "Build"
|
|
46
|
+
scriptContent = "npm run build"
|
|
47
|
+
}
|
|
48
|
+
script {
|
|
49
|
+
name = "Release preflight"
|
|
50
|
+
scriptContent = "npx jso-protector --config jso.config.json --release-check --json"
|
|
51
|
+
}
|
|
52
|
+
script {
|
|
53
|
+
name = "Protect JavaScript"
|
|
54
|
+
// %build.vcs.number% expands to the current commit SHA.
|
|
55
|
+
scriptContent = """
|
|
56
|
+
npx jso-protector \
|
|
57
|
+
--config jso.config.json \
|
|
58
|
+
--label "%build.vcs.number%" \
|
|
59
|
+
--manifest dist-protected/jso-manifest.json \
|
|
60
|
+
--report dist-protected/jso-report.json
|
|
61
|
+
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
62
|
+
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
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
|
|
68
|
+
# --ai-precheck --ai-precheck-fail-on error // AI compat scan gate
|
|
69
|
+
# --estimate // pre-flight quota gate
|
|
70
|
+
# --watermark "$COMMIT_SHA" // HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
71
|
+
# --sign-release ci-key.priv.pem // Ed25519 attestation -> .manifest.json.sig
|
|
72
|
+
""".trimIndent()
|
|
73
|
+
}
|
|
74
|
+
script {
|
|
75
|
+
name = "Smoke"
|
|
76
|
+
scriptContent = "npm run smoke --if-present"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
})
|
package/ci/tekton.yaml
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Tekton Pipelines template for jso-protector.
|
|
2
|
+
#
|
|
3
|
+
# Drop this at .tekton/jso-protect.yaml in your repo and `kubectl apply -f`
|
|
4
|
+
# it (or wire it into your Tekton Triggers EventListener). Add the JSO
|
|
5
|
+
# credentials as a Kubernetes Secret named jso-credentials with keys
|
|
6
|
+
# JSO_API_KEY and JSO_API_PASSWORD.
|
|
7
|
+
#
|
|
8
|
+
# Every protection run is tagged with $(params.commit-sha) via --label, and
|
|
9
|
+
# the API report is written into the workspace for later symbolication.
|
|
10
|
+
|
|
11
|
+
apiVersion: tekton.dev/v1
|
|
12
|
+
kind: Task
|
|
13
|
+
metadata:
|
|
14
|
+
name: jso-protect
|
|
15
|
+
labels:
|
|
16
|
+
app.kubernetes.io/version: "0.1.0"
|
|
17
|
+
spec:
|
|
18
|
+
description: >-
|
|
19
|
+
Run jso-protector against the built JavaScript in the workspace and
|
|
20
|
+
archive the API report alongside the protected dist.
|
|
21
|
+
params:
|
|
22
|
+
- name: commit-sha
|
|
23
|
+
type: string
|
|
24
|
+
description: Tag every protection run with this SHA via --label.
|
|
25
|
+
- name: config-path
|
|
26
|
+
type: string
|
|
27
|
+
default: jso.config.json
|
|
28
|
+
- name: input-dir
|
|
29
|
+
type: string
|
|
30
|
+
default: dist
|
|
31
|
+
- name: output-dir
|
|
32
|
+
type: string
|
|
33
|
+
default: dist-protected
|
|
34
|
+
workspaces:
|
|
35
|
+
- name: source
|
|
36
|
+
description: Source workspace containing the build output and config.
|
|
37
|
+
steps:
|
|
38
|
+
- name: install
|
|
39
|
+
image: node:22
|
|
40
|
+
workingDir: $(workspaces.source.path)
|
|
41
|
+
script: |
|
|
42
|
+
set -euo pipefail
|
|
43
|
+
npm ci
|
|
44
|
+
|
|
45
|
+
- name: build
|
|
46
|
+
image: node:22
|
|
47
|
+
workingDir: $(workspaces.source.path)
|
|
48
|
+
script: |
|
|
49
|
+
set -euo pipefail
|
|
50
|
+
npm run build
|
|
51
|
+
|
|
52
|
+
- name: protect
|
|
53
|
+
image: node:22
|
|
54
|
+
workingDir: $(workspaces.source.path)
|
|
55
|
+
env:
|
|
56
|
+
- name: JSO_API_KEY
|
|
57
|
+
valueFrom:
|
|
58
|
+
secretKeyRef:
|
|
59
|
+
name: jso-credentials
|
|
60
|
+
key: JSO_API_KEY
|
|
61
|
+
- name: JSO_API_PASSWORD
|
|
62
|
+
valueFrom:
|
|
63
|
+
secretKeyRef:
|
|
64
|
+
name: jso-credentials
|
|
65
|
+
key: JSO_API_PASSWORD
|
|
66
|
+
script: |
|
|
67
|
+
set -euo pipefail
|
|
68
|
+
npx jso-protector --config $(params.config-path) --release-check --json
|
|
69
|
+
npx jso-protector \
|
|
70
|
+
--config $(params.config-path) \
|
|
71
|
+
--label "$(params.commit-sha)" \
|
|
72
|
+
--manifest $(params.output-dir)/jso-manifest.json \
|
|
73
|
+
--report $(params.output-dir)/jso-report.json
|
|
74
|
+
# Optional: migration and supply-chain checks. Copy into a preflight/protect step as needed.
|
|
75
|
+
# Configure JSO_WATERMARK_KEY as a masked secret; check in ci-key.pub.pem,
|
|
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
|
|
81
|
+
# --ai-precheck --ai-precheck-fail-on error # AI compat scan gate
|
|
82
|
+
# --estimate # pre-flight quota gate
|
|
83
|
+
# --watermark "$COMMIT_SHA" # HMAC marker (needs JSO_WATERMARK_KEY env)
|
|
84
|
+
# --sign-release ci-key.priv.pem # Ed25519 attestation -> .manifest.json.sig
|
|
85
|
+
npm run smoke --if-present
|
|
86
|
+
---
|
|
87
|
+
apiVersion: tekton.dev/v1
|
|
88
|
+
kind: Pipeline
|
|
89
|
+
metadata:
|
|
90
|
+
name: jso-protected-release
|
|
91
|
+
spec:
|
|
92
|
+
params:
|
|
93
|
+
- name: commit-sha
|
|
94
|
+
type: string
|
|
95
|
+
workspaces:
|
|
96
|
+
- name: source
|
|
97
|
+
tasks:
|
|
98
|
+
- name: protect
|
|
99
|
+
taskRef:
|
|
100
|
+
name: jso-protect
|
|
101
|
+
params:
|
|
102
|
+
- name: commit-sha
|
|
103
|
+
value: $(params.commit-sha)
|
|
104
|
+
workspaces:
|
|
105
|
+
- name: source
|
|
106
|
+
workspace: source
|