fix: rate limit CMS clients by forwarded address
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions

This commit is contained in:
Do Siki
2026-08-17 17:31:31 +02:00
parent d355ce38a7
commit 278c9a2545
+6
View File
@@ -459,6 +459,12 @@ function securityConfigIsValid() {
} }
function getClientAddress(req) { function getClientAddress(req) {
// The editor only listens on 127.0.0.1; the staging Nginx proxy supplies this header.
// This prevents all remote visitors sharing the proxy address in the rate limiter.
const forwarded = req.headers['x-forwarded-for'];
if (typeof forwarded === 'string' && forwarded.trim()) {
return forwarded.split(',')[0].trim();
}
return req.socket.remoteAddress || 'unknown'; return req.socket.remoteAddress || 'unknown';
} }