Node.js based forum software built for the modern web
feat: warn in the dashboard when a proxy is in front of an untrusting NodeBB (#14872)
palmoni53f479e8d650d
diff --git a/public/language/en-GB/admin/dashboard.json b/public/language/en-GB/admin/dashboard.jsonindex bc14cf5091..e21bef80da 100644--- a/public/language/en-GB/admin/dashboard.json+++ b/public/language/en-GB/admin/dashboard.json@@ -37,6 +37,8 @@"running-in-development": "Forum is running in development mode. The forum may be open to potential vulnerabilities; please contact your system administrator","localhost-warning": "NodeBB is configured with a localhost URL. This should be updated to your actual domain.","url-mismatch-warning": "Admin panel accessed from a URL different from what is configured in config.json. (Requested: %1, Configured: %2)",+ "trust-proxy-warning": "This request arrived through a reverse proxy, but 'trust_proxy' is not enabled in config.json. Every visitor looks like the same IP address to NodeBB.",+ "trust-proxy-tooltip": "Rate limits, IP bans, registration queue matching and unique visitor counts all rely on the client IP address. Set 'trust_proxy' in config.json when NodeBB is behind a proxy that strips or overwrites X-Forwarded-For from untrusted clients.","latest-lookup-failed": "Failed to look up latest available version of NodeBB","notices": "Notices",diff --git a/src/controllers/admin/dashboard.js b/src/controllers/admin/dashboard.jsindex 099ea7b179..e56fd7a714 100644--- a/src/controllers/admin/dashboard.js+++ b/src/controllers/admin/dashboard.js@@ -78,6 +78,14 @@ async function getNotices(req) {});}+ if (req && !nconf.get('trust_proxy') && req.get('x-forwarded-for')) {+ notices.push({+ done: false,+ notDoneText: '[[admin/dashboard:trust-proxy-warning]]',+ tooltip: '[[admin/dashboard:trust-proxy-tooltip]]',+ });+ }+const configuredUrl = nconf.get('url');if (configuredUrl === 'http://localhost:4567') {notices.push({