fix: make CMS publish environment explicit
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:25:51 +02:00
parent ea00a136ac
commit d355ce38a7
2 changed files with 6 additions and 4 deletions
+5 -4
View File
@@ -450,11 +450,12 @@ if (toast) setTimeout(() => toast.remove(), 3500);
const CMS_USER = process.env.CMS_USER;
const CMS_PASS = process.env.CMS_PASS;
const CMS_DEPLOY_ENV = process.env.CMS_DEPLOY_ENV;
const CSRF_TOKEN = process.env.CMS_CSRF_TOKEN || crypto.randomBytes(32).toString('hex');
const rateLimits = new Map();
function securityConfigIsValid() {
return Boolean(CMS_USER && CMS_PASS);
return Boolean(CMS_USER && CMS_PASS && ['staging', 'production'].includes(CMS_DEPLOY_ENV));
}
function getClientAddress(req) {
@@ -595,8 +596,8 @@ const server = http.createServer(async (req, res) => {
res.end(JSON.stringify({ ok: false, error: stderr || stdout || error.message }));
}
} else {
// If a deploy.sh script exists, run it optionally in background
exec('cd ../../../ && ./deploy.sh production > deploy.log 2>&1 &');
// Deploy only the explicitly configured environment; never default to production.
exec(`cd ../../../ && ./deploy.sh ${CMS_DEPLOY_ENV} > deploy.log 2>&1 &`);
writeAudit('publish_finished', { clientAddress, user: CMS_USER, result: 'ok' });
res.end(JSON.stringify({ ok: true, output: stdout }));
}
@@ -619,7 +620,7 @@ const server = http.createServer(async (req, res) => {
if (require.main === module) {
if (!securityConfigIsValid()) {
throw new Error('CMS_USER és CMS_PASS nélkül a Content Editor nem indítható el.');
throw new Error('CMS_USER, CMS_PASS és érvényes CMS_DEPLOY_ENV nélkül a Content Editor nem indítható el.');
}
server.listen(PORT, '127.0.0.1', () => {
console.log(`\n✅ mozdIT Content Editor fut: http://localhost:${PORT}\n`);
+1
View File
@@ -4,6 +4,7 @@ const assert = require('assert/strict');
process.env.CMS_USER = 'test-editor';
process.env.CMS_PASS = 'not-a-real-secret';
process.env.CMS_DEPLOY_ENV = 'staging';
const {
hasValidCredentials,
hasValidCsrfToken,