Hub 2.3.3: refuse server settings the apps can't start with
TRUST_PROXY=TRUE made an Events install build for minutes, then crash at startup. Saving a server's configuration now refuses it, and installs and updates are refused (CONFIG_INVALID) while an older saved configuration has one. Contracts 1.6.0 vendored (agent.checkEnvValue / invalidValues). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
const express = require('express');
|
||||
const { agent } = require('@crosscode/contracts');
|
||||
const prisma = require('../config/db');
|
||||
const { protect } = require('../middleware/auth');
|
||||
const { audit } = require('../utils/audit');
|
||||
@@ -119,6 +120,9 @@ router.put('/servers/:id/config', wrap(async (req, res) => {
|
||||
const current = servers.serverConfig(s);
|
||||
const next = {};
|
||||
for (const [k, v] of Object.entries(req.body?.values || {})) next[k] = v === MASK ? current[k] : v;
|
||||
// A value the apps can't start with (TRUST_PROXY=TRUE crashed Events after a whole build).
|
||||
const invalid = agent.invalidValues(next);
|
||||
if (Object.keys(invalid).length) throw Object.assign(bad(Object.values(invalid).join(' ')), { code: 'CONFIG_INVALID' });
|
||||
const saved = await servers.setServerConfig(s.id, next);
|
||||
await audit(req, 'server_config_changed', s.id, { keys: Object.keys(saved) });
|
||||
res.json({ config: masked(saved) });
|
||||
|
||||
Reference in New Issue
Block a user