autosnippet 2.19.6 → 2.19.7
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/http/HttpServer.js +15 -2
- package/package.json +1 -1
package/lib/http/HttpServer.js
CHANGED
|
@@ -123,8 +123,21 @@ export class HttpServer {
|
|
|
123
123
|
this.app.use(this.performanceMonitor.middleware());
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
//
|
|
127
|
-
this.app.use(helmet(
|
|
126
|
+
// 安全头(放宽 CSP 以兼容 Vite 构建的 Dashboard SPA:script/style 需要内联和 crossorigin)
|
|
127
|
+
this.app.use(helmet({
|
|
128
|
+
contentSecurityPolicy: {
|
|
129
|
+
directives: {
|
|
130
|
+
defaultSrc: ["'self'"],
|
|
131
|
+
scriptSrc: ["'self'", "'unsafe-inline'"],
|
|
132
|
+
styleSrc: ["'self'", "'unsafe-inline'", "https:"],
|
|
133
|
+
imgSrc: ["'self'", "data:", "blob:"],
|
|
134
|
+
connectSrc: ["'self'", "ws:", "wss:"],
|
|
135
|
+
fontSrc: ["'self'", "https:", "data:"],
|
|
136
|
+
objectSrc: ["'none'"],
|
|
137
|
+
frameSrc: ["'none'"],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
}));
|
|
128
141
|
|
|
129
142
|
// 请求日志
|
|
130
143
|
this.app.use(requestLogger(this.logger));
|