@forge/tunnel 5.10.2-next.2 → 5.10.2-next.4

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,21 @@
1
1
  # @forge/tunnel
2
2
 
3
+ ## 5.10.2-next.4
4
+
5
+ ### Patch Changes
6
+
7
+ - @forge/bundler@4.22.1-next.4
8
+ - @forge/cli-shared@6.9.0-next.3
9
+
10
+ ## 5.10.2-next.3
11
+
12
+ ### Patch Changes
13
+
14
+ - 14a1075: Pass hostname into image csp when tunnelling
15
+ - Updated dependencies [042ef75]
16
+ - @forge/cli-shared@6.9.0-next.2
17
+ - @forge/bundler@4.22.1-next.3
18
+
3
19
  ## 5.10.2-next.2
4
20
 
5
21
  ### Patch Changes
@@ -38,7 +38,7 @@ export declare abstract class ResourceTunnelServer {
38
38
  content?: import("@forge/manifest").Content1 | undefined;
39
39
  };
40
40
  protected logFileServed(reqUrl: string, textDecorator: (input: string) => string): void;
41
- protected getCspHeader: (existingCsp: CSPDetails) => string;
41
+ protected getCspHeader: (existingCsp: CSPDetails, hostname?: string) => string;
42
42
  protected injectGlobalBridgeScript: (htmlContent: Buffer) => Buffer;
43
43
  protected injectIframeResizerScript: (htmlContent: Buffer) => Buffer;
44
44
  protected getCustomUIHtmlTransformMiddleware: (permissions: Permissions, remotes: Remotes) => RequestHandler;
@@ -1 +1 @@
1
- {"version":3,"file":"resource-tunnel-server.d.ts","sourceRoot":"","sources":["../../src/servers/resource-tunnel-server.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,QAAQ,EAMR,MAAM,EAGP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAA6C,MAAM,YAAY,CAAC;AACnF,OAAO,KAAK,E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E,MAAM,KAAK,MAAM,GAAG,IAAI;IAMvF,SAAS,CAAC,YAAY,gBAAiB,UAAU,aAAa,MAAM,KAAG,MAAM,CAQ7D;IAEhB,SAAS,CAAC,wBAAwB,gBAAiB,MAAM,YAGpD;IAEL,SAAS,CAAC,yBAAyB,gBAAiB,MAAM,YAGrD;IAEL,SAAS,CAAC,kCAAkC,gBAAiB,WAAW,uBAAqB,cAAc,CAwBpG;IAEP,SAAS,CAAC,0BAA0B,eAAgB,YAAY,WAI3C,OAAO,QAAQ,QAAQ,QAAQ,YAAY,mBAU9D;CACH"}
@@ -34,11 +34,12 @@ class ResourceTunnelServer {
34
34
  return;
35
35
  this.logger.info(cli_shared_1.LogColor.trace(textDecorator('index.html')));
36
36
  }
37
- getCspHeader = (existingCsp) => new csp_1.CSPInjectionService()
37
+ getCspHeader = (existingCsp, hostname) => new csp_1.CSPInjectionService()
38
38
  .getInjectableCSP({
39
39
  existingCSPDetails: existingCsp,
40
40
  microsEnv: (0, cli_shared_1.getEnvironmentConfig)(cli_shared_1.CDNEnvironments),
41
- tunnelCSPReporterUri: `http://localhost:${this.cspReporterServerPort}`
41
+ tunnelCSPReporterUri: `http://localhost:${this.cspReporterServerPort}`,
42
+ hostname
42
43
  })
43
44
  .join('; ');
44
45
  injectGlobalBridgeScript = (htmlContent) => new cli_shared_1.BridgeScriptService().injectBridgeCore(htmlContent, () => {
@@ -49,13 +50,14 @@ class ResourceTunnelServer {
49
50
  });
50
51
  getCustomUIHtmlTransformMiddleware = (permissions, remotes) => (0, express_intercept_1.responseHandler)()
51
52
  .if((res) => /html/i.test(res.get('content-type')))
52
- .replaceBuffer((body, _, res) => {
53
- if (!res)
53
+ .replaceBuffer((body, req, res) => {
54
+ if (!res || !req)
54
55
  return body;
55
56
  const htmlContentWithIframeResizerScript = this.injectIframeResizerScript(body);
56
57
  const htmlContentWithBridgeScript = this.injectGlobalBridgeScript(htmlContentWithIframeResizerScript);
57
58
  const cspDetails = new csp_1.CSPProcessingService({ info: () => { } }).getCspDetails(htmlContentWithBridgeScript, ResourceTunnelServer.transformPermissionsWithRemotes(permissions, remotes));
58
- res.setHeader('Content-Security-Policy', this.getCspHeader(cspDetails));
59
+ const hostname = req.query.hostname;
60
+ res.setHeader('Content-Security-Policy', this.getCspHeader(cspDetails, hostname));
59
61
  return htmlContentWithBridgeScript;
60
62
  });
61
63
  getI18nResourcesMiddleware = (i18nConfig) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/tunnel",
3
- "version": "5.10.2-next.2",
3
+ "version": "5.10.2-next.4",
4
4
  "description": "Tunnel functionality for Forge CLI",
5
5
  "author": "Atlassian",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
@@ -11,8 +11,8 @@
11
11
  "compile": "tsc -b -v"
12
12
  },
13
13
  "dependencies": {
14
- "@forge/bundler": "4.22.1-next.2",
15
- "@forge/cli-shared": "6.8.1-next.1",
14
+ "@forge/bundler": "4.22.1-next.4",
15
+ "@forge/cli-shared": "6.9.0-next.3",
16
16
  "@forge/csp": "3.7.1-next.0",
17
17
  "@forge/runtime": "5.10.7",
18
18
  "cloudflared": "^0.7.0",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@atlassian/xen-test-util": "^4.2.0",
33
- "@forge/manifest": "9.1.0-next.1",
33
+ "@forge/manifest": "9.1.0-next.2",
34
34
  "@types/express": "^4.17.21",
35
35
  "@types/jest": "^29.5.12",
36
36
  "@types/node": "14.18.63",