@salesforce/ui-bundle 12.3.0 → 12.3.2
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/dist/package.json.js +1 -1
- package/dist/proxy/handler.d.ts.map +1 -1
- package/dist/proxy/handler.js +55 -10
- package/package.json +2 -2
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/proxy/handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIjE,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG9D;;GAEG;AACH,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,qBAAqB,gCAAgC,CAAC;AAyBnE;;GAEG;AACH,MAAM,WAAW,YAAY;IAE5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,cAAc,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAC1B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,CAAC,EAAE,MAAM,IAAI,KACb,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/proxy/handler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIjE,OAAO,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAG9D;;GAEG;AACH,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,qBAAqB,gCAAgC,CAAC;AAyBnE;;GAEG;AACH,MAAM,WAAW,YAAY;IAE5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,cAAc,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAC1B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,CAAC,EAAE,MAAM,IAAI,KACb,OAAO,CAAC,IAAI,CAAC,CAAC;AAyuBnB;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,CAAC,EAAE,OAAO,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,YAAY,GACpB,YAAY,CAGd;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5D"}
|
package/dist/proxy/handler.js
CHANGED
|
@@ -17,10 +17,47 @@ class AuthenticationError extends Error {
|
|
|
17
17
|
this.name = "AuthenticationError";
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
const TRUSTED_SUBDOMAIN_TREE_SUFFIXES = [
|
|
21
|
+
// Code Builder (workspace hosts)
|
|
22
|
+
".sf.code-builder.platform.salesforce.com",
|
|
23
|
+
".sf.code-builder-stg.platform.salesforce.com",
|
|
24
|
+
// Dev/test
|
|
25
|
+
".sfdc.cl",
|
|
26
|
+
// OrgFarm / pc-rnd (non-prod)
|
|
27
|
+
".pc-rnd.force.com",
|
|
28
|
+
".pc-rnd.salesforce.com",
|
|
29
|
+
".my.salesforce-setup.com",
|
|
30
|
+
// CRM workspace hosts
|
|
31
|
+
".crm.dev"
|
|
32
|
+
];
|
|
33
|
+
const TRUSTED_ONE_LEVEL_SUBDOMAIN_SUFFIXES = [
|
|
34
|
+
// Lightning (first-party Codey Studio UI)
|
|
35
|
+
".lightning.force.com",
|
|
36
|
+
".sandbox.lightning.force.com",
|
|
37
|
+
".develop.lightning.force.com",
|
|
38
|
+
// Salesforce top-level
|
|
39
|
+
".salesforce.com"
|
|
40
|
+
];
|
|
20
41
|
function isWhitelistedOrigin(origin) {
|
|
21
42
|
try {
|
|
22
|
-
const
|
|
23
|
-
|
|
43
|
+
const hostname = new URL(origin).hostname.toLowerCase();
|
|
44
|
+
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]") {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
for (const suffix of TRUSTED_SUBDOMAIN_TREE_SUFFIXES) {
|
|
48
|
+
if (hostname.endsWith(suffix)) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
for (const suffix of TRUSTED_ONE_LEVEL_SUBDOMAIN_SUFFIXES) {
|
|
53
|
+
if (hostname.endsWith(suffix)) {
|
|
54
|
+
const prefix = hostname.slice(0, -suffix.length);
|
|
55
|
+
if (prefix.length > 0 && !prefix.includes(".")) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
24
61
|
} catch {
|
|
25
62
|
return false;
|
|
26
63
|
}
|
|
@@ -40,16 +77,24 @@ class UIBundleProxyHandler {
|
|
|
40
77
|
options;
|
|
41
78
|
startTime = Date.now();
|
|
42
79
|
async handle(req, res, next) {
|
|
43
|
-
const secFetchSite = req.headers["sec-fetch-site"];
|
|
44
|
-
if (secFetchSite === "cross-site") {
|
|
45
|
-
res.writeHead(403, { "Content-Type": "application/json" });
|
|
46
|
-
res.end(JSON.stringify({ error: "FORBIDDEN", message: "Cross-site request blocked" }));
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
80
|
const origin = req.headers.origin;
|
|
50
|
-
|
|
81
|
+
let samePod = false;
|
|
82
|
+
if (origin) {
|
|
83
|
+
try {
|
|
84
|
+
const originHostname = new URL(origin).hostname.toLowerCase();
|
|
85
|
+
const requestHost = (req.headers.host ?? "").replace(/:\d+$/, "").toLowerCase();
|
|
86
|
+
samePod = originHostname === requestHost;
|
|
87
|
+
} catch {
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (origin && !samePod && !isWhitelistedOrigin(origin)) {
|
|
51
91
|
res.writeHead(403, { "Content-Type": "application/json" });
|
|
52
|
-
res.end(
|
|
92
|
+
res.end(
|
|
93
|
+
JSON.stringify({
|
|
94
|
+
error: "FORBIDDEN",
|
|
95
|
+
message: "Cross-origin request blocked"
|
|
96
|
+
})
|
|
97
|
+
);
|
|
53
98
|
return;
|
|
54
99
|
}
|
|
55
100
|
const url = new URL(req.url ?? "/", `http://${req.headers.host}`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/ui-bundle",
|
|
3
3
|
"description": "Core package for Salesforce UI Bundles",
|
|
4
|
-
"version": "12.3.
|
|
4
|
+
"version": "12.3.2",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@salesforce/core": "^8.23.4",
|
|
42
|
-
"@salesforce/platform-sdk": "^12.3.
|
|
42
|
+
"@salesforce/platform-sdk": "^12.3.2",
|
|
43
43
|
"micromatch": "^4.0.8",
|
|
44
44
|
"path-to-regexp": "^8.4.2"
|
|
45
45
|
},
|