@equinor/roma-nx-plugin 6.2.0-beta.4 → 6.2.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +31 -0
- package/migrations.json +81 -0
- package/package.json +6 -6
- package/src/executors/build/minify.js +8 -2
- package/src/executors/build/minify.js.map +1 -1
- package/src/executors/create-vite-config.js +9 -1
- package/src/executors/create-vite-config.js.map +1 -1
- package/src/executors/utils/csp/csp-check-plugin.d.ts +24 -0
- package/src/executors/utils/csp/csp-check-plugin.js +99 -0
- package/src/executors/utils/csp/csp-check-plugin.js.map +1 -0
- package/src/executors/utils/csp/data/generated-csp.json +5 -0
- package/src/executors/utils/csp/extract-urls.d.ts +13 -0
- package/src/executors/utils/csp/extract-urls.js +76 -0
- package/src/executors/utils/csp/extract-urls.js.map +1 -0
- package/src/executors/utils/csp/match-origin.d.ts +15 -0
- package/src/executors/utils/csp/match-origin.js +107 -0
- package/src/executors/utils/csp/match-origin.js.map +1 -0
- package/src/executors/utils/csp/parse-csp.d.ts +19 -0
- package/src/executors/utils/csp/parse-csp.js +48 -0
- package/src/executors/utils/csp/parse-csp.js.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
# [6.2.0-rc.1](https://github.com/equinor/tops-roma/compare/roma-6.2.0-rc.0...roma-6.2.0-rc.1) (2026-06-26)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **ROMA-321:** Fix minifyEs plugin ([f903962](https://github.com/equinor/tops-roma/commit/f9039626d7467216a2d12a7f8b86abf27bcdbc55))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [6.2.0-rc.0](https://github.com/equinor/tops-roma/compare/roma-6.2.0-beta.4...roma-6.2.0-rc.0) (2026-06-25)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **ROMA-262:** Add CSP warning plugin ([#554](https://github.com/equinor/tops-roma/issues/554)) ([08d9f7d](https://github.com/equinor/tops-roma/commit/08d9f7ddf7a2a03e56d43c29ae9985dc59067745))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
5
23
|
# [6.2.0-beta.4](https://github.com/equinor/tops-roma/compare/roma-6.2.0-beta.3...roma-6.2.0-beta.4) (2026-06-22)
|
|
6
24
|
|
|
7
25
|
|
package/README.md
CHANGED
|
@@ -9,3 +9,34 @@ Run `nx build roma` to build the library.
|
|
|
9
9
|
## Running unit tests
|
|
10
10
|
|
|
11
11
|
Run `nx test roma` to execute the unit tests via [Jest](https://jestjs.io).
|
|
12
|
+
|
|
13
|
+
## CSP check
|
|
14
|
+
|
|
15
|
+
The `serve` and `build` executors run a static Content-Security-Policy check that warns
|
|
16
|
+
when an app references an external resource that would be **blocked in production** by the
|
|
17
|
+
workbench CSP. It scans first-party modules for external `http(s)`/`ws(s)` URLs used in:
|
|
18
|
+
|
|
19
|
+
- `import` / dynamic `import()` / side-effect imports → `script-src`
|
|
20
|
+
- `fetch` / `WebSocket` / `EventSource` → `connect-src`
|
|
21
|
+
- CSS `url(...)` → `img-src` (or `font-src` for font files)
|
|
22
|
+
- CSS `@import` → `style-src`
|
|
23
|
+
|
|
24
|
+
Each URL's origin is compared against the relevant CSP directive (falling back to
|
|
25
|
+
`default-src`). Violations are logged as warnings — the check **never fails** the build.
|
|
26
|
+
Plain string-literal URLs (e.g. link hrefs) are intentionally ignored, since CSP fetch
|
|
27
|
+
directives do not block them.
|
|
28
|
+
|
|
29
|
+
### Source of truth
|
|
30
|
+
|
|
31
|
+
The CSP is the one defined in `apps/workbench/public/staticwebapp.config.json`. Because
|
|
32
|
+
that file is not part of the published plugin, a snapshot is bundled at
|
|
33
|
+
`src/executors/utils/csp/data/generated-csp.json`. Refresh it whenever the workbench CSP
|
|
34
|
+
changes:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
nx run roma:generate-csp
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The check is disabled automatically (no warnings) if the bundled snapshot is missing or
|
|
41
|
+
unparseable.
|
|
42
|
+
|
package/migrations.json
CHANGED
|
@@ -477,6 +477,87 @@
|
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
},
|
|
480
|
+
"upgrade-fusion-6-2": {
|
|
481
|
+
"version": "6.2.0-rc.0",
|
|
482
|
+
"packages": {
|
|
483
|
+
"@equinor/fusion-framework": {
|
|
484
|
+
"version": "8.0.9",
|
|
485
|
+
"alwaysAddToPackageJson": false
|
|
486
|
+
},
|
|
487
|
+
"@equinor/fusion-framework-app": {
|
|
488
|
+
"version": "11.0.9",
|
|
489
|
+
"alwaysAddToPackageJson": false
|
|
490
|
+
},
|
|
491
|
+
"@equinor/fusion-framework-module": {
|
|
492
|
+
"version": "6.1.0",
|
|
493
|
+
"alwaysAddToPackageJson": false
|
|
494
|
+
},
|
|
495
|
+
"@equinor/fusion-framework-module-app": {
|
|
496
|
+
"version": "8.0.2",
|
|
497
|
+
"alwaysAddToPackageJson": false
|
|
498
|
+
},
|
|
499
|
+
"@equinor/fusion-framework-module-context": {
|
|
500
|
+
"version": "8.0.0",
|
|
501
|
+
"alwaysAddToPackageJson": false
|
|
502
|
+
},
|
|
503
|
+
"@equinor/fusion-framework-module-feature-flag": {
|
|
504
|
+
"version": "2.0.1",
|
|
505
|
+
"alwaysAddToPackageJson": false
|
|
506
|
+
},
|
|
507
|
+
"@equinor/fusion-framework-module-http": {
|
|
508
|
+
"version": "8.0.3",
|
|
509
|
+
"alwaysAddToPackageJson": false
|
|
510
|
+
},
|
|
511
|
+
"@equinor/fusion-framework-module-msal": {
|
|
512
|
+
"version": "10.0.0",
|
|
513
|
+
"alwaysAddToPackageJson": false
|
|
514
|
+
},
|
|
515
|
+
"@equinor/fusion-framework-module-navigation": {
|
|
516
|
+
"version": "7.0.4",
|
|
517
|
+
"alwaysAddToPackageJson": false
|
|
518
|
+
},
|
|
519
|
+
"@equinor/fusion-framework-module-service-discovery": {
|
|
520
|
+
"version": "10.0.1",
|
|
521
|
+
"alwaysAddToPackageJson": false
|
|
522
|
+
},
|
|
523
|
+
"@equinor/fusion-framework-react": {
|
|
524
|
+
"version": "8.0.0",
|
|
525
|
+
"alwaysAddToPackageJson": false
|
|
526
|
+
},
|
|
527
|
+
"@equinor/fusion-framework-react-app": {
|
|
528
|
+
"version": "12.0.1",
|
|
529
|
+
"alwaysAddToPackageJson": false
|
|
530
|
+
},
|
|
531
|
+
"@equinor/fusion-framework-react-module": {
|
|
532
|
+
"version": "4.0.1",
|
|
533
|
+
"alwaysAddToPackageJson": false
|
|
534
|
+
},
|
|
535
|
+
"@equinor/fusion-framework-react-module-http": {
|
|
536
|
+
"version": "11.0.0",
|
|
537
|
+
"alwaysAddToPackageJson": false
|
|
538
|
+
},
|
|
539
|
+
"@equinor/fusion-framework-react-router": {
|
|
540
|
+
"version": "2.2.0",
|
|
541
|
+
"alwaysAddToPackageJson": false
|
|
542
|
+
},
|
|
543
|
+
"vite": {
|
|
544
|
+
"version": "^8.1.0",
|
|
545
|
+
"alwaysAddToPackageJson": false
|
|
546
|
+
},
|
|
547
|
+
"typescript": {
|
|
548
|
+
"version": "6.0.3",
|
|
549
|
+
"alwaysAddToPackageJson": false
|
|
550
|
+
},
|
|
551
|
+
"@equinor/roma-framework": {
|
|
552
|
+
"version": "^6.1.0-rc.0",
|
|
553
|
+
"alwaysAddToPackageJson": true
|
|
554
|
+
},
|
|
555
|
+
"vitest": {
|
|
556
|
+
"version": "4.1.9",
|
|
557
|
+
"alwaysAddToPackageJson": false
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
},
|
|
480
561
|
"roma-6": {
|
|
481
562
|
"version": "6.0.0-beta.0",
|
|
482
563
|
"packages": {
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/roma-nx-plugin",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "6.2.0-
|
|
4
|
+
"version": "6.2.0-rc.1",
|
|
5
5
|
"repository": "https://github.com/equinor/tops-roma",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@azure/identity": "^4.4.1",
|
|
8
|
-
"@equinor/fusion-framework-module-app": "8.0.
|
|
9
|
-
"@equinor/roma-framework": "6.1.0-
|
|
8
|
+
"@equinor/fusion-framework-module-app": "8.0.2",
|
|
9
|
+
"@equinor/roma-framework": "6.1.0-rc.0",
|
|
10
10
|
"@nx/devkit": "^22.0.3",
|
|
11
11
|
"@nx/react": "^22.0.3",
|
|
12
|
-
"@vitejs/plugin-react": "^
|
|
12
|
+
"@vitejs/plugin-react": "^6.0.3",
|
|
13
13
|
"cypress": "^15.13.0",
|
|
14
14
|
"esbuild": "0.27.3",
|
|
15
15
|
"express": "^4.18.3",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"semver": "6.3.1",
|
|
21
21
|
"ts-morph": "^25.0.1",
|
|
22
22
|
"tslib": "^2.3.0",
|
|
23
|
-
"vite": "^
|
|
24
|
-
"vite-plugin-checker": "^0.
|
|
23
|
+
"vite": "^8.1.0",
|
|
24
|
+
"vite-plugin-checker": "^0.14.4",
|
|
25
25
|
"vite-plugin-environment": "^1.1.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
@@ -9,12 +9,18 @@ function minifyEs() {
|
|
|
9
9
|
order: 'post',
|
|
10
10
|
async handler(code, chunk, outputOptions) {
|
|
11
11
|
if (outputOptions.format === 'es') {
|
|
12
|
-
|
|
12
|
+
const sourcemap = !!outputOptions.sourcemap;
|
|
13
|
+
const result = await (0, esbuild_1.transform)(code, {
|
|
13
14
|
minifyWhitespace: true,
|
|
14
15
|
minifySyntax: true,
|
|
16
|
+
sourcemap,
|
|
15
17
|
});
|
|
18
|
+
return {
|
|
19
|
+
code: result.code,
|
|
20
|
+
map: sourcemap && result.map ? result.map : null,
|
|
21
|
+
};
|
|
16
22
|
}
|
|
17
|
-
return
|
|
23
|
+
return null;
|
|
18
24
|
},
|
|
19
25
|
},
|
|
20
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minify.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/build/minify.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"minify.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/executors/build/minify.ts"],"names":[],"mappings":";;AAGA,4BAsBC;AAxBD,qCAAoC;AAEpC,SAAgB,QAAQ;IACtB,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE;YACX,KAAK,EAAE,MAAM;YACb,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,aAAa;gBACtC,IAAI,aAAa,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;oBAClC,MAAM,SAAS,GAAG,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC;oBAC5C,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAS,EAAC,IAAI,EAAE;wBACnC,gBAAgB,EAAE,IAAI;wBACtB,YAAY,EAAE,IAAI;wBAClB,SAAS;qBACV,CAAC,CAAC;oBACH,OAAO;wBACL,IAAI,EAAE,MAAM,CAAC,IAAI;wBACjB,GAAG,EAAE,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI;qBACjD,CAAC;gBACJ,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;SACF;KACQ,CAAC;AACd,CAAC"}
|
|
@@ -6,7 +6,6 @@ const tslib_1 = require("tslib");
|
|
|
6
6
|
const vite_1 = require("vite");
|
|
7
7
|
const vite_plugin_environment_1 = tslib_1.__importDefault(require("vite-plugin-environment"));
|
|
8
8
|
const path_1 = require("path");
|
|
9
|
-
// @ts-expect-error not quite sure what the issue here is..
|
|
10
9
|
const plugin_react_1 = tslib_1.__importDefault(require("@vitejs/plugin-react"));
|
|
11
10
|
const logger_1 = require("./utils/logger");
|
|
12
11
|
const nx_tsconfig_paths_plugin_1 = require("@nx/vite/plugins/nx-tsconfig-paths.plugin");
|
|
@@ -14,6 +13,8 @@ const minify_1 = require("./build/minify");
|
|
|
14
13
|
const vite_plugin_checker_1 = tslib_1.__importDefault(require("vite-plugin-checker"));
|
|
15
14
|
const get_version_1 = require("./utils/get-version");
|
|
16
15
|
const normalizeRootForFusion_1 = require("./build/normalizeRootForFusion");
|
|
16
|
+
const parse_csp_1 = require("./utils/csp/parse-csp");
|
|
17
|
+
const csp_check_plugin_1 = require("./utils/csp/csp-check-plugin");
|
|
17
18
|
const createRomaViteConfig = async (config, context, watch = false, hmrPort = 42000) => {
|
|
18
19
|
var _a;
|
|
19
20
|
const isServe = context.targetName === 'serve';
|
|
@@ -78,6 +79,13 @@ const createRomaViteConfig = async (config, context, watch = false, hmrPort = 42
|
|
|
78
79
|
config.build.lib.entry = entry;
|
|
79
80
|
config.build.emptyOutDir = true;
|
|
80
81
|
const plugins = [normalizeRootForFusion_1.normalizeRootForFusionRouter];
|
|
82
|
+
const cspLogger = new logger_1.Logger();
|
|
83
|
+
plugins.push((0, csp_check_plugin_1.createCspCheckPlugin)({
|
|
84
|
+
directives: (0, parse_csp_1.loadCspDirectives)(),
|
|
85
|
+
warn: (msg) => cspLogger.warnOnce(msg),
|
|
86
|
+
command: context.targetName === 'serve' ? 'serve' : 'build',
|
|
87
|
+
skipOrigins: options.portal ? [options.portal] : [],
|
|
88
|
+
}));
|
|
81
89
|
if (config.build.minify) {
|
|
82
90
|
plugins.push((0, minify_1.minifyEs)());
|
|
83
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-vite-config.js","sourceRoot":"","sources":["../../../../../plugins/roma/src/executors/create-vite-config.ts"],"names":[],"mappings":";;;;AAAA,sDAAsD;AACtD,+BAMc;AACd,8FAA8C;AAC9C,+BAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"create-vite-config.js","sourceRoot":"","sources":["../../../../../plugins/roma/src/executors/create-vite-config.ts"],"names":[],"mappings":";;;;AAAA,sDAAsD;AACtD,+BAMc;AACd,8FAA8C;AAC9C,+BAAqC;AACrC,gFAAyC;AACzC,2CAAwC;AAGxC,wFAA0E;AAC1E,2CAA0C;AAE1C,sFAA0C;AAC1C,qDAAiD;AACjD,2EAA8E;AAC9E,qDAA0D;AAC1D,mEAAoE;AAM7D,MAAM,oBAAoB,GAAG,KAAK,EACvC,MAAkB,EAClB,OAAwB,EACxB,KAAK,GAAG,KAAK,EACb,OAAO,GAAG,KAAK,EACf,EAAE;;IACF,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,KAAK,OAAO,CAAC;IAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACxC,MAAM,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACrE,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IACnC,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;IAC1C,MAAM,OAAO,GAAG,WAAW,CAAC,OAA8B,CAAC;IAC3D,IAAI,IAAY,CAAC;IACjB,IAAI,KAAsC,CAAC;IAC3C,IAAI,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAC/B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvD,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,GAAG,YAAY,CAAC;QACtB,IAAI,GAAG,IAAA,cAAO,EAAC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AAC,CAAC,CAAC;AACvD,CAAC,CAAC;AAjJW,QAAA,oBAAoB,wBAiJ/B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
import type { CspDirectives } from './parse-csp';
|
|
3
|
+
export type CspCheckPluginOptions = {
|
|
4
|
+
/** Parsed CSP directives, or `null` to disable the check. */
|
|
5
|
+
directives: CspDirectives | null;
|
|
6
|
+
/** Sink for warnings (e.g. the roma Logger's `warn`). */
|
|
7
|
+
warn: (message: string) => void;
|
|
8
|
+
/** Vite command; controls incremental (serve) vs consolidated (build) reporting. */
|
|
9
|
+
command?: 'serve' | 'build';
|
|
10
|
+
/** Origin treated as `'self'` (e.g. the dev server origin). */
|
|
11
|
+
selfOrigin?: string;
|
|
12
|
+
/** Additional origins to ignore (e.g. the portal target). */
|
|
13
|
+
skipOrigins?: Array<string>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Vite plugin that statically scans first-party modules for external resource
|
|
17
|
+
* URLs that would be blocked in production by the workbench CSP, and warns the
|
|
18
|
+
* developer. It never fails the build.
|
|
19
|
+
*
|
|
20
|
+
* Runs on both `serve` and `build` (both route through `createRomaViteConfig`):
|
|
21
|
+
* on `serve` it warns incrementally as modules transform; on `build` it reports
|
|
22
|
+
* a consolidated, de-duplicated summary at `buildEnd`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createCspCheckPlugin(options: CspCheckPluginOptions): Plugin;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCspCheckPlugin = createCspCheckPlugin;
|
|
4
|
+
const extract_urls_1 = require("./extract-urls");
|
|
5
|
+
const match_origin_1 = require("./match-origin");
|
|
6
|
+
const LOCAL_HOSTS = new Set(['localhost', '127.0.0.1', '0.0.0.0', '[::1]']);
|
|
7
|
+
function originHost(origin) {
|
|
8
|
+
try {
|
|
9
|
+
return new URL(origin).hostname.toLowerCase();
|
|
10
|
+
}
|
|
11
|
+
catch (_a) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function isSkippable(origin, skipOrigins) {
|
|
16
|
+
if (skipOrigins.has(origin))
|
|
17
|
+
return true;
|
|
18
|
+
const host = originHost(origin);
|
|
19
|
+
if (host && LOCAL_HOSTS.has(host))
|
|
20
|
+
return true;
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
function shouldSkipModule(id) {
|
|
24
|
+
if (!id)
|
|
25
|
+
return true;
|
|
26
|
+
if (id.startsWith('\0'))
|
|
27
|
+
return true; // virtual modules
|
|
28
|
+
if (id.includes('node_modules'))
|
|
29
|
+
return true;
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
function formatViolation(v) {
|
|
33
|
+
const files = Array.from(v.files).join(', ');
|
|
34
|
+
return (`[CSP] ${v.origin} may be blocked in production (${v.directive}). ` +
|
|
35
|
+
`Allowed ${v.directive}: ${v.allowed || "'none'"}. Found in ${files}`);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Vite plugin that statically scans first-party modules for external resource
|
|
39
|
+
* URLs that would be blocked in production by the workbench CSP, and warns the
|
|
40
|
+
* developer. It never fails the build.
|
|
41
|
+
*
|
|
42
|
+
* Runs on both `serve` and `build` (both route through `createRomaViteConfig`):
|
|
43
|
+
* on `serve` it warns incrementally as modules transform; on `build` it reports
|
|
44
|
+
* a consolidated, de-duplicated summary at `buildEnd`.
|
|
45
|
+
*/
|
|
46
|
+
function createCspCheckPlugin(options) {
|
|
47
|
+
var _a;
|
|
48
|
+
const { directives, warn, command = 'serve', selfOrigin } = options;
|
|
49
|
+
const skipOrigins = new Set((_a = options.skipOrigins) !== null && _a !== void 0 ? _a : []);
|
|
50
|
+
const violations = new Map();
|
|
51
|
+
const record = (origin, category, directive, sourceFile) => {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
const key = `${category}|${origin}`;
|
|
54
|
+
const existing = violations.get(key);
|
|
55
|
+
if (existing) {
|
|
56
|
+
existing.files.add(sourceFile);
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const allowed = ((_b = (_a = directives === null || directives === void 0 ? void 0 : directives[directive]) !== null && _a !== void 0 ? _a : directives === null || directives === void 0 ? void 0 : directives['default-src']) !== null && _b !== void 0 ? _b : []).join(', ');
|
|
60
|
+
const violation = {
|
|
61
|
+
origin,
|
|
62
|
+
category,
|
|
63
|
+
directive,
|
|
64
|
+
allowed,
|
|
65
|
+
files: new Set([sourceFile]),
|
|
66
|
+
};
|
|
67
|
+
violations.set(key, violation);
|
|
68
|
+
return violation;
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
name: 'roma-csp-check',
|
|
72
|
+
apply: () => true,
|
|
73
|
+
transform(code, id) {
|
|
74
|
+
if (!directives || shouldSkipModule(id))
|
|
75
|
+
return null;
|
|
76
|
+
for (const usage of (0, extract_urls_1.extractExternalUrls)(code, id)) {
|
|
77
|
+
if (isSkippable(usage.origin, skipOrigins))
|
|
78
|
+
continue;
|
|
79
|
+
if ((0, match_origin_1.isOriginAllowed)(usage.origin, usage.category, directives, selfOrigin)) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const directive = match_origin_1.categoryToDirective[usage.category];
|
|
83
|
+
const created = record(usage.origin, usage.category, directive, id);
|
|
84
|
+
if (command === 'serve' && created) {
|
|
85
|
+
warn(formatViolation(created));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
},
|
|
90
|
+
buildEnd() {
|
|
91
|
+
if (command !== 'build' || violations.size === 0)
|
|
92
|
+
return;
|
|
93
|
+
const lines = Array.from(violations.values()).map(formatViolation);
|
|
94
|
+
warn(`Potential CSP violations detected (these resources may be blocked in production):\n` +
|
|
95
|
+
lines.map((l) => ` ${l}`).join('\n'));
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=csp-check-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csp-check-plugin.js","sourceRoot":"","sources":["../../../../../../../plugins/roma/src/executors/utils/csp/csp-check-plugin.ts"],"names":[],"mappings":";;AAuEA,oDAiEC;AAtID,iDAAqD;AACrD,iDAIwB;AAuBxB,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAE5E,SAAS,UAAU,CAAC,MAAc;IAChC,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;IAChD,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,MAAc,EAAE,WAAwB;IAC3D,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACzC,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/C,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAU;IAClC,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC;IACrB,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,kBAAkB;IACxD,IAAI,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7C,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,eAAe,CAAC,CAAY;IACnC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAA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C,CACxC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Generated by plugins/roma/scripts/generate-csp.mjs from apps/workbench/public/staticwebapp.config.json. Do not edit by hand; run `nx run roma:generate-csp` to refresh.",
|
|
3
|
+
"source": "apps/workbench/public/staticwebapp.config.json",
|
|
4
|
+
"contentSecurityPolicy": "default-src 'self'; script-src 'self' https://unpkg.com; style-src 'self' 'unsafe-inline' https://cdn.eds.equinor.com https://romadev.equinor.com https://fonts.googleapis.com; font-src 'self' https://cdn.eds.equinor.com https://romadev.equinor.com https://fonts.gstatic.com; connect-src 'self' https:; img-src 'self' data: https:; frame-src https://login.microsoftonline.com; frame-ancestors 'none'; object-src 'none'; base-uri 'self'; form-action 'self';"
|
|
5
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { UsageCategory } from './match-origin';
|
|
2
|
+
export type ExternalUrlUsage = {
|
|
3
|
+
url: string;
|
|
4
|
+
origin: string;
|
|
5
|
+
category: UsageCategory;
|
|
6
|
+
sourceFile: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Scan a module's source for external `http(s)` (and `ws(s)` for connections)
|
|
10
|
+
* URLs and classify each by usage category. Best-effort static analysis: it
|
|
11
|
+
* cannot see URLs constructed dynamically at runtime.
|
|
12
|
+
*/
|
|
13
|
+
export declare function extractExternalUrls(code: string, sourceFile: string): Array<ExternalUrlUsage>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractExternalUrls = extractExternalUrls;
|
|
4
|
+
const CSS_FILE = /\.(css|scss|sass|less|styl)(\?|$)/i;
|
|
5
|
+
const FONT_FILE = /\.(woff2?|ttf|otf|eot)(\?|$|[?#])/i;
|
|
6
|
+
function toOrigin(url) {
|
|
7
|
+
try {
|
|
8
|
+
return new URL(url).origin;
|
|
9
|
+
}
|
|
10
|
+
catch (_a) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function pushUsage(out, seen, url, category, sourceFile) {
|
|
15
|
+
const origin = toOrigin(url);
|
|
16
|
+
if (!origin || origin === 'null')
|
|
17
|
+
return;
|
|
18
|
+
const key = `${category}|${url}`;
|
|
19
|
+
if (seen.has(key))
|
|
20
|
+
return;
|
|
21
|
+
seen.add(key);
|
|
22
|
+
out.push({ url, origin, category, sourceFile });
|
|
23
|
+
}
|
|
24
|
+
function extractFromCss(code, sourceFile) {
|
|
25
|
+
const out = [];
|
|
26
|
+
const seen = new Set();
|
|
27
|
+
const importedUrls = new Set();
|
|
28
|
+
const importRe = /@import\s+(?:url\(\s*)?['"]?((?:https?):\/\/[^'")\s]+)/gi;
|
|
29
|
+
let m;
|
|
30
|
+
while ((m = importRe.exec(code)) !== null) {
|
|
31
|
+
importedUrls.add(m[1]);
|
|
32
|
+
pushUsage(out, seen, m[1], 'style', sourceFile);
|
|
33
|
+
}
|
|
34
|
+
const urlRe = /url\(\s*['"]?((?:https?):\/\/[^'")\s]+)/gi;
|
|
35
|
+
while ((m = urlRe.exec(code)) !== null) {
|
|
36
|
+
const url = m[1];
|
|
37
|
+
if (importedUrls.has(url))
|
|
38
|
+
continue;
|
|
39
|
+
const category = FONT_FILE.test(url) ? 'font' : 'img';
|
|
40
|
+
pushUsage(out, seen, url, category, sourceFile);
|
|
41
|
+
}
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
function extractFromScript(code, sourceFile) {
|
|
45
|
+
const out = [];
|
|
46
|
+
const seen = new Set();
|
|
47
|
+
let m;
|
|
48
|
+
const scriptPatterns = [
|
|
49
|
+
/\b(?:import|export)\b[^'";]*?\bfrom\s*['"](https?:\/\/[^'"]+)['"]/g,
|
|
50
|
+
/\bimport\s*\(\s*['"](https?:\/\/[^'"]+)['"]\s*\)/g,
|
|
51
|
+
/\bimport\s*['"](https?:\/\/[^'"]+)['"]/g,
|
|
52
|
+
];
|
|
53
|
+
for (const re of scriptPatterns) {
|
|
54
|
+
while ((m = re.exec(code)) !== null) {
|
|
55
|
+
pushUsage(out, seen, m[1], 'script', sourceFile);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const connectRe = /\b(?:fetch|EventSource|WebSocket)\s*\(\s*['"`]((?:https?|wss?):\/\/[^'"`]+)/g;
|
|
59
|
+
while ((m = connectRe.exec(code)) !== null) {
|
|
60
|
+
pushUsage(out, seen, m[1], 'connect', sourceFile);
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Scan a module's source for external `http(s)` (and `ws(s)` for connections)
|
|
66
|
+
* URLs and classify each by usage category. Best-effort static analysis: it
|
|
67
|
+
* cannot see URLs constructed dynamically at runtime.
|
|
68
|
+
*/
|
|
69
|
+
function extractExternalUrls(code, sourceFile) {
|
|
70
|
+
if (!code)
|
|
71
|
+
return [];
|
|
72
|
+
return CSS_FILE.test(sourceFile)
|
|
73
|
+
? extractFromCss(code, sourceFile)
|
|
74
|
+
: extractFromScript(code, sourceFile);
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=extract-urls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-urls.js","sourceRoot":"","sources":["../../../../../../../plugins/roma/src/executors/utils/csp/extract-urls.ts"],"names":[],"mappings":";;AA8FA,kDAQC;AA7FD,MAAM,QAAQ,GAAG,oCAAoC,CAAC;AACtD,MAAM,SAAS,GAAG,oCAAoC,CAAC;AAEvD,SAAS,QAAQ,CAAC,GAAW;IAC3B,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAChB,GAA4B,EAC5B,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QAClC,CAAC,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CspDirectives } from './parse-csp';
|
|
2
|
+
/** Usage categories detected in source, each mapped to a CSP fetch directive. */
|
|
3
|
+
export type UsageCategory = 'script' | 'connect' | 'style' | 'font' | 'img' | 'other';
|
|
4
|
+
export declare const categoryToDirective: Record<UsageCategory, string>;
|
|
5
|
+
/**
|
|
6
|
+
* Determine whether `origin` is allowed to load a resource of the given
|
|
7
|
+
* `category` under the supplied CSP directives.
|
|
8
|
+
*
|
|
9
|
+
* Resolution: the category's directive is consulted, falling back to
|
|
10
|
+
* `default-src` when that directive is absent. The origin is allowed if any
|
|
11
|
+
* source in the resolved directive matches by `'self'`, scheme (e.g. `https:`),
|
|
12
|
+
* or host (including `*.` wildcards). `'none'` and other keywords never match an
|
|
13
|
+
* external origin.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isOriginAllowed(origin: string, category: UsageCategory, directives: CspDirectives, selfOrigin?: string): boolean;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.categoryToDirective = void 0;
|
|
4
|
+
exports.isOriginAllowed = isOriginAllowed;
|
|
5
|
+
exports.categoryToDirective = {
|
|
6
|
+
script: 'script-src',
|
|
7
|
+
connect: 'connect-src',
|
|
8
|
+
style: 'style-src',
|
|
9
|
+
font: 'font-src',
|
|
10
|
+
img: 'img-src',
|
|
11
|
+
other: 'default-src',
|
|
12
|
+
};
|
|
13
|
+
function parseOrigin(origin) {
|
|
14
|
+
try {
|
|
15
|
+
const url = new URL(origin);
|
|
16
|
+
return {
|
|
17
|
+
scheme: url.protocol.replace(/:$/, '').toLowerCase(),
|
|
18
|
+
host: url.hostname.toLowerCase(),
|
|
19
|
+
port: url.port,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
catch (_a) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function isSchemeSource(source) {
|
|
27
|
+
return /^[a-z][a-z0-9+.-]*:$/i.test(source);
|
|
28
|
+
}
|
|
29
|
+
function isKeywordSource(source) {
|
|
30
|
+
return source.startsWith("'") && source.endsWith("'");
|
|
31
|
+
}
|
|
32
|
+
function hostMatches(sourceHost, originHost) {
|
|
33
|
+
const s = sourceHost.toLowerCase();
|
|
34
|
+
if (s.startsWith('*.')) {
|
|
35
|
+
const suffix = s.slice(1); // ".example.com"
|
|
36
|
+
return originHost.endsWith(suffix) && originHost !== suffix.slice(1);
|
|
37
|
+
}
|
|
38
|
+
return s === originHost;
|
|
39
|
+
}
|
|
40
|
+
function hostSourceMatches(source, origin) {
|
|
41
|
+
// Strip any path component; we only compare origins.
|
|
42
|
+
let value = source;
|
|
43
|
+
let scheme;
|
|
44
|
+
const schemeMatch = value.match(/^([a-z][a-z0-9+.-]*):\/\//i);
|
|
45
|
+
if (schemeMatch) {
|
|
46
|
+
scheme = schemeMatch[1].toLowerCase();
|
|
47
|
+
value = value.slice(schemeMatch[0].length);
|
|
48
|
+
}
|
|
49
|
+
// Remove path / query.
|
|
50
|
+
value = value.split('/')[0];
|
|
51
|
+
let port;
|
|
52
|
+
const portMatch = value.match(/:(\d+|\*)$/);
|
|
53
|
+
if (portMatch) {
|
|
54
|
+
port = portMatch[1];
|
|
55
|
+
value = value.slice(0, value.length - portMatch[0].length);
|
|
56
|
+
}
|
|
57
|
+
if (scheme && scheme !== origin.scheme)
|
|
58
|
+
return false;
|
|
59
|
+
if (!hostMatches(value, origin.host))
|
|
60
|
+
return false;
|
|
61
|
+
if (port && port !== '*' && port !== origin.port)
|
|
62
|
+
return false;
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Determine whether `origin` is allowed to load a resource of the given
|
|
67
|
+
* `category` under the supplied CSP directives.
|
|
68
|
+
*
|
|
69
|
+
* Resolution: the category's directive is consulted, falling back to
|
|
70
|
+
* `default-src` when that directive is absent. The origin is allowed if any
|
|
71
|
+
* source in the resolved directive matches by `'self'`, scheme (e.g. `https:`),
|
|
72
|
+
* or host (including `*.` wildcards). `'none'` and other keywords never match an
|
|
73
|
+
* external origin.
|
|
74
|
+
*/
|
|
75
|
+
function isOriginAllowed(origin, category, directives, selfOrigin) {
|
|
76
|
+
var _a;
|
|
77
|
+
const parsed = parseOrigin(origin);
|
|
78
|
+
if (!parsed)
|
|
79
|
+
return false;
|
|
80
|
+
const directiveName = exports.categoryToDirective[category];
|
|
81
|
+
const sources = (_a = directives[directiveName]) !== null && _a !== void 0 ? _a : directives['default-src'];
|
|
82
|
+
if (!sources || sources.length === 0)
|
|
83
|
+
return false;
|
|
84
|
+
for (const source of sources) {
|
|
85
|
+
if (isKeywordSource(source)) {
|
|
86
|
+
if (source === "'self'" && selfOrigin) {
|
|
87
|
+
const self = parseOrigin(selfOrigin);
|
|
88
|
+
if (self &&
|
|
89
|
+
self.scheme === parsed.scheme &&
|
|
90
|
+
self.host === parsed.host &&
|
|
91
|
+
self.port === parsed.port) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (isSchemeSource(source)) {
|
|
98
|
+
if (source.replace(/:$/, '').toLowerCase() === parsed.scheme)
|
|
99
|
+
return true;
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (hostSourceMatches(source, parsed))
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=match-origin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match-origin.js","sourceRoot":"","sources":["../../../../../../../plugins/roma/src/executors/utils/csp/match-origin.ts"],"names":[],"mappings":";;;AA0FA,0CAsCC;AArHY,QAAA,mBAAmB,GAAkC;IAChE,MAAM,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,KAAK,CAAC;IAE1B,MAAM,aAAa,GAAG,2BAAmB,CAAC,QAAQ,CAAC,CAAC;IACpD,MAAM,OAAO,GAAG,MAAA,UAAU,CAAC,aAAa,CAAC,mCAAI,UAAU,CAAC,aAAa,CAAC,CAAC;IACvE,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAEnD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;YAC5B,IAAI,MAAM,KAAK,QAAQ,IAAI,UAAU,EAAE,CAAC;gBACtC,MAAM,IAAI,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;gBACrC,IACE,IAAI;oBACJ,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;oBAC7B,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI;oBACzB,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,EACzB,CAAC;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YACD,SAAS;QACX,CAAC;QAED,IAAI,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3B,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YAC1E,SAAS;QACX,CAAC;QAED,IAAI,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC;YAAE,OAAO,IAAI,CAAC;IACrD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** A parsed CSP: directive name (lowercased) -> list of source expressions. */
|
|
2
|
+
export type CspDirectives = Record<string, Array<string>>;
|
|
3
|
+
/**
|
|
4
|
+
* Parse a `Content-Security-Policy` header string into a map of
|
|
5
|
+
* directive -> sources. Directive names are lowercased; source values keep
|
|
6
|
+
* their original casing.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseCsp(csp: string): CspDirectives;
|
|
9
|
+
/**
|
|
10
|
+
* Load the CSP snapshot bundled with the plugin and parse it.
|
|
11
|
+
*
|
|
12
|
+
* The snapshot is generated from the workbench Static Web App config via
|
|
13
|
+
* `nx run roma:generate-csp`. Reading it from the plugin's own directory keeps
|
|
14
|
+
* the check free of any filesystem dependency on the workbench app.
|
|
15
|
+
*
|
|
16
|
+
* Returns `null` if the snapshot is missing or unparseable, so callers can
|
|
17
|
+
* disable the check gracefully instead of breaking the build.
|
|
18
|
+
*/
|
|
19
|
+
export declare function loadCspDirectives(): CspDirectives | null;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseCsp = parseCsp;
|
|
4
|
+
exports.loadCspDirectives = loadCspDirectives;
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
/**
|
|
8
|
+
* Parse a `Content-Security-Policy` header string into a map of
|
|
9
|
+
* directive -> sources. Directive names are lowercased; source values keep
|
|
10
|
+
* their original casing.
|
|
11
|
+
*/
|
|
12
|
+
function parseCsp(csp) {
|
|
13
|
+
const directives = {};
|
|
14
|
+
if (!csp)
|
|
15
|
+
return directives;
|
|
16
|
+
for (const segment of csp.split(';')) {
|
|
17
|
+
const tokens = segment.trim().split(/\s+/).filter(Boolean);
|
|
18
|
+
if (tokens.length === 0)
|
|
19
|
+
continue;
|
|
20
|
+
const name = tokens[0].toLowerCase();
|
|
21
|
+
directives[name] = tokens.slice(1);
|
|
22
|
+
}
|
|
23
|
+
return directives;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Load the CSP snapshot bundled with the plugin and parse it.
|
|
27
|
+
*
|
|
28
|
+
* The snapshot is generated from the workbench Static Web App config via
|
|
29
|
+
* `nx run roma:generate-csp`. Reading it from the plugin's own directory keeps
|
|
30
|
+
* the check free of any filesystem dependency on the workbench app.
|
|
31
|
+
*
|
|
32
|
+
* Returns `null` if the snapshot is missing or unparseable, so callers can
|
|
33
|
+
* disable the check gracefully instead of breaking the build.
|
|
34
|
+
*/
|
|
35
|
+
function loadCspDirectives() {
|
|
36
|
+
try {
|
|
37
|
+
const snapshotPath = (0, node_path_1.join)(__dirname, 'data', 'generated-csp.json');
|
|
38
|
+
const snapshot = JSON.parse((0, node_fs_1.readFileSync)(snapshotPath, 'utf-8'));
|
|
39
|
+
const csp = snapshot === null || snapshot === void 0 ? void 0 : snapshot.contentSecurityPolicy;
|
|
40
|
+
if (!csp || typeof csp !== 'string')
|
|
41
|
+
return null;
|
|
42
|
+
return parseCsp(csp);
|
|
43
|
+
}
|
|
44
|
+
catch (_a) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=parse-csp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-csp.js","sourceRoot":"","sources":["../../../../../../../plugins/roma/src/executors/utils/csp/parse-csp.ts"],"names":[],"mappings":";;AAWA,4BAYC;AAYD,8CAUC;AA7CD,qCAAuC;AACvC,yCAAiC;AAKjC;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,GAAW;IAClC,MAAM,UAAU,GAAkB,EAAE,CAAC;IACrC,IAAI,CAAC,GAAG;QAAE,OAAO,UAAU,CAAC;IAE5B,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAClC,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAA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