Security hardening: token-at-rest, rate limiting, XSS, transactions

- auth: impersonate stores empty data instead of raw cookie; unimpersonate
  issues a fresh session rather than replaying a stored token
- api/index.php: restore rate limiting (10 req/min auth, 120 general)
- nova.js: 401 redirects to login instead of silently returning error;
  escHtml now escapes single quotes to prevent onclick XSS
- accounts: wrap ownership-change 4-write path in beginTransaction/commit;
  restore audit body on account.update
- reseller/user login cards: use $_pname instead of hardcoded 'NovaCPX'

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 07:51:21 +00:00
parent d29b8b9d65
commit 89c9bfdc49
6 changed files with 69 additions and 28 deletions
+8 -1
View File
@@ -97,6 +97,8 @@ match ($action) {
[$id]
);
if (!$acct) Response::error("Account not found", 404);
$db->beginTransaction();
try {
$allowed = ['php_version', 'package_id', 'notes'];
$sets = []; $params = [];
@@ -203,8 +205,13 @@ match ($action) {
}
}
audit('account.update', "account:$id");
$db->commit();
audit('account.update', "account:$id", $body);
Response::success(null, 'Account updated');
} catch (Throwable $e) {
$db->rollBack();
throw $e;
}
})(),
'suspend' => (function() use ($db, $body, $ownerClause) {