@forge/tunnel 0.0.0-experimental-c3effe3 → 0.0.0-experimental-9489df9

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,19 +1,116 @@
1
1
  # @forge/tunnel
2
2
 
3
- ## 0.0.0-experimental-c3effe3
3
+ ## 0.0.0-experimental-9489df9
4
4
 
5
- ### Minor Changes
5
+ ### Patch Changes
6
+
7
+ - @forge/cli-shared@0.0.0-experimental-9489df9
8
+ - @forge/bundler@0.0.0-experimental-9489df9
9
+ - @forge/runtime@0.0.0-experimental-9489df9
10
+
11
+ ## 1.8.4-next.4
12
+
13
+ ### Patch Changes
14
+
15
+ - @forge/cli-shared@2.6.2-next.4
16
+ - @forge/bundler@3.0.11-next.4
17
+
18
+ ## 1.8.4-next.3
19
+
20
+ ### Patch Changes
21
+
22
+ - @forge/cli-shared@2.6.2-next.3
23
+ - @forge/bundler@3.0.11-next.3
24
+
25
+ ## 1.8.4-next.2
26
+
27
+ ### Patch Changes
28
+
29
+ - @forge/cli-shared@2.6.2-next.2
30
+ - @forge/bundler@3.0.11-next.2
31
+
32
+ ## 1.8.4-next.1
33
+
34
+ ### Patch Changes
35
+
36
+ - @forge/cli-shared@2.6.2-next.1
37
+ - @forge/bundler@3.0.11-next.1
38
+
39
+ ## 1.8.4-next.0
40
+
41
+ ### Patch Changes
42
+
43
+ - @forge/cli-shared@2.6.2-next.0
44
+ - @forge/bundler@3.0.11-next.0
45
+
46
+ ## 1.8.3
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies [13f2ae81]
51
+ - @forge/bundler@3.0.10
52
+ - @forge/runtime@2.2.1
53
+ - @forge/cli-shared@2.6.1
54
+
55
+ ## 1.8.3-next.6
56
+
57
+ ### Patch Changes
58
+
59
+ - @forge/cli-shared@2.6.1-next.6
60
+ - @forge/bundler@3.0.10-next.6
61
+
62
+ ## 1.8.3-next.5
63
+
64
+ ### Patch Changes
65
+
66
+ - @forge/cli-shared@2.6.1-next.5
67
+ - @forge/bundler@3.0.10-next.5
68
+
69
+ ## 1.8.3-next.4
70
+
71
+ ### Patch Changes
72
+
73
+ - @forge/cli-shared@2.6.1-next.4
74
+ - @forge/bundler@3.0.10-next.4
75
+
76
+ ## 1.8.3-next.3
77
+
78
+ ### Patch Changes
79
+
80
+ - @forge/cli-shared@2.6.1-next.3
81
+ - @forge/bundler@3.0.10-next.3
82
+
83
+ ## 1.8.3-next.2
84
+
85
+ ### Patch Changes
86
+
87
+ - Updated dependencies [13f2ae81]
88
+ - @forge/bundler@3.0.10-next.2
89
+ - @forge/runtime@2.2.1-next.0
90
+ - @forge/cli-shared@2.6.1-next.2
91
+
92
+ ## 1.8.3-next.1
93
+
94
+ ### Patch Changes
95
+
96
+ - @forge/cli-shared@2.6.1-next.1
97
+ - @forge/bundler@3.0.10-next.1
98
+
99
+ ## 1.8.3-next.0
100
+
101
+ ### Patch Changes
102
+
103
+ - @forge/cli-shared@2.6.1-next.0
104
+ - @forge/bundler@3.0.10-next.0
6
105
 
7
- - 189ba71: Add keytar to shrinkwrap package list
106
+ ## 1.8.2
8
107
 
9
108
  ### Patch Changes
10
109
 
11
110
  - Updated dependencies [69f42bd]
12
111
  - Updated dependencies [e0f6a1c]
13
- - Updated dependencies [189ba71]
14
- - @forge/cli-shared@0.0.0-experimental-c3effe3
15
- - @forge/bundler@0.0.0-experimental-c3effe3
16
- - @forge/runtime@0.0.0-experimental-c3effe3
112
+ - @forge/cli-shared@2.6.0
113
+ - @forge/bundler@3.0.9
17
114
 
18
115
  ## 1.8.2-next.6
19
116
 
@@ -17,6 +17,7 @@ export declare class ResourceTunnelServer {
17
17
  private server;
18
18
  private readonly proxy;
19
19
  private socket;
20
+ private cspReporterServerPort;
20
21
  constructor({ port, key, path, tunnel, permissions, remotes, logger, cspReporterServerPort }: ResourceTunnelServerArgs);
21
22
  getApp(): Express;
22
23
  static transformPermissionsWithRemotes(permissions: Permissions, remotes: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;;;;;;;;;;;;;;IAa3E,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAStB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAc3B,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,gCAAgC;IAoBxC,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,YAAY,CAOJ;IAEhB,OAAO,CAAC,wBAAwB,CAG3B;IAEL,OAAO,CAAC,yBAAyB,CAG5B;IAEL,OAAO,CAAC,6BAA6B,CAwBhC;CACN"}
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const cli_shared_1 = require("@forge/cli-shared");
6
6
  const express_1 = tslib_1.__importDefault(require("express"));
7
7
  const http_proxy_middleware_1 = require("http-proxy-middleware");
8
+ const csp_1 = require("@forge/csp");
8
9
  const express_mung_1 = require("express-mung");
9
10
  var ConnectionErrorCode;
10
11
  (function (ConnectionErrorCode) {
@@ -13,7 +14,9 @@ var ConnectionErrorCode;
13
14
  const HOST = process.env.FORGE_DEV_TUNNEL ? 'localhost' : 'host.docker.internal';
14
15
  class ResourceTunnelServer {
15
16
  constructor({ port, key, path, tunnel, permissions, remotes, logger, cspReporterServerPort }) {
16
- this.getCspHeader = () => '';
17
+ this.getCspHeader = (existingCsp) => new csp_1.CSPInjectionService()
18
+ .getInjectableCSP(existingCsp, cli_shared_1.getEnvironment(cli_shared_1.CDNEnvironments), `http://localhost:${this.cspReporterServerPort}`)
19
+ .join('; ');
17
20
  this.injectGlobalBridgeScript = (htmlContent) => new cli_shared_1.BridgeScriptService().injectBridgeCore(htmlContent, () => {
18
21
  throw new Error('Malformed HTML document');
19
22
  });
@@ -27,13 +30,15 @@ class ResourceTunnelServer {
27
30
  res.removeHeader('content-length');
28
31
  const htmlContentWithIframeResizerScript = this.injectIframeResizerScript(body);
29
32
  const htmlContentWithBridgeScript = this.injectGlobalBridgeScript(htmlContentWithIframeResizerScript);
30
- res.setHeader('Content-Security-Policy', this.getCspHeader());
33
+ const cspDetails = new csp_1.CSPProcessingService({ info: () => { } }).getCspDetails(htmlContentWithBridgeScript, ResourceTunnelServer.transformPermissionsWithRemotes(permissions, remotes));
34
+ res.setHeader('Content-Security-Policy', this.getCspHeader(cspDetails));
31
35
  return htmlContentWithBridgeScript;
32
36
  });
33
37
  this.port = port;
34
38
  this.key = key;
35
39
  this.path = path;
36
40
  this.logger = logger;
41
+ this.cspReporterServerPort = cspReporterServerPort;
37
42
  this.app = express_1.default();
38
43
  this.app.use(this.getCustomUIResourceMiddleware(permissions, remotes));
39
44
  if (tunnel) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/tunnel",
3
- "version": "0.0.0-experimental-c3effe3",
3
+ "version": "0.0.0-experimental-9489df9",
4
4
  "description": "Tunnel functionality for Forge CLI",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -16,10 +16,11 @@
16
16
  "postbuild": "chmod +x out/*.js"
17
17
  },
18
18
  "dependencies": {
19
- "@forge/bundler": "0.0.0-experimental-c3effe3",
20
- "@forge/cli-shared": "0.0.0-experimental-c3effe3",
19
+ "@forge/bundler": "0.0.0-experimental-9489df9",
20
+ "@forge/cli-shared": "0.0.0-experimental-9489df9",
21
+ "@forge/csp": "^1.11.0",
21
22
  "@forge/isolated-vm": "3.3.10",
22
- "@forge/runtime": "0.0.0-experimental-c3effe3",
23
+ "@forge/runtime": "0.0.0-experimental-9489df9",
23
24
  "express": "^4.17.1",
24
25
  "express-mung": "^0.5.1",
25
26
  "http-proxy-middleware": "^1.0.6",
@@ -30,7 +31,7 @@
30
31
  "uuid": "^3.4.0"
31
32
  },
32
33
  "devDependencies": {
33
- "@forge/manifest": "^0.0.0-experimental-c3effe3",
34
+ "@forge/manifest": "^0.0.0-experimental-9489df9",
34
35
  "@types/express": "^4.17.2",
35
36
  "@types/express-mung": "^0.5.2",
36
37
  "@types/jest": "^26.0.0",
@@ -43,6 +44,6 @@
43
44
  "supertest": "^6.1.3"
44
45
  },
45
46
  "optionalDependencies": {
46
- "keytar": "^7.9.0"
47
+ "keytar": "^7.0.0"
47
48
  }
48
49
  }