@forge/csp 2.2.3 → 3.0.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
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @forge/csp
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- f38e3f86: Add support for adding hostname to frame ancestor when getting injectable CSP
|
|
8
|
+
|
|
9
|
+
## 3.0.0-next.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- f38e3f86: Add support for adding hostname to frame ancestor when getting injectable CSP
|
|
14
|
+
|
|
3
15
|
## 2.2.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -6,6 +6,11 @@ export declare class CSPInjectionService {
|
|
|
6
6
|
private getExistingCSPDetails;
|
|
7
7
|
private getConnectSrc;
|
|
8
8
|
private getFrameAncestors;
|
|
9
|
-
getInjectableCSP: (existingCSPDetails
|
|
9
|
+
getInjectableCSP: ({ existingCSPDetails, microsEnv, tunnelCSPReporterUri, hostname }: {
|
|
10
|
+
existingCSPDetails: CSPDetails;
|
|
11
|
+
microsEnv: LambdaEnvironment;
|
|
12
|
+
tunnelCSPReporterUri?: string | undefined;
|
|
13
|
+
hostname?: string | undefined;
|
|
14
|
+
}) => string[];
|
|
10
15
|
}
|
|
11
16
|
//# 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;AAmBvD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,iBAAiB;
|
|
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;AAmBvD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,iBAAiB;IA8BlB,gBAAgB;4BAMD,UAAU;mBACnB,iBAAiB;;;UAG1B,MAAM,EAAE,CAoDV;CACH"}
|
|
@@ -17,10 +17,10 @@ const atlassianImageHosts = {
|
|
|
17
17
|
const gravatarUrl = 'https://secure.gravatar.com';
|
|
18
18
|
class CSPInjectionService {
|
|
19
19
|
constructor() {
|
|
20
|
-
this.getInjectableCSP = (existingCSPDetails, microsEnv, tunnelCSPReporterUri) => {
|
|
20
|
+
this.getInjectableCSP = ({ existingCSPDetails, microsEnv, tunnelCSPReporterUri, hostname }) => {
|
|
21
21
|
const reportUri = tunnelCSPReporterUri || this.getCSPReportUri(microsEnv);
|
|
22
22
|
const defaultSrc = `'self'`;
|
|
23
|
-
const frameAncestors = ["'self'", ...this.getFrameAncestors(microsEnv)].join(' ');
|
|
23
|
+
const frameAncestors = ["'self'", ...this.getFrameAncestors(microsEnv, hostname)].join(' ');
|
|
24
24
|
const frameSrc = ["'self'", ...this.getExistingCSPDetails(types_1.ExternalCspType.FRAME_SRC, existingCSPDetails)].join(' ');
|
|
25
25
|
const fontSrc = ["'self'", ...this.getExistingCSPDetails(types_1.ExternalCspType.FONT_SRC, existingCSPDetails)].join(' ');
|
|
26
26
|
const imgSrc = [
|
|
@@ -90,9 +90,10 @@ class CSPInjectionService {
|
|
|
90
90
|
allowed.push(`https://api.${microsEnv === 'prod' ? '' : 'stg.'}atlassian.com/metal/ingest`);
|
|
91
91
|
return allowed;
|
|
92
92
|
}
|
|
93
|
-
getFrameAncestors(microsEnv) {
|
|
93
|
+
getFrameAncestors(microsEnv, hostname) {
|
|
94
|
+
let frameAncestors = [];
|
|
94
95
|
if (microsEnv === 'dev' || microsEnv === 'stg') {
|
|
95
|
-
|
|
96
|
+
frameAncestors = [
|
|
96
97
|
'*.jira-dev.com',
|
|
97
98
|
'http://localhost:*',
|
|
98
99
|
'*.devbucket.org',
|
|
@@ -102,13 +103,19 @@ class CSPInjectionService {
|
|
|
102
103
|
'*.stg.atlassian.com'
|
|
103
104
|
];
|
|
104
105
|
}
|
|
105
|
-
if (microsEnv === 'fex') {
|
|
106
|
-
|
|
106
|
+
else if (microsEnv === 'fex') {
|
|
107
|
+
frameAncestors = [
|
|
107
108
|
'*.atlassian-fex.net',
|
|
108
109
|
'http://localhost:*'
|
|
109
110
|
];
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
else {
|
|
113
|
+
frameAncestors = ['*.atlassian.net', 'bitbucket.org', '*.jira.com', '*.atlassian.com'];
|
|
114
|
+
}
|
|
115
|
+
if (hostname) {
|
|
116
|
+
frameAncestors.push(hostname);
|
|
117
|
+
}
|
|
118
|
+
return frameAncestors;
|
|
112
119
|
}
|
|
113
120
|
}
|
|
114
121
|
exports.CSPInjectionService = CSPInjectionService;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/csp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Contains the CSP configuration for Custom UI resources in Forge",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"author": "Atlassian",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"clean": "rm -rf ./out && rm -f tsconfig.tsbuildinfo"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@forge/cli-shared": "3.20.
|
|
14
|
+
"@forge/cli-shared": "3.20.1",
|
|
15
15
|
"@forge/manifest": "4.20.2",
|
|
16
16
|
"@types/ignore-walk": "^4.0.1",
|
|
17
17
|
"@types/jest": "^29.5.5",
|