@forge/csp 5.2.0-next.3 → 5.2.0-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,11 @@
1
1
  # @forge/csp
2
2
 
3
+ ## 5.2.0-next.4
4
+
5
+ ### Patch Changes
6
+
7
+ - bafc49d: add fos hosts to getAtlassianImageHost
8
+
3
9
  ## 5.2.0-next.3
4
10
 
5
11
  ### Patch Changes
@@ -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;AAEvD,aAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAIF,aAAK,oBAAoB,GAAG;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,MAAM,CAAC;CAC3B,CAAC;AAEF,aAAK,SAAS,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAsI1D,eAAO,MAAM,qBAAqB,cAAe,iBAAiB,cAAc,SAAS,KAAG,MAAM,EAUjG,CAAC;AAMF,eAAO,MAAM,kCAAkC,UAAiE,CAAC;AAEjH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,aAAa;IA6BrB,OAAO,CAAC,iBAAiB;IAiDlB,gBAAgB;4BAQD,UAAU;mBACnB,iBAAiB;;;;;UAK1B,MAAM,EAAE,CAyEV;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;AAEvD,aAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAIF,aAAK,oBAAoB,GAAG;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,MAAM,CAAC;CAC3B,CAAC;AAEF,aAAK,SAAS,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAoI1D,eAAO,MAAM,qBAAqB,cAAe,iBAAiB,cAAc,SAAS,KAAG,MAAM,EAWjG,CAAC;AAMF,eAAO,MAAM,kCAAkC,UAAiE,CAAC;AAEjH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,aAAa;IA8BrB,OAAO,CAAC,iBAAiB;IAiDlB,gBAAgB;4BAQD,UAAU;mBACnB,iBAAiB;;;;;UAK1B,MAAM,EAAE,CAwEV;CACH"}
@@ -93,16 +93,13 @@ const getAtlassianHost = (hostType, microsEnv, icOptions) => {
93
93
  }
94
94
  return hostMap[microsEnv];
95
95
  };
96
- const getFOSHost = (microsEnv, icOptions) => {
96
+ const getFOSHostDownload = (microsEnv, icOptions) => {
97
97
  const fosHost = getAtlassianHost('ATLASSIAN_FOS_HOST', microsEnv, icOptions);
98
- return [
99
- `${fosHost}/fos-eap/upload/*/`,
100
- `${fosHost}/fos-eap/download/*/`,
101
- `${fosHost}/fop/app/upload/*/`,
102
- `${fosHost}/fop/app/download/*/`,
103
- `${fosHost}/fop/cdn/upload/*/`,
104
- `${fosHost}/fop/cdn/download/*/`
105
- ];
98
+ return [`${fosHost}/fos-eap/download/*/`, `${fosHost}/fop/app/download/*/`, `${fosHost}/fop/cdn/download/*/`];
99
+ };
100
+ const getFOSHostUpload = (microsEnv, icOptions) => {
101
+ const fosHost = getAtlassianHost('ATLASSIAN_FOS_HOST', microsEnv, icOptions);
102
+ return [`${fosHost}/fos-eap/upload/*/`, `${fosHost}/fop/app/upload/*/`, `${fosHost}/fop/cdn/upload/*/`];
106
103
  };
107
104
  const getAtlassianImageHost = (microsEnv, icOptions) => {
108
105
  return [
@@ -112,7 +109,8 @@ const getAtlassianImageHost = (microsEnv, icOptions) => {
112
109
  getAtlassianHost('ATLASSIAN_MEDIA_GATEWAY_HOST', microsEnv, icOptions),
113
110
  getAtlassianHost('ATLASSIAN_EMOJIS_HOST', microsEnv, icOptions),
114
111
  getAtlassianHost('ATLASSIAN_TEAM_AVATAR_HOST', microsEnv, icOptions),
115
- getAtlassianHost('ATLASSIAN_TEAM_HEADER_HOST', microsEnv, icOptions)
112
+ getAtlassianHost('ATLASSIAN_TEAM_HEADER_HOST', microsEnv, icOptions),
113
+ ...getFOSHostDownload(microsEnv, icOptions)
116
114
  ];
117
115
  };
118
116
  exports.getAtlassianImageHost = getAtlassianImageHost;
@@ -128,7 +126,7 @@ class CSPInjectionService {
128
126
  .join(' ');
129
127
  const fontSrc = [
130
128
  "'self'",
131
- ...getFOSHost(microsEnv, icOptions),
129
+ ...getFOSHostDownload(microsEnv, icOptions),
132
130
  ...this.getExistingCSPDetails(types_1.ExternalCspType.FONT_SRC, existingCSPDetails)
133
131
  ].join(' ');
134
132
  const imgSrc = [
@@ -138,7 +136,6 @@ class CSPInjectionService {
138
136
  hostname,
139
137
  ...exports.EXTERNAL_ALLOW_LISTED_IMAGES_HOSTS,
140
138
  ...(0, exports.getAtlassianImageHost)(microsEnv, icOptions),
141
- ...getFOSHost(microsEnv, icOptions),
142
139
  ...this.getExistingCSPDetails(types_1.ExternalCspType.IMG_SRC, existingCSPDetails)
143
140
  ]
144
141
  .filter((a) => a)
@@ -161,14 +158,14 @@ class CSPInjectionService {
161
158
  const scriptSrc = [
162
159
  "'self'",
163
160
  this.getForgeGlobalCSP(microsEnv, isFedRAMP, icOptions),
164
- ...getFOSHost(microsEnv, icOptions),
161
+ ...getFOSHostDownload(microsEnv, icOptions),
165
162
  ...this.getExistingCSPDetails(types_1.ExternalCspType.SCRIPT_SRC, existingCSPDetails)
166
163
  ].join(' ');
167
164
  const styleSrc = [
168
165
  "'self'",
169
166
  hostname,
170
167
  this.getForgeGlobalCSP(microsEnv, isFedRAMP, icOptions),
171
- ...getFOSHost(microsEnv, icOptions),
168
+ ...getFOSHostDownload(microsEnv, icOptions),
172
169
  ...this.getExistingCSPDetails(types_1.ExternalCspType.STYLE_SRC, existingCSPDetails)
173
170
  ]
174
171
  .filter((a) => a)
@@ -226,7 +223,8 @@ class CSPInjectionService {
226
223
  if (fopGeHost) {
227
224
  allowed.push(fopGeHost);
228
225
  }
229
- allowed.push(...getFOSHost(microsEnv, icOptions));
226
+ allowed.push(...getFOSHostDownload(microsEnv, icOptions));
227
+ allowed.push(...getFOSHostUpload(microsEnv, icOptions));
230
228
  return allowed;
231
229
  }
232
230
  getFrameAncestors(microsEnv, hostname, icOptions) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/csp",
3
- "version": "5.2.0-next.3",
3
+ "version": "5.2.0-next.4",
4
4
  "description": "Contains the CSP configuration for Custom UI resources in Forge",
5
5
  "main": "out/index.js",
6
6
  "author": "Atlassian",
@@ -11,8 +11,8 @@
11
11
  "clean": "rm -rf ./out && rm -f tsconfig.tsbuildinfo"
12
12
  },
13
13
  "devDependencies": {
14
- "@forge/cli-shared": "8.8.1-next.1",
15
- "@forge/manifest": "10.8.0-next.1",
14
+ "@forge/cli-shared": "8.8.1-next.3",
15
+ "@forge/manifest": "10.8.0-next.3",
16
16
  "@types/jest": "^29.5.14",
17
17
  "@types/node": "20.19.1",
18
18
  "cheerio": "^1.1.0"