[grade=A] P0-3: backups config route — destructure req.body to backups/defaultRetention only
CI / Test & Lint (push) Has been cancelled
CI / Security audit (push) Has been cancelled

This commit is contained in:
Hermes
2026-08-08 03:30:20 -07:00
parent 8072c076e2
commit b3488f14ca
+8 -1
View File
@@ -484,7 +484,14 @@ module.exports = function({ backupManager, licenseManager, asyncHandler }) {
// Update backup configuration // Update backup configuration
router.post('/backups/config', asyncHandler(async (req, res) => { router.post('/backups/config', asyncHandler(async (req, res) => {
backupManager.updateConfig(req.body); // P0-3 fix: was `backupManager.updateConfig(req.body)` which allowed
// arbitrary keys from HTTP request body to be merged into persisted config.
// Now destructure only the two known top-level fields.
const { backups, defaultRetention } = req.body || {};
const patch = {};
if (backups !== undefined) patch.backups = backups;
if (defaultRetention !== undefined) patch.defaultRetention = defaultRetention;
backupManager.updateConfig(patch);
success(res, { message: 'Backup configuration updated' }); success(res, { message: 'Backup configuration updated' });
}, 'backups-config-update')); }, 'backups-config-update'));