安全修复:加固CSRF与凭证保护并修复越权风险

This commit is contained in:
2026-02-16 01:19:43 +08:00
parent 14b506e8a1
commit 1389ec7434
22 changed files with 375 additions and 83 deletions

View File

@@ -164,11 +164,13 @@ def update_account(account_id):
"""
UPDATE accounts
SET password = ?, remember = ?
WHERE id = ?
WHERE id = ? AND user_id = ?
""",
(encrypted_password, new_remember, account_id),
(encrypted_password, new_remember, account_id, user_id),
)
conn.commit()
if cursor.rowcount <= 0:
return jsonify({"error": "账号不存在或无权限"}), 404
database.reset_account_login_status(account_id)
logger.info(f"[账号更新] 用户 {user_id} 修改了账号 {account.username} 的密码,已重置登录状态")