@forge/csp 1.7.0 → 1.8.0-next.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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # @forge/csp
2
2
 
3
+ ## 1.8.0-next.1
4
+
5
+ ### Minor Changes
6
+
7
+ - f002362: Revert change for deprecated CSP
8
+
9
+ ## 1.8.0-next.0
10
+
11
+ ### Minor Changes
12
+
13
+ - d5f3fac: Remove deprecated method for handling CSP user config
14
+
15
+ ## 1.7.1
16
+
17
+ ### Patch Changes
18
+
19
+ - 4b41a80: Added egress messaging to install prompts
20
+
21
+ ## 1.7.1-next.0
22
+
23
+ ### Patch Changes
24
+
25
+ - 4b41a80: Added egress messaging to install prompts
26
+
3
27
  ## 1.7.0
4
28
 
5
29
  ### Minor Changes
@@ -1,2 +1,3 @@
1
1
  export * from './egress-filtering-service';
2
+ export * from './utils';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/egress/index.ts"],"names":[],"mappings":"AAEA,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/egress/index.ts"],"names":[],"mappings":"AAEA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC"}
@@ -2,3 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./egress-filtering-service"), exports);
5
+ tslib_1.__exportStar(require("./utils"), exports);
@@ -0,0 +1,3 @@
1
+ declare const sortAndGroupEgressPermissionsByDomain: (egressAddresses: string[]) => Array<string>;
2
+ export { sortAndGroupEgressPermissionsByDomain };
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/egress/utils.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,qCAAqC,oBAAqB,MAAM,EAAE,KAAG,KAAK,CAAC,MAAM,CA2BtF,CAAC;AAEF,OAAO,EAAE,qCAAqC,EAAE,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sortAndGroupEgressPermissionsByDomain = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const micromatch_1 = tslib_1.__importDefault(require("micromatch"));
6
+ const url_1 = require("url");
7
+ const sortAndGroupEgressPermissionsByDomain = (egressAddresses) => {
8
+ const protocolRegex = /^(.*?:\/\/)/;
9
+ const domainSet = new Set();
10
+ const groupSet = new Set();
11
+ const removeSet = new Set();
12
+ if ((egressAddresses === null || egressAddresses === void 0 ? void 0 : egressAddresses.length) === 0) {
13
+ return [];
14
+ }
15
+ egressAddresses.forEach((item) => {
16
+ const itemWithProtocol = protocolRegex.test(item) ? item : `https://${item}`;
17
+ const url = new url_1.URL(itemWithProtocol);
18
+ if (url.hostname.startsWith('*')) {
19
+ groupSet.add(url.hostname.substring(2));
20
+ removeSet.add('!' + url.hostname);
21
+ }
22
+ else {
23
+ domainSet.add(url.hostname);
24
+ }
25
+ });
26
+ if (removeSet.size === 0) {
27
+ return [...domainSet];
28
+ }
29
+ return [...new Set(micromatch_1.default([...domainSet], [...removeSet]).concat([...groupSet]))].sort();
30
+ };
31
+ exports.sortAndGroupEgressPermissionsByDomain = sortAndGroupEgressPermissionsByDomain;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/csp",
3
- "version": "1.7.0",
3
+ "version": "1.8.0-next.1",
4
4
  "description": "Contains the CSP configuration for Custom UI resources in Forge",
5
5
  "main": "out/index.js",
6
6
  "author": "Atlassian",
@@ -11,8 +11,8 @@
11
11
  "clean": "rm -rf ./out && rm -f tsconfig.tsbuildinfo"
12
12
  },
13
13
  "devDependencies": {
14
- "@forge/cli-shared": "^1.4.0",
15
- "@forge/manifest": "^1.5.0",
14
+ "@forge/cli-shared": "^2.1.2-next.1",
15
+ "@forge/manifest": "^2.2.1-next.1",
16
16
  "@types/jest": "^26.0.0"
17
17
  },
18
18
  "dependencies": {