@forge/egress 1.2.13 → 1.3.0-experimental-62518dd
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/LICENSE.txt +7 -0
- package/out/egress/egress-filtering-service.js +3 -0
- package/out/egress/url-parser.js +1 -2
- package/out/egress/utils.d.ts +29 -1
- package/out/egress/utils.d.ts.map +1 -1
- package/out/egress/utils.js +38 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @forge/egress
|
|
2
2
|
|
|
3
|
+
## 1.3.0-experimental-62518dd
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 62518dd: Update licese for Forge public packages
|
|
8
|
+
|
|
9
|
+
## 1.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 2e198f0: Adding new logic to retrieve egress permissions from a list of duplicates and with override filters
|
|
14
|
+
|
|
15
|
+
## 1.3.0-next.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 2e198f0: Adding new logic to retrieve egress permissions from a list of duplicates and with override filters
|
|
20
|
+
|
|
3
21
|
## 1.2.13
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright (c) 2024 Atlassian
|
|
2
|
+
Permission is hereby granted to use this software in accordance with the terms
|
|
3
|
+
and conditions outlined in the Atlassian Developer Terms, which can be found
|
|
4
|
+
at the following URL:
|
|
5
|
+
https://developer.atlassian.com/platform/marketplace/atlassian-developer-terms/
|
|
6
|
+
By using this software, you agree to comply with these terms and conditions.
|
|
7
|
+
If you do not agree with these terms, you are not permitted to use this software.
|
|
@@ -4,6 +4,9 @@ exports.EgressFilteringService = void 0;
|
|
|
4
4
|
const minimatch_1 = require("minimatch");
|
|
5
5
|
const url_parser_1 = require("./url-parser");
|
|
6
6
|
class EgressFilteringService {
|
|
7
|
+
URLs;
|
|
8
|
+
wildcardDomains;
|
|
9
|
+
allowsEverything;
|
|
7
10
|
constructor(allowList) {
|
|
8
11
|
this.URLs = allowList.filter((domainOrURL) => !domainOrURL.startsWith('*')).map((url) => this.parseUrl(url));
|
|
9
12
|
this.wildcardDomains = allowList
|
package/out/egress/url-parser.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseUrl = void 0;
|
|
4
4
|
function parseUrl(url) {
|
|
5
|
-
|
|
6
|
-
const protocol = (_b = (_a = url.match(/^(.*?:)/)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : 'https:';
|
|
5
|
+
const protocol = url.match(/^(.*?:)/)?.[0] ?? 'https:';
|
|
7
6
|
const hostname = url
|
|
8
7
|
.replace(protocol, '')
|
|
9
8
|
.replace(/^\/*/, '')
|
package/out/egress/utils.d.ts
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
1
|
declare const sortAndGroupEgressPermissionsByDomain: (egressAddresses: string[]) => Array<string>;
|
|
2
|
-
export
|
|
2
|
+
export declare enum EgressType {
|
|
3
|
+
FetchBackendSide = "FETCH_BACKEND_SIDE",
|
|
4
|
+
FetchClientSide = "FETCH_CLIENT_SIDE",
|
|
5
|
+
Fonts = "FONTS",
|
|
6
|
+
Frames = "FRAMES",
|
|
7
|
+
Images = "IMAGES",
|
|
8
|
+
Media = "MEDIA",
|
|
9
|
+
Navigation = "NAVIGATION",
|
|
10
|
+
Scripts = "SCRIPTS",
|
|
11
|
+
Styles = "STYLES"
|
|
12
|
+
}
|
|
13
|
+
export declare enum EgressCategory {
|
|
14
|
+
ANALYTICS = "analytics"
|
|
15
|
+
}
|
|
16
|
+
export declare type EgressPermissions = {
|
|
17
|
+
type: EgressType;
|
|
18
|
+
addresses: string[];
|
|
19
|
+
category?: EgressCategory;
|
|
20
|
+
inScopeEUD?: boolean;
|
|
21
|
+
};
|
|
22
|
+
export declare type EgressPermissionsSimplified = Omit<EgressPermissions, 'inScopeEUD' | 'enabled' | 'category'>;
|
|
23
|
+
interface ConfigOverrides {
|
|
24
|
+
ALLOW_EGRESS_ANALYTICS?: boolean;
|
|
25
|
+
}
|
|
26
|
+
declare const getEgressesBasedOnToggles: (input: {
|
|
27
|
+
overrides: ConfigOverrides;
|
|
28
|
+
egress: EgressPermissions[];
|
|
29
|
+
}) => EgressPermissionsSimplified[];
|
|
30
|
+
export { sortAndGroupEgressPermissionsByDomain, getEgressesBasedOnToggles };
|
|
3
31
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/egress/utils.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,qCAAqC,oBAAqB,MAAM,EAAE,KAAG,MAAM,MAAM,CA6BtF,CAAC;AAEF,OAAO,EAAE,qCAAqC,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/egress/utils.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,qCAAqC,oBAAqB,MAAM,EAAE,KAAG,MAAM,MAAM,CA6BtF,CAAC;AAEF,oBAAY,UAAU;IACpB,gBAAgB,uBAAuB;IACvC,eAAe,sBAAsB;IACrC,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,oBAAY,cAAc;IACxB,SAAS,cAAc;CACxB;AAED,oBAAY,iBAAiB,GAAG;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,oBAAY,2BAA2B,GAAG,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;AAEzG,UAAU,eAAe;IACvB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,QAAA,MAAM,yBAAyB,UAAW;IACxC,SAAS,EAAE,eAAe,CAAC;IAC3B,MAAM,EAAE,iBAAiB,EAAE,CAAC;CAC7B,KAAG,2BAA2B,EAqB9B,CAAC;AAEF,OAAO,EAAE,qCAAqC,EAAE,yBAAyB,EAAE,CAAC"}
|
package/out/egress/utils.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sortAndGroupEgressPermissionsByDomain = void 0;
|
|
3
|
+
exports.getEgressesBasedOnToggles = exports.sortAndGroupEgressPermissionsByDomain = exports.EgressCategory = exports.EgressType = void 0;
|
|
4
4
|
const minimatch_1 = require("minimatch");
|
|
5
5
|
const url_parser_1 = require("./url-parser");
|
|
6
6
|
const sortAndGroupEgressPermissionsByDomain = (egressAddresses) => {
|
|
7
|
-
if (
|
|
7
|
+
if (egressAddresses?.length === 0) {
|
|
8
8
|
return [];
|
|
9
9
|
}
|
|
10
10
|
const protocolRegex = /^(.*?:\/\/)/;
|
|
@@ -29,3 +29,39 @@ const sortAndGroupEgressPermissionsByDomain = (egressAddresses) => {
|
|
|
29
29
|
}, []);
|
|
30
30
|
};
|
|
31
31
|
exports.sortAndGroupEgressPermissionsByDomain = sortAndGroupEgressPermissionsByDomain;
|
|
32
|
+
var EgressType;
|
|
33
|
+
(function (EgressType) {
|
|
34
|
+
EgressType["FetchBackendSide"] = "FETCH_BACKEND_SIDE";
|
|
35
|
+
EgressType["FetchClientSide"] = "FETCH_CLIENT_SIDE";
|
|
36
|
+
EgressType["Fonts"] = "FONTS";
|
|
37
|
+
EgressType["Frames"] = "FRAMES";
|
|
38
|
+
EgressType["Images"] = "IMAGES";
|
|
39
|
+
EgressType["Media"] = "MEDIA";
|
|
40
|
+
EgressType["Navigation"] = "NAVIGATION";
|
|
41
|
+
EgressType["Scripts"] = "SCRIPTS";
|
|
42
|
+
EgressType["Styles"] = "STYLES";
|
|
43
|
+
})(EgressType = exports.EgressType || (exports.EgressType = {}));
|
|
44
|
+
var EgressCategory;
|
|
45
|
+
(function (EgressCategory) {
|
|
46
|
+
EgressCategory["ANALYTICS"] = "analytics";
|
|
47
|
+
})(EgressCategory = exports.EgressCategory || (exports.EgressCategory = {}));
|
|
48
|
+
const getEgressesBasedOnToggles = (input) => {
|
|
49
|
+
const filteredEgresses = input.egress.filter((egress) => {
|
|
50
|
+
if (egress.category === EgressCategory.ANALYTICS) {
|
|
51
|
+
return input.overrides.ALLOW_EGRESS_ANALYTICS !== false;
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
});
|
|
55
|
+
const egressByType = new Map();
|
|
56
|
+
for (const egress of filteredEgresses) {
|
|
57
|
+
if (!egressByType.has(egress.type)) {
|
|
58
|
+
egressByType.set(egress.type, egress.addresses);
|
|
59
|
+
}
|
|
60
|
+
egressByType.set(egress.type, [...egressByType.get(egress.type), ...egress.addresses]);
|
|
61
|
+
}
|
|
62
|
+
return [...egressByType.entries()].map(([type, egresses]) => ({
|
|
63
|
+
type,
|
|
64
|
+
addresses: [...new Set(egresses)]
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
exports.getEgressesBasedOnToggles = getEgressesBasedOnToggles;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/egress",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-experimental-62518dd",
|
|
4
4
|
"description": "Helpers and utils for egress implementation in Forge apps",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"author": "Atlassian",
|
|
7
|
-
"license": "
|
|
7
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
8
8
|
"browser": "out/index.js",
|
|
9
9
|
"types": "out/index.d.ts",
|
|
10
10
|
"scripts": {
|