@flowfuse/nr-launcher 2.32.1 → 2.32.2-26137df-202607301241.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.
|
@@ -77,6 +77,7 @@ module.exports = {
|
|
|
77
77
|
passport = new Passport()
|
|
78
78
|
httpNodeApp = app
|
|
79
79
|
|
|
80
|
+
const crossSiteCookie = (options.baseURL || '').startsWith('https://')
|
|
80
81
|
httpNodeApp.use(session({
|
|
81
82
|
// As the session is only used across the life-span of an auth
|
|
82
83
|
// hand-shake, we can use a instance specific random string
|
|
@@ -85,7 +86,8 @@ module.exports = {
|
|
|
85
86
|
saveUninitialized: false,
|
|
86
87
|
store: new MemoryStore({
|
|
87
88
|
checkPeriod: 86400000 // prune expired entries every 24h
|
|
88
|
-
})
|
|
89
|
+
}),
|
|
90
|
+
cookie: crossSiteCookie ? { sameSite: 'none', secure: true, partitioned: true } : {}
|
|
89
91
|
}))
|
|
90
92
|
|
|
91
93
|
app.use(passport.initialize())
|
package/lib/runtimeSettings.js
CHANGED
|
@@ -68,13 +68,16 @@ function getSettingsFile (settings) {
|
|
|
68
68
|
if (settings.settings.dashboardUI !== undefined) {
|
|
69
69
|
dashboardSettings.push(`path: '${settings.settings.dashboardUI}'`)
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
dashboardSettings.push('middleware: flowforgeAuthMiddleware')
|
|
75
|
-
} else if (!authMiddlewareRequired && settings.settings.dashboardIFrame) {
|
|
76
|
-
dashboardSettings.push('middleware: [ DashboardIFrameMiddleware ]')
|
|
71
|
+
const middlewares = []
|
|
72
|
+
if (authMiddlewareRequired) {
|
|
73
|
+
middlewares.push('...flowforgeAuthMiddleware')
|
|
77
74
|
}
|
|
75
|
+
if (settings.settings.dashboardIFrame) {
|
|
76
|
+
middlewares.push('DashboardIFrameMiddleware')
|
|
77
|
+
} else {
|
|
78
|
+
middlewares.push('DashboardCSPMiddleware')
|
|
79
|
+
}
|
|
80
|
+
dashboardSettings.push(`middleware: [ ${middlewares.join(', ')} ]`)
|
|
78
81
|
if (settings.settings.apiMaxLength) {
|
|
79
82
|
try {
|
|
80
83
|
dashboardSettings.push(`maxHttpBufferSize: ${bytes(settings.settings.apiMaxLength)}`)
|
|
@@ -349,6 +352,10 @@ function getSettingsFile (settings) {
|
|
|
349
352
|
|
|
350
353
|
const settingsTemplate = `
|
|
351
354
|
${projectSettings.setupAuthMiddleware}
|
|
355
|
+
const DashboardCSPMiddleware = async function(req,res,next) {
|
|
356
|
+
res.set("Content-Security-Policy", "frame-ancestors 'self' ${settings.forgeURL}");
|
|
357
|
+
next()
|
|
358
|
+
}
|
|
352
359
|
const DashboardIFrameMiddleware = async function(req,res,next) {
|
|
353
360
|
res.set("Content-Security-Policy", "frame-ancestors *");
|
|
354
361
|
next()
|