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
package/metro.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { assertSizeBudgets, buildItemsManifest, buildProtectionItemsFromInputItems, composeProtectionItemOutput, createProtectionConfig, isExcluded, protectItems, writeManifest } = require("./index.js");
|
|
4
|
+
|
|
5
|
+
function createMetroSerializer(options = {}) {
|
|
6
|
+
const baseSerializer = typeof options.serializer === "function"
|
|
7
|
+
? options.serializer
|
|
8
|
+
: defaultSerializer;
|
|
9
|
+
|
|
10
|
+
return async function jsoProtectorMetroSerializer(entryPoint, preModules, graph, serializerOptions) {
|
|
11
|
+
const result = await Promise.resolve(baseSerializer(entryPoint, preModules, graph, serializerOptions));
|
|
12
|
+
const bundle = normalizeSerializerResult(result);
|
|
13
|
+
if (!bundle || typeof bundle.code !== "string") {
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const fileName = resolveBundleFileName(entryPoint, serializerOptions, options);
|
|
18
|
+
const config = createProtectionConfig({
|
|
19
|
+
input: serializerOptions && serializerOptions.projectRoot ? serializerOptions.projectRoot : process.cwd(),
|
|
20
|
+
output: serializerOptions && serializerOptions.projectRoot ? serializerOptions.projectRoot : process.cwd(),
|
|
21
|
+
...options
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
if (!shouldProtectBundle(fileName, config, options)) {
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const inputItems = [{
|
|
29
|
+
FileName: fileName,
|
|
30
|
+
FileCode: bundle.code,
|
|
31
|
+
SourcePath: entryPoint || fileName,
|
|
32
|
+
OutputPath: fileName
|
|
33
|
+
}];
|
|
34
|
+
const protection = buildProtectionItemsFromInputItems(config, inputItems);
|
|
35
|
+
const apiResult = await (options.protectItems || protectItems)(config, protection.items);
|
|
36
|
+
const manifest = buildItemsManifest(config, inputItems, apiResult, () => fileName, protection.transforms);
|
|
37
|
+
assertSizeBudgets(manifest, config);
|
|
38
|
+
|
|
39
|
+
const protectedCode = composeProtectionItemOutput(fileName, apiResult, protection.transforms, config);
|
|
40
|
+
if (config.manifest) {
|
|
41
|
+
writeManifest(config.manifest, manifest);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return serializeLike(result, bundle, protectedCode, options);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function withJsoProtectorMetro(baseConfig = {}, options = {}) {
|
|
49
|
+
const config = baseConfig || {};
|
|
50
|
+
const serializer = config.serializer || {};
|
|
51
|
+
return {
|
|
52
|
+
...config,
|
|
53
|
+
serializer: {
|
|
54
|
+
...serializer,
|
|
55
|
+
customSerializer: createMetroSerializer({
|
|
56
|
+
...options,
|
|
57
|
+
serializer: options.serializer || serializer.customSerializer
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function defaultSerializer() {
|
|
64
|
+
throw new Error("Metro customSerializer is required. Pass the existing serializer with options.serializer or use withJsoProtectorMetro(baseConfig, options).");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function normalizeSerializerResult(result) {
|
|
68
|
+
if (!result) return null;
|
|
69
|
+
if (typeof result === "string" || Buffer.isBuffer(result)) {
|
|
70
|
+
return { code: Buffer.isBuffer(result) ? result.toString("utf8") : result, kind: "string" };
|
|
71
|
+
}
|
|
72
|
+
if (typeof result === "object" && (typeof result.code === "string" || Buffer.isBuffer(result.code))) {
|
|
73
|
+
return { code: Buffer.isBuffer(result.code) ? result.code.toString("utf8") : result.code, kind: "object" };
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function serializeLike(original, normalized, code, options) {
|
|
79
|
+
const removeSourceMaps = options.removeSourceMaps !== false;
|
|
80
|
+
if (normalized.kind === "string") {
|
|
81
|
+
return code;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const next = {
|
|
85
|
+
...original,
|
|
86
|
+
code
|
|
87
|
+
};
|
|
88
|
+
if (removeSourceMaps) {
|
|
89
|
+
delete next.map;
|
|
90
|
+
}
|
|
91
|
+
return next;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function resolveBundleFileName(entryPoint, serializerOptions = {}, options = {}) {
|
|
95
|
+
if (options.fileName) return normalizeName(options.fileName);
|
|
96
|
+
const platform = serializerOptions.platform ? `.${serializerOptions.platform}` : "";
|
|
97
|
+
const suffix = serializerOptions.dev ? ".dev" : ".release";
|
|
98
|
+
return normalizeName(`index${platform}${suffix}.bundle.js`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function shouldProtectBundle(fileName, config, options) {
|
|
102
|
+
const normalized = normalizeName(fileName);
|
|
103
|
+
const include = Array.isArray(config.include) && config.include.length ? config.include : options.include;
|
|
104
|
+
if (Array.isArray(include) && include.length && !isExcluded(normalized, include)) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return !isExcluded(normalized, config.exclude || []);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function normalizeName(name) {
|
|
111
|
+
return String(name || "").replace(/\\/g, "/");
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
module.exports = createMetroSerializer;
|
|
115
|
+
module.exports.createMetroSerializer = createMetroSerializer;
|
|
116
|
+
module.exports.withJsoProtectorMetro = withJsoProtectorMetro;
|
|
117
|
+
module.exports.default = createMetroSerializer;
|
package/next.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { JsoProtectorWebpackPluginOptions } from "./webpack";
|
|
2
|
+
|
|
3
|
+
export interface JsoProtectorNextOptions extends JsoProtectorWebpackPluginOptions {
|
|
4
|
+
applyInDevelopment?: boolean;
|
|
5
|
+
target?: "client" | "server" | "both";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface NextWebpackContextLike {
|
|
9
|
+
dev?: boolean;
|
|
10
|
+
isServer?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface NextConfigLike {
|
|
14
|
+
webpack?: (config: Record<string, unknown>, context: NextWebpackContextLike) => Record<string, unknown>;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare function withJsoProtector(
|
|
19
|
+
nextConfig?: NextConfigLike | ((...args: unknown[]) => NextConfigLike | Promise<NextConfigLike>),
|
|
20
|
+
options?: JsoProtectorNextOptions
|
|
21
|
+
): NextConfigLike | ((...args: unknown[]) => Promise<NextConfigLike>);
|
|
22
|
+
|
|
23
|
+
export { withJsoProtector };
|
|
24
|
+
export default withJsoProtector;
|
package/next.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const JsoProtectorWebpackPlugin = require("./webpack.js");
|
|
4
|
+
|
|
5
|
+
function withJsoProtector(nextConfig = {}, options = {}) {
|
|
6
|
+
if (typeof nextConfig === "function") {
|
|
7
|
+
return async (...args) => {
|
|
8
|
+
const resolved = await nextConfig(...args);
|
|
9
|
+
return applyJsoProtector(resolved, options);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return applyJsoProtector(nextConfig, options);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function applyJsoProtector(nextConfig = {}, options = {}) {
|
|
17
|
+
const baseConfig = nextConfig || {};
|
|
18
|
+
const userWebpack = baseConfig.webpack;
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
...baseConfig,
|
|
22
|
+
webpack(config, context) {
|
|
23
|
+
const nextWebpackConfig = typeof userWebpack === "function"
|
|
24
|
+
? userWebpack(config, context)
|
|
25
|
+
: config;
|
|
26
|
+
const resolvedConfig = nextWebpackConfig || config || {};
|
|
27
|
+
|
|
28
|
+
if (!shouldApplyPlugin(context, options)) {
|
|
29
|
+
return resolvedConfig;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const plugins = Array.isArray(resolvedConfig.plugins) ? resolvedConfig.plugins.slice() : [];
|
|
33
|
+
plugins.push(new JsoProtectorWebpackPlugin(options));
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
...resolvedConfig,
|
|
37
|
+
plugins
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function shouldApplyPlugin(context = {}, options = {}) {
|
|
44
|
+
if (options.applyInDevelopment === true) {
|
|
45
|
+
return matchesTarget(context, options.target);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (context.dev) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return matchesTarget(context, options.target);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function matchesTarget(context = {}, target = "client") {
|
|
56
|
+
const normalizedTarget = String(target || "client").toLowerCase();
|
|
57
|
+
if (normalizedTarget === "both") return true;
|
|
58
|
+
if (normalizedTarget === "server") return !!context.isServer;
|
|
59
|
+
return !context.isServer;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = withJsoProtector;
|
|
63
|
+
module.exports.withJsoProtector = withJsoProtector;
|
|
64
|
+
module.exports.default = withJsoProtector;
|
package/package.json
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jso-protector",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Command-line wrapper for JavaScript Obfuscator HTTP API workflows.",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"author": "JavaScript Obfuscator",
|
|
7
|
+
"homepage": "https://www.javascriptobfuscator.com/Docs/NpmCli.aspx",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"javascript-obfuscator",
|
|
10
|
+
"obfuscation",
|
|
11
|
+
"javascript",
|
|
12
|
+
"cli",
|
|
13
|
+
"ci",
|
|
14
|
+
"browserify",
|
|
15
|
+
"electron",
|
|
16
|
+
"expo",
|
|
17
|
+
"next",
|
|
18
|
+
"nextjs",
|
|
19
|
+
"react-native",
|
|
20
|
+
"vite",
|
|
21
|
+
"webpack",
|
|
22
|
+
"rspack",
|
|
23
|
+
"webpack-loader",
|
|
24
|
+
"rspack-loader",
|
|
25
|
+
"rollup",
|
|
26
|
+
"esbuild",
|
|
27
|
+
"gulp",
|
|
28
|
+
"grunt"
|
|
29
|
+
],
|
|
30
|
+
"files": [
|
|
31
|
+
"bin/",
|
|
32
|
+
"ci/",
|
|
33
|
+
"compliance/",
|
|
34
|
+
"config/",
|
|
35
|
+
"examples/",
|
|
36
|
+
"governance/",
|
|
37
|
+
"runtime/",
|
|
38
|
+
"!examples/**/dist/**",
|
|
39
|
+
"!examples/**/dist-protected/**",
|
|
40
|
+
"!examples/**/node_modules/**",
|
|
41
|
+
"bun.d.ts",
|
|
42
|
+
"bun.js",
|
|
43
|
+
"ai-cli.js",
|
|
44
|
+
"ai.js",
|
|
45
|
+
"browserify.d.ts",
|
|
46
|
+
"browserify.js",
|
|
47
|
+
"esbuild.d.ts",
|
|
48
|
+
"esbuild.js",
|
|
49
|
+
"gulp.d.ts",
|
|
50
|
+
"gulp.js",
|
|
51
|
+
"grunt.d.ts",
|
|
52
|
+
"grunt.js",
|
|
53
|
+
"index.d.ts",
|
|
54
|
+
"index.js",
|
|
55
|
+
"metro.d.ts",
|
|
56
|
+
"metro.js",
|
|
57
|
+
"next.d.ts",
|
|
58
|
+
"next.js",
|
|
59
|
+
"parcel.d.ts",
|
|
60
|
+
"parcel.js",
|
|
61
|
+
"react-native.d.ts",
|
|
62
|
+
"react-native.js",
|
|
63
|
+
"release-signer.js",
|
|
64
|
+
"rspack.d.ts",
|
|
65
|
+
"rspack.js",
|
|
66
|
+
"rspack-loader.d.ts",
|
|
67
|
+
"rspack-loader.js",
|
|
68
|
+
"rollup.d.ts",
|
|
69
|
+
"rollup.js",
|
|
70
|
+
"turbopack.d.ts",
|
|
71
|
+
"turbopack.js",
|
|
72
|
+
"vite.d.ts",
|
|
73
|
+
"vite.js",
|
|
74
|
+
"watermark.js",
|
|
75
|
+
"webpack.d.ts",
|
|
76
|
+
"webpack.js",
|
|
77
|
+
"webpack-loader.d.ts",
|
|
78
|
+
"webpack-loader.js",
|
|
79
|
+
"CHANGELOG.md",
|
|
80
|
+
"LICENSE",
|
|
81
|
+
"MIGRATION.md",
|
|
82
|
+
"README.md",
|
|
83
|
+
"RELEASE.md",
|
|
84
|
+
"SECURITY.md",
|
|
85
|
+
"jso.config.example.json",
|
|
86
|
+
"jso.config.schema.json"
|
|
87
|
+
],
|
|
88
|
+
"sideEffects": false,
|
|
89
|
+
"type": "commonjs",
|
|
90
|
+
"main": "./index.js",
|
|
91
|
+
"types": "./index.d.ts",
|
|
92
|
+
"exports": {
|
|
93
|
+
".": {
|
|
94
|
+
"types": "./index.d.ts",
|
|
95
|
+
"require": "./index.js",
|
|
96
|
+
"default": "./index.js"
|
|
97
|
+
},
|
|
98
|
+
"./browserify": {
|
|
99
|
+
"types": "./browserify.d.ts",
|
|
100
|
+
"require": "./browserify.js",
|
|
101
|
+
"default": "./browserify.js"
|
|
102
|
+
},
|
|
103
|
+
"./bun": {
|
|
104
|
+
"types": "./bun.d.ts",
|
|
105
|
+
"require": "./bun.js",
|
|
106
|
+
"default": "./bun.js"
|
|
107
|
+
},
|
|
108
|
+
"./next": {
|
|
109
|
+
"types": "./next.d.ts",
|
|
110
|
+
"require": "./next.js",
|
|
111
|
+
"default": "./next.js"
|
|
112
|
+
},
|
|
113
|
+
"./metro": {
|
|
114
|
+
"types": "./metro.d.ts",
|
|
115
|
+
"require": "./metro.js",
|
|
116
|
+
"default": "./metro.js"
|
|
117
|
+
},
|
|
118
|
+
"./parcel": {
|
|
119
|
+
"types": "./parcel.d.ts",
|
|
120
|
+
"require": "./parcel.js",
|
|
121
|
+
"default": "./parcel.js"
|
|
122
|
+
},
|
|
123
|
+
"./react-native": {
|
|
124
|
+
"types": "./react-native.d.ts",
|
|
125
|
+
"require": "./react-native.js",
|
|
126
|
+
"default": "./react-native.js"
|
|
127
|
+
},
|
|
128
|
+
"./rspack": {
|
|
129
|
+
"types": "./rspack.d.ts",
|
|
130
|
+
"require": "./rspack.js",
|
|
131
|
+
"default": "./rspack.js"
|
|
132
|
+
},
|
|
133
|
+
"./rspack-loader": {
|
|
134
|
+
"types": "./rspack-loader.d.ts",
|
|
135
|
+
"require": "./rspack-loader.js",
|
|
136
|
+
"default": "./rspack-loader.js"
|
|
137
|
+
},
|
|
138
|
+
"./esbuild": {
|
|
139
|
+
"types": "./esbuild.d.ts",
|
|
140
|
+
"require": "./esbuild.js",
|
|
141
|
+
"default": "./esbuild.js"
|
|
142
|
+
},
|
|
143
|
+
"./gulp": {
|
|
144
|
+
"types": "./gulp.d.ts",
|
|
145
|
+
"require": "./gulp.js",
|
|
146
|
+
"default": "./gulp.js"
|
|
147
|
+
},
|
|
148
|
+
"./grunt": {
|
|
149
|
+
"types": "./grunt.d.ts",
|
|
150
|
+
"require": "./grunt.js",
|
|
151
|
+
"default": "./grunt.js"
|
|
152
|
+
},
|
|
153
|
+
"./rollup": {
|
|
154
|
+
"types": "./rollup.d.ts",
|
|
155
|
+
"require": "./rollup.js",
|
|
156
|
+
"default": "./rollup.js"
|
|
157
|
+
},
|
|
158
|
+
"./turbopack": {
|
|
159
|
+
"types": "./turbopack.d.ts",
|
|
160
|
+
"require": "./turbopack.js",
|
|
161
|
+
"default": "./turbopack.js"
|
|
162
|
+
},
|
|
163
|
+
"./vite": {
|
|
164
|
+
"types": "./vite.d.ts",
|
|
165
|
+
"require": "./vite.js",
|
|
166
|
+
"default": "./vite.js"
|
|
167
|
+
},
|
|
168
|
+
"./webpack": {
|
|
169
|
+
"types": "./webpack.d.ts",
|
|
170
|
+
"require": "./webpack.js",
|
|
171
|
+
"default": "./webpack.js"
|
|
172
|
+
},
|
|
173
|
+
"./webpack-loader": {
|
|
174
|
+
"types": "./webpack-loader.d.ts",
|
|
175
|
+
"require": "./webpack-loader.js",
|
|
176
|
+
"default": "./webpack-loader.js"
|
|
177
|
+
},
|
|
178
|
+
"./governance": {
|
|
179
|
+
"types": "./governance/index.d.ts",
|
|
180
|
+
"require": "./governance/index.js",
|
|
181
|
+
"default": "./governance/index.js"
|
|
182
|
+
},
|
|
183
|
+
"./runtime/managed-integrity": {
|
|
184
|
+
"types": "./runtime/managed-integrity.d.ts",
|
|
185
|
+
"require": "./runtime/managed-integrity.js",
|
|
186
|
+
"default": "./runtime/managed-integrity.js"
|
|
187
|
+
},
|
|
188
|
+
"./runtime/data-exfiltration-guard": {
|
|
189
|
+
"types": "./runtime/data-exfiltration-guard.d.ts",
|
|
190
|
+
"require": "./runtime/data-exfiltration-guard.js",
|
|
191
|
+
"default": "./runtime/data-exfiltration-guard.js"
|
|
192
|
+
},
|
|
193
|
+
"./runtime/third-party-inventory": "./runtime/third-party-inventory.js",
|
|
194
|
+
"./runtime/countermeasures": "./runtime/countermeasures.js",
|
|
195
|
+
"./runtime/environment-integrity": "./runtime/environment-integrity.js",
|
|
196
|
+
"./runtime/ai-script-governance": "./runtime/ai-script-governance.js",
|
|
197
|
+
"./package.json": "./package.json",
|
|
198
|
+
"./jso.config.schema.json": "./jso.config.schema.json",
|
|
199
|
+
"./schema": "./jso.config.schema.json"
|
|
200
|
+
},
|
|
201
|
+
"bin": {
|
|
202
|
+
"jso-protector": "./bin/jso-protector.js"
|
|
203
|
+
},
|
|
204
|
+
"scripts": {
|
|
205
|
+
"smoke": "node ./bin/jso-protector.js --help && node ./bin/jso-protector.js --config ./jso.config.example.json --dry-run --json",
|
|
206
|
+
"smoke:api": "node ./bin/jso-protector.js --config ./jso.config.example.json --json",
|
|
207
|
+
"test": "node ./test/cli.test.js && node ./test/ai.test.js && node ./test/ai-precheck.test.js && node ./test/ai-script-governance.test.js && node ./test/data-exfiltration-guard.test.js && node ./test/compat-scan.test.js && node ./test/compliance.test.js && node ./test/evidence-forwarder.test.js && node ./test/config-schema.test.js && node ./test/countermeasures.test.js && node ./test/environment-integrity.test.js && node ./test/estimate.test.js && node ./test/github-action.test.js && node ./test/governance.test.js && node ./test/managed-integrity.test.js && node ./test/named-sets.test.js && node ./test/release-signer.test.js && node ./test/scan-watermarks.test.js && node ./test/third-party-inventory.test.js && node ./test/watermark.test.js && node ./test/wire-format-vectors.test.js",
|
|
208
|
+
"verify": "npm test && npm run verify:package && npm run verify:publish-metadata && npm run verify:ci && npm run verify:polyglot && npm run verify:ai && npm run verify:aspnet-bom && npm run verify:aspnet-compile && npm run verify:endrequest-guard && npm run verify:parser-engine && npm run verify:emit-validation && npm run verify:internal-links && npm run verify:seo && npm run verify:runtime-dashboard && npm run verify:payment-page && npm run verify:competitor-gap && npm run verify:source-map-evidence && npm run verify:migration-review && npm run verify:identifier-cache-review && npm run verify:runtime-defense-review && npm run verify:vm-proof && npm run verify:deployment-hygiene && npm run verify:download-artifacts && npm run verify:copy-discipline && npm run verify:github-action",
|
|
209
|
+
"verify:aspnet-bom": "node ../polyglot-smoke/check-aspnet-bom.js",
|
|
210
|
+
"verify:aspnet-compile": "node ../polyglot-smoke/check-aspnet-compile.js",
|
|
211
|
+
"verify:endrequest-guard": "node ../polyglot-smoke/check-endrequest-guard.js",
|
|
212
|
+
"verify:parser-engine": "node ../polyglot-smoke/check-parser-engine.js",
|
|
213
|
+
"verify:emit-validation": "node ../../tools/emit-validation/run.js",
|
|
214
|
+
"verify:corpus-protect": "node ../../tools/corpus-protect/run.js",
|
|
215
|
+
"verify:internal-links": "node ../polyglot-smoke/check-internal-links.js",
|
|
216
|
+
"verify:seo": "node ../polyglot-smoke/check-public-seo.js",
|
|
217
|
+
"verify:runtime-dashboard": "node ../polyglot-smoke/check-runtime-dashboard.js",
|
|
218
|
+
"verify:payment-page": "node ../polyglot-smoke/check-payment-page-evidence.js",
|
|
219
|
+
"verify:competitor-gap": "node ../polyglot-smoke/check-competitor-gap-report.js",
|
|
220
|
+
"verify:source-map-evidence": "node ../polyglot-smoke/check-source-map-evidence.js",
|
|
221
|
+
"verify:migration-review": "node ../polyglot-smoke/check-migration-review.js",
|
|
222
|
+
"verify:identifier-cache-review": "node ../polyglot-smoke/check-identifier-cache-review.js",
|
|
223
|
+
"verify:runtime-defense-review": "node ../polyglot-smoke/check-runtime-defense-review.js",
|
|
224
|
+
"verify:vm-proof": "node ../polyglot-smoke/check-vm-proof-pack.js",
|
|
225
|
+
"verify:deployment-hygiene": "node ../polyglot-smoke/check-archive-hygiene.js",
|
|
226
|
+
"verify:download-artifacts": "node ../polyglot-smoke/check-download-artifacts.js",
|
|
227
|
+
"verify:copy-discipline": "node ../polyglot-smoke/check-public-copy-discipline.js",
|
|
228
|
+
"verify:github-action": "node ../polyglot-smoke/check-github-action.js",
|
|
229
|
+
"verify:package": "node ./ci/verify-package.js",
|
|
230
|
+
"verify:publish-metadata": "node ./ci/verify-publish-metadata.js --allow-local",
|
|
231
|
+
"verify:publish-ready": "node ./ci/verify-publish-metadata.js",
|
|
232
|
+
"verify:ci": "node ./ci/verify-templates.js",
|
|
233
|
+
"verify:polyglot": "node ../polyglot-smoke/smoke.js",
|
|
234
|
+
"verify:ai": "node ../polyglot-smoke/ai-smoke.js",
|
|
235
|
+
"verify:ai-live": "node ../polyglot-smoke/ai-smoke-live.js",
|
|
236
|
+
"prepublishOnly": "node ./ci/verify-publish-metadata.js && npm run verify:package && npm run verify:ci && npm run verify:polyglot && npm run verify:ai"
|
|
237
|
+
},
|
|
238
|
+
"engines": {
|
|
239
|
+
"node": ">=18"
|
|
240
|
+
}
|
|
241
|
+
}
|
package/parcel.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ProtectionOptions, ProtectionPlan, ProtectionRunResult, ResolvedProtectionConfig } from "./index";
|
|
2
|
+
|
|
3
|
+
export interface JsoProtectorParcelOptions extends ProtectionOptions {}
|
|
4
|
+
|
|
5
|
+
declare function protectParcelBuild(options?: JsoProtectorParcelOptions): Promise<ProtectionRunResult>;
|
|
6
|
+
declare function createParcelProtectionConfig(options?: JsoProtectorParcelOptions): ResolvedProtectionConfig;
|
|
7
|
+
declare function planParcelBuild(options?: JsoProtectorParcelOptions): ProtectionPlan;
|
|
8
|
+
|
|
9
|
+
export { createParcelProtectionConfig, planParcelBuild, protectParcelBuild };
|
|
10
|
+
export default protectParcelBuild;
|
package/parcel.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { createProtectionConfig, planProtection, protectFiles } = require("./index.js");
|
|
4
|
+
|
|
5
|
+
function createParcelProtectionConfig(options = {}) {
|
|
6
|
+
return createProtectionConfig({
|
|
7
|
+
input: "dist",
|
|
8
|
+
output: "dist-protected",
|
|
9
|
+
preset: "balanced",
|
|
10
|
+
exclude: ["**/*.map", "**/vendor/**"],
|
|
11
|
+
assetExclude: ["**/*.map"],
|
|
12
|
+
maxGrowthRatio: 8,
|
|
13
|
+
manifest: defaultManifestForOutput(options, "dist-protected/jso-manifest.json"),
|
|
14
|
+
...options
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function planParcelBuild(options = {}) {
|
|
19
|
+
return planProtection(createParcelProtectionConfig(options));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function protectParcelBuild(options = {}) {
|
|
23
|
+
return protectFiles(createParcelProtectionConfig(options));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function defaultManifestForOutput(options, fallback) {
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(options || {}, "manifest")) {
|
|
28
|
+
return options.manifest;
|
|
29
|
+
}
|
|
30
|
+
if (options && options.output) {
|
|
31
|
+
return `${String(options.output).replace(/[\\/]$/, "")}/jso-manifest.json`;
|
|
32
|
+
}
|
|
33
|
+
return fallback;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = protectParcelBuild;
|
|
37
|
+
module.exports.createParcelProtectionConfig = createParcelProtectionConfig;
|
|
38
|
+
module.exports.planParcelBuild = planParcelBuild;
|
|
39
|
+
module.exports.protectParcelBuild = protectParcelBuild;
|
|
40
|
+
module.exports.default = protectParcelBuild;
|
package/react-native.js
ADDED