fix(server): DC-058 close 3 P0 bugs — restore.js missing dep, dns.js ok ref, dead /billing/checkout
CI / Test & Lint (push) Has been cancelled
CI / Security audit (push) Has been cancelled

1. routes/apps/restore.js: backupManager was being passed by the
   aggregator (routes/apps/index.js:58) but never destructured in the
   factory signature. Every apps/restore request 500'd with
   ReferenceError. Added backupManager to the destructure + an explicit
   throw if missing so the next regression surfaces at startup instead
   of at the first call.

2. routes/dns.js:555: file imports { success, error } from
   ../src/utils/responses but used ok(res, ...) (defunct alias). DNS
   credential save path 500'd. Changed to success() to match the rest
   of the file.

3. src/utilities/middleware.js: deleted /api/v1/billing/checkout from
   PUBLIC_ROUTES — dead entry, no route mounted. Drift test caught it
   (DC-017 guard). Updated the comment to cover both checkout + webhook
   as removed.

Tests: 1428/1428 pass (drift test now green).
Lint: 0 no-undef errors across src/ + routes/ (was 7).

Refs: DashCaddy audit 2026-08-02
This commit is contained in:
Hermes
2026-08-03 00:43:34 -07:00
parent f89079804c
commit 1c02131fe0
3 changed files with 7 additions and 7 deletions
+2 -1
View File
@@ -21,7 +21,8 @@ const DEFAULT_BACKUP_DIR = process.env.BACKUP_DIR || path.join(__dirname, '..',
* @param {Function} deps.buildServiceUrl - Service URL builder
* @returns {express.Router}
*/
module.exports = function({ docker, caddy, servicesStateManager, asyncHandler, errorResponse, log, helpers, APP_TEMPLATES, dns, buildServiceUrl }) {
module.exports = function({ docker, caddy, servicesStateManager, asyncHandler, errorResponse, log, helpers, APP_TEMPLATES, dns, buildServiceUrl, backupManager }) {
if (!backupManager) throw new Error('routes/apps/restore: backupManager dependency is required');
const router = express.Router();
const ctx = {
+1 -1
View File
@@ -552,7 +552,7 @@ module.exports = function({
}
}
return ok(res, {
return success(res, {
message: anySuccess ? 'Credentials saved for one or more servers' : 'All server credential tests failed',
results
});