@nocobase/server 2.1.24 → 2.1.26
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/lib/gateway/index.js +7 -4
- package/lib/gateway/static-file-security.js +13 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/package.json +17 -17
package/lib/gateway/index.js
CHANGED
|
@@ -362,14 +362,17 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
|
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
const headers = (0, import_static_file_security.getStorageUploadSecurityHeaders)(pathname);
|
|
365
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
366
|
-
res.setHeader(key, value);
|
|
367
|
-
}
|
|
368
365
|
req.url = req.url.substring(APP_PUBLIC_PATH.length + "storage".length);
|
|
369
366
|
await compress(req, res);
|
|
370
367
|
return (0, import_serve_handler.default)(req, res, {
|
|
371
368
|
public: (0, import_utils.resolveStorageRoot)(),
|
|
372
|
-
directoryListing: false
|
|
369
|
+
directoryListing: false,
|
|
370
|
+
headers: [
|
|
371
|
+
{
|
|
372
|
+
source: "**/*",
|
|
373
|
+
headers: Object.entries(headers).map(([key, value]) => ({ key, value }))
|
|
374
|
+
}
|
|
375
|
+
]
|
|
373
376
|
});
|
|
374
377
|
}
|
|
375
378
|
if (pathname.startsWith(APP_PUBLIC_PATH + "dist/")) {
|
|
@@ -42,7 +42,18 @@ __export(static_file_security_exports, {
|
|
|
42
42
|
});
|
|
43
43
|
module.exports = __toCommonJS(static_file_security_exports);
|
|
44
44
|
var import_node_path = __toESM(require("node:path"));
|
|
45
|
-
const ACTIVE_CONTENT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
45
|
+
const ACTIVE_CONTENT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
46
|
+
".htm",
|
|
47
|
+
".html",
|
|
48
|
+
".pdf",
|
|
49
|
+
".svg",
|
|
50
|
+
".svgz",
|
|
51
|
+
".xht",
|
|
52
|
+
".xhtml",
|
|
53
|
+
".xml",
|
|
54
|
+
".xsl",
|
|
55
|
+
".xslt"
|
|
56
|
+
]);
|
|
46
57
|
function stripQueryAndHash(pathname = "") {
|
|
47
58
|
return pathname.split("?")[0].split("#")[0];
|
|
48
59
|
}
|
|
@@ -54,6 +65,7 @@ function hasActiveContentExtension(pathname = "") {
|
|
|
54
65
|
__name(hasActiveContentExtension, "hasActiveContentExtension");
|
|
55
66
|
function getStorageUploadSecurityHeaders(pathname = "") {
|
|
56
67
|
const headers = {
|
|
68
|
+
"Content-Security-Policy": "sandbox",
|
|
57
69
|
"X-Content-Type-Options": "nosniff"
|
|
58
70
|
};
|
|
59
71
|
if (hasActiveContentExtension(pathname)) {
|
package/lib/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './gateway/ws-server';
|
|
|
13
13
|
export { Application as default } from './application';
|
|
14
14
|
export * from './audit-manager';
|
|
15
15
|
export * from './gateway';
|
|
16
|
+
export * from './gateway/static-file-security';
|
|
16
17
|
export * as middlewares from './middlewares';
|
|
17
18
|
export * from './migration';
|
|
18
19
|
export * from './plugin';
|
package/lib/index.js
CHANGED
|
@@ -55,6 +55,7 @@ __reExport(src_exports, require("./gateway/ws-server"), module.exports);
|
|
|
55
55
|
var import_application = require("./application");
|
|
56
56
|
__reExport(src_exports, require("./audit-manager"), module.exports);
|
|
57
57
|
__reExport(src_exports, require("./gateway"), module.exports);
|
|
58
|
+
__reExport(src_exports, require("./gateway/static-file-security"), module.exports);
|
|
58
59
|
var middlewares = __toESM(require("./middlewares"));
|
|
59
60
|
__reExport(src_exports, require("./migration"), module.exports);
|
|
60
61
|
__reExport(src_exports, require("./plugin"), module.exports);
|
|
@@ -85,6 +86,7 @@ var import_helper = require("./helper");
|
|
|
85
86
|
...require("./gateway/ws-server"),
|
|
86
87
|
...require("./audit-manager"),
|
|
87
88
|
...require("./gateway"),
|
|
89
|
+
...require("./gateway/static-file-security"),
|
|
88
90
|
...require("./migration"),
|
|
89
91
|
...require("./plugin"),
|
|
90
92
|
...require("./plugin-manager"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/server",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.26",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,21 +10,21 @@
|
|
|
10
10
|
"@koa/cors": "^5.0.0",
|
|
11
11
|
"@koa/multer": "^3.1.0",
|
|
12
12
|
"@koa/router": "^13.1.0",
|
|
13
|
-
"@nocobase/acl": "2.1.
|
|
14
|
-
"@nocobase/actions": "2.1.
|
|
15
|
-
"@nocobase/ai": "2.1.
|
|
16
|
-
"@nocobase/auth": "2.1.
|
|
17
|
-
"@nocobase/cache": "2.1.
|
|
18
|
-
"@nocobase/data-source-manager": "2.1.
|
|
19
|
-
"@nocobase/database": "2.1.
|
|
20
|
-
"@nocobase/evaluators": "2.1.
|
|
21
|
-
"@nocobase/lock-manager": "2.1.
|
|
22
|
-
"@nocobase/logger": "2.1.
|
|
23
|
-
"@nocobase/resourcer": "2.1.
|
|
24
|
-
"@nocobase/sdk": "2.1.
|
|
25
|
-
"@nocobase/snowflake-id": "2.1.
|
|
26
|
-
"@nocobase/telemetry": "2.1.
|
|
27
|
-
"@nocobase/utils": "2.1.
|
|
13
|
+
"@nocobase/acl": "2.1.26",
|
|
14
|
+
"@nocobase/actions": "2.1.26",
|
|
15
|
+
"@nocobase/ai": "2.1.26",
|
|
16
|
+
"@nocobase/auth": "2.1.26",
|
|
17
|
+
"@nocobase/cache": "2.1.26",
|
|
18
|
+
"@nocobase/data-source-manager": "2.1.26",
|
|
19
|
+
"@nocobase/database": "2.1.26",
|
|
20
|
+
"@nocobase/evaluators": "2.1.26",
|
|
21
|
+
"@nocobase/lock-manager": "2.1.26",
|
|
22
|
+
"@nocobase/logger": "2.1.26",
|
|
23
|
+
"@nocobase/resourcer": "2.1.26",
|
|
24
|
+
"@nocobase/sdk": "2.1.26",
|
|
25
|
+
"@nocobase/snowflake-id": "2.1.26",
|
|
26
|
+
"@nocobase/telemetry": "2.1.26",
|
|
27
|
+
"@nocobase/utils": "2.1.26",
|
|
28
28
|
"@types/decompress": "4.2.7",
|
|
29
29
|
"@types/ini": "^1.3.31",
|
|
30
30
|
"@types/koa-send": "^4.1.3",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"@types/serve-handler": "^6.1.1",
|
|
62
62
|
"@types/ws": "^8.5.5"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "b25700115794487b342ac33a63a1a988c75c112c"
|
|
65
65
|
}
|