@forge/egress 1.1.3-next.0 → 1.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 +16 -0
- package/out/egress/egress-filtering-service.d.ts.map +1 -1
- package/out/egress/egress-filtering-service.js +3 -3
- package/out/egress/url-parser.d.ts +3 -0
- package/out/egress/url-parser.d.ts.map +1 -0
- package/out/egress/url-parser.js +10 -0
- package/out/egress/utils.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @forge/egress
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3bdedf0: Fix URL-constructor in Firefox browsers
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 0da2b48: Removed support for the CLI running on node 14
|
|
12
|
+
|
|
13
|
+
## 1.2.0-next.1
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 3bdedf0: Fix URL-constructor in Firefox browsers
|
|
18
|
+
|
|
3
19
|
## 1.1.3-next.0
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"egress-filtering-service.d.ts","sourceRoot":"","sources":["../../src/egress/egress-filtering-service.ts"],"names":[],"mappings":"AAGA,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"egress-filtering-service.d.ts","sourceRoot":"","sources":["../../src/egress/egress-filtering-service.ts"],"names":[],"mappings":"AAGA,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAY;IAC5C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAU;IAC3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAc;gBAEnC,SAAS,EAAE,MAAM,EAAE;IAU/B,OAAO,CAAC,QAAQ;IAQT,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IASvC,OAAO,CAAC,aAAa;CAKtB"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EgressFilteringService = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const minimatch_1 = tslib_1.__importDefault(require("minimatch"));
|
|
6
|
-
const
|
|
6
|
+
const url_parser_1 = require("./url-parser");
|
|
7
7
|
class EgressFilteringService {
|
|
8
8
|
constructor(allowList) {
|
|
9
9
|
this.DEFAULT_PROTOCOL = 'https://';
|
|
@@ -16,8 +16,8 @@ class EgressFilteringService {
|
|
|
16
16
|
}
|
|
17
17
|
parseUrl(url) {
|
|
18
18
|
const protocolRegex = /^(.*:\/\/)/;
|
|
19
|
-
const
|
|
20
|
-
return
|
|
19
|
+
const urlWithProtocol = protocolRegex.test(url) ? url : `${this.DEFAULT_PROTOCOL}${url}`;
|
|
20
|
+
return (0, url_parser_1.parseUrl)(urlWithProtocol);
|
|
21
21
|
}
|
|
22
22
|
isValidUrl(url) {
|
|
23
23
|
if (this.allowsEverything) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-parser.d.ts","sourceRoot":"","sources":["../../src/egress/url-parser.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC,CAAC;AAKzD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAK7C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseUrl = void 0;
|
|
4
|
+
function parseUrl(url) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
const protocol = (_b = (_a = url.match(/^(.*:\/\/)/)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : 'https://';
|
|
7
|
+
const hostname = url.replace(protocol, '').split(/[\/?]/)[0];
|
|
8
|
+
return { protocol, hostname };
|
|
9
|
+
}
|
|
10
|
+
exports.parseUrl = parseUrl;
|
package/out/egress/utils.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sortAndGroupEgressPermissionsByDomain = void 0;
|
|
4
4
|
const minimatch_1 = require("minimatch");
|
|
5
|
-
const
|
|
5
|
+
const url_parser_1 = require("./url-parser");
|
|
6
6
|
const sortAndGroupEgressPermissionsByDomain = (egressAddresses) => {
|
|
7
7
|
if ((egressAddresses === null || egressAddresses === void 0 ? void 0 : egressAddresses.length) === 0) {
|
|
8
8
|
return [];
|
|
@@ -12,7 +12,7 @@ const sortAndGroupEgressPermissionsByDomain = (egressAddresses) => {
|
|
|
12
12
|
const wildcardDomains = [];
|
|
13
13
|
egressAddresses.forEach((item) => {
|
|
14
14
|
const itemWithProtocol = protocolRegex.test(item) ? item : `https://${item}`;
|
|
15
|
-
const url =
|
|
15
|
+
const url = (0, url_parser_1.parseUrl)(itemWithProtocol);
|
|
16
16
|
if (url.hostname.startsWith('*')) {
|
|
17
17
|
domains.add(url.hostname.substring(2));
|
|
18
18
|
wildcardDomains.push((0, minimatch_1.makeRe)(url.hostname));
|