@forge/csp 2.1.4 → 2.1.5-experimental-8802d63

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,31 @@
1
1
  # @forge/csp
2
2
 
3
+ ## 2.1.5-experimental-8802d63
4
+
5
+ ### Major Changes
6
+
7
+ - 2292902: Update CSP injection to include hostname
8
+
9
+ ## 2.1.5
10
+
11
+ ### Patch Changes
12
+
13
+ - 8105c45: Bumping dependencies via Renovate:
14
+
15
+ - @types/jest
16
+ - jest
17
+ - jest-environment-jsdom
18
+
19
+ ## 2.1.5-next.0
20
+
21
+ ### Patch Changes
22
+
23
+ - 8105c45: Bumping dependencies via Renovate:
24
+
25
+ - @types/jest
26
+ - jest
27
+ - jest-environment-jsdom
28
+
3
29
  ## 2.1.4
4
30
 
5
31
  ### Patch Changes
@@ -5,7 +5,13 @@ export declare class CSPInjectionService {
5
5
  private getForgeGlobalCSP;
6
6
  private getExistingCSPDetails;
7
7
  private getConnectSrc;
8
+ private isCurrentHostAllowed;
8
9
  private getFrameAncestors;
9
- getInjectableCSP: (existingCSPDetails: CSPDetails, microsEnv: LambdaEnvironment, tunnelCSPReporterUri?: string) => string[];
10
+ getInjectableCSP: ({ existingCSPDetails, microsEnv, tunnelCSPReporterUri, hostname }: {
11
+ existingCSPDetails: CSPDetails;
12
+ microsEnv: LambdaEnvironment;
13
+ hostname?: string | undefined;
14
+ tunnelCSPReporterUri?: string | undefined;
15
+ }) => string[];
10
16
  }
11
17
  //# sourceMappingURL=csp-injection-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"csp-injection-service.d.ts","sourceRoot":"","sources":["../../src/csp/csp-injection-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAmB,MAAM,UAAU,CAAC;AAUvD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,iBAAiB;IAkBlB,gBAAgB,uBACD,UAAU,aACnB,iBAAiB,yBACL,MAAM,KAC5B,MAAM,EAAE,CAoDT;CACH"}
1
+ {"version":3,"file":"csp-injection-service.d.ts","sourceRoot":"","sources":["../../src/csp/csp-injection-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAmB,MAAM,UAAU,CAAC;AAUvD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,iBAAiB;IA4BlB,gBAAgB;4BAMD,UAAU;mBACnB,iBAAiB;;;UAG1B,MAAM,EAAE,CAoDV;CACH"}
@@ -10,10 +10,10 @@ const atlassianImageHosts = {
10
10
  const gravatarUrl = 'https://secure.gravatar.com';
11
11
  class CSPInjectionService {
12
12
  constructor() {
13
- this.getInjectableCSP = (existingCSPDetails, microsEnv, tunnelCSPReporterUri) => {
13
+ this.getInjectableCSP = ({ existingCSPDetails, microsEnv, tunnelCSPReporterUri, hostname }) => {
14
14
  const reportUri = tunnelCSPReporterUri || this.getCSPReportUri(microsEnv);
15
15
  const defaultSrc = `'self'`;
16
- const frameAncestors = ["'self'", ...this.getFrameAncestors(microsEnv)].join(' ');
16
+ const frameAncestors = ["'self'", ...this.getFrameAncestors(microsEnv, hostname)].join(' ');
17
17
  const frameSrc = ["'self'", ...this.getExistingCSPDetails(types_1.ExternalCspType.FRAME_SRC, existingCSPDetails)].join(' ');
18
18
  const fontSrc = ["'self'", ...this.getExistingCSPDetails(types_1.ExternalCspType.FONT_SRC, existingCSPDetails)].join(' ');
19
19
  const imgSrc = [
@@ -83,19 +83,31 @@ class CSPInjectionService {
83
83
  allowed.push(`https://api.${microsEnv === 'prod' ? '' : 'stg.'}atlassian.com/metal/ingest`);
84
84
  return allowed;
85
85
  }
86
- getFrameAncestors(microsEnv) {
86
+ isCurrentHostAllowed(hostname) {
87
+ return true;
88
+ }
89
+ getFrameAncestors(microsEnv, hostname) {
90
+ let frameAncestors = [];
87
91
  if (microsEnv === 'dev' || microsEnv === 'stg') {
88
- return [
92
+ frameAncestors = [
89
93
  '*.jira-dev.com',
90
94
  'http://localhost:*',
91
95
  '*.devbucket.org',
92
96
  'https://staging.bb-inf.net',
93
97
  'https://integration.bb-inf.net',
94
98
  '*.atl-paas.net',
95
- '*.stg.atlassian.com'
99
+ '*.stg.atlassian.com',
100
+ '*.testing.com'
96
101
  ];
97
102
  }
98
- return ['*.atlassian.net', 'bitbucket.org', '*.jira.com', '*.atlassian.com'];
103
+ else {
104
+ frameAncestors = ['*.atlassian.net', 'bitbucket.org', '*.jira.com', '*.atlassian.com'];
105
+ }
106
+ if (hostname && this.isCurrentHostAllowed(hostname)) {
107
+ frameAncestors.push(hostname);
108
+ frameAncestors = [...new Set(frameAncestors)];
109
+ }
110
+ return frameAncestors;
99
111
  }
100
112
  }
101
113
  exports.CSPInjectionService = CSPInjectionService;
@@ -1 +1 @@
1
- {"version":3,"file":"csp-processing-service.d.ts","sourceRoot":"","sources":["../../src/csp/csp-processing-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAS,MAAM,iBAAiB,CAAC;AAK1D,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,YAAY,EAAuB,MAAM,UAAU,CAAC;AAE7F,qBAAa,iBAAkB,SAAQ,KAAK;;CAI3C;AAMD,qBAAa,oBAAoB;IAanB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAXnC,OA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,CAAC,qBAAqB,CAI3B;gBAC2B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAElD,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,GAAG,UAAU;IAoBvE,wBAAwB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,MAAM,EAAE;IASjF,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,2BAA2B;IAgBnC,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,mBAAmB;IAoB3B,OAAO,CAAC,qBAAqB;IAS7B,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,oBAAoB;CAa7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/csp",
3
- "version": "2.1.4",
3
+ "version": "2.1.5-experimental-8802d63",
4
4
  "description": "Contains the CSP configuration for Custom UI resources in Forge",
5
5
  "main": "out/index.js",
6
6
  "author": "Atlassian",
@@ -11,9 +11,9 @@
11
11
  "clean": "rm -rf ./out && rm -f tsconfig.tsbuildinfo"
12
12
  },
13
13
  "devDependencies": {
14
- "@forge/cli-shared": "3.16.0",
15
- "@forge/manifest": "4.17.0",
16
- "@types/jest": "^29.1.2"
14
+ "@forge/cli-shared": "3.17.2-next.6-experimental-8802d63",
15
+ "@forge/manifest": "4.19.1-next.3-experimental-8802d63",
16
+ "@types/jest": "^29.5.3"
17
17
  },
18
18
  "dependencies": {
19
19
  "cheerio": "^0.22.0",