mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
fix(security): explicitly set cache-control 'private' on any page where a header is built
This commit is contained in:
@@ -25,6 +25,8 @@ middleware.buildHeader = helpers.try(async (req, res, next) => {
|
|||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
await require('./index').applyCSRFasync(req, res);
|
await require('./index').applyCSRFasync(req, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.set('cache-control', 'private');
|
||||||
res.locals.config = await controllers.api.loadConfig(req);
|
res.locals.config = await controllers.api.loadConfig(req);
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ middleware.buildHeader = helpers.try(async (req, res, next) => {
|
|||||||
req.logout();
|
req.logout();
|
||||||
return res.redirect('/');
|
return res.redirect('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.loggedIn) {
|
||||||
|
res.set('cache-control', 'private');
|
||||||
|
}
|
||||||
|
|
||||||
res.locals.config = config;
|
res.locals.config = config;
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user