[glm-grade=B] fix: dead dashboard WS, corrupted error.log, auth-polling storm, re-auth freeze + CVE bumps
Adversarial audit 2026-08-16 (GLM-5.3 delegate, 2 rounds, 141 tool calls):
P0-1: Dashboard WebSocket (/api/v1/ws) dead on EVERY boot since DC-076.
server.js passed module exports (DependencyManager class, {AutoRestartManager}
namespace, SSLMonitor class) instead of createApp()'s live instances — first
.on() threw ERR_INVALID_ARG_TYPE, catch swallowed it. Fix: app.locals.ctx
exposed in src/app.js; server.js passes all 8 real EventEmitter instances.
P0-2: error.log corrupted since 2026-07-14. errorMiddleware called
logError(FILE, SIZE, path, err, meta) — 5 args into a 3-arg wrapper —
logging 'Error: 5242880' garbage every ~60s and DISCARDING the real error
object. Fix: correct 3-arg call + legacy-shape guard in logErrorWrapper +
~74 log.error sites swept to pass real error objects (AST-verified scope-
safe 71/71, 29/29 modules load clean).
P0-3: auth-polling storm (stranded grade=B commit never landed in prod):
401/403 behind TOTP gate hammered /api/v1/services/status + SSE reconnect
every 2-8s, with misleading direct-probe fallback marking services 'up'.
Fix landed + B-round MEDIUM follow-up: TOTP re-auth success now clears
_dcAuthLost, resumes SSE (new _sseResume clears the latch), and refreshes.
Also: eslintignore static-sites/ (33→0 errors); nodemailer 8→9.0.5 and
sharp 0.33→0.35.3 (3 high CVEs killed; jest green on new majors);
dockerode@5/uuid deferred (semver-major, Docker API surface).
Verification: 80/80 suites, 1837/1837 tests; ESLint 0 errors/743 warnings;
node --check all changed files; bundles rebuilt + SW cache bumped.
Judges: Codex quota-dead until Aug 19 (verified live) — GLM adversarial
delegate per operator directive 2026-08-07. Round 1: 98-call mechanical
verification (timed out pre-verdict). Round 2 (this grade): B, one MEDIUM
(re-auth freeze) — fixed in this commit as prescribed.
This commit is contained in:
@@ -318,7 +318,7 @@ async function createApp() {
|
||||
const { writeJsonFile } = require('./utilities/fs-helpers');
|
||||
await writeJsonFile(config.TOTP_CONFIG_FILE, totpConfig);
|
||||
} catch (e) {
|
||||
log.error('config', 'Could not save TOTP config', { error: e.message });
|
||||
log.error('config', e, null, { note: 'Could not save TOTP config' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ async function createApp() {
|
||||
ctx.workflowEngine = workflowEngine;
|
||||
log.info('app', 'Workflow engine initialized');
|
||||
} catch (err) {
|
||||
log.error('app', 'Failed to initialize workflow engine', { error: err.message });
|
||||
log.error('app', err, null, { note: 'Failed to initialize workflow engine' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,12 +501,12 @@ async function createApp() {
|
||||
if (ctx.notification && ctx.resourceMonitor) {
|
||||
ctx.resourceMonitor.on('alert', (alertData) => {
|
||||
ctx.notification.sendAlert(alertData).catch(err => {
|
||||
log.error('notification', 'Failed to send alert', { error: err.message });
|
||||
log.error('notification', err, null, { note: 'Failed to send alert' });
|
||||
});
|
||||
});
|
||||
ctx.resourceMonitor.on('auto-restart', (data) => {
|
||||
ctx.notification.sendServiceEvent('auto-restart', data).catch(err => {
|
||||
log.error('notification', 'Failed to send auto-restart notification', { error: err.message });
|
||||
log.error('notification', err, null, { note: 'Failed to send auto-restart notification' });
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -514,12 +514,12 @@ async function createApp() {
|
||||
if (ctx.notification && ctx.backupManager) {
|
||||
ctx.backupManager.on('backup-complete', (data) => {
|
||||
ctx.notification.send('backup-complete', data).catch(err => {
|
||||
log.error('notification', 'Failed to send backup-complete', { error: err.message });
|
||||
log.error('notification', err, null, { note: 'Failed to send backup-complete' });
|
||||
});
|
||||
});
|
||||
ctx.backupManager.on('backup-failed', (data) => {
|
||||
ctx.notification.send('backup-failed', data).catch(err => {
|
||||
log.error('notification', 'Failed to send backup-failed', { error: err.message });
|
||||
log.error('notification', err, null, { note: 'Failed to send backup-failed' });
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1097,6 +1097,10 @@ async function createApp() {
|
||||
app.use('/api', notFoundHandler);
|
||||
app.use(errorMiddleware);
|
||||
|
||||
// Expose ctx on the app for entry points (server.js dashboard-WS wiring)
|
||||
// without changing the returned shape for existing callers/tests.
|
||||
app.locals.ctx = ctx;
|
||||
|
||||
return { app, log, config: config.siteConfig, licenseManager };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user