fix: полное ревью системы — 15 исправлений безопасности и надёжности
Безопасность: - tests/🆔 скрыть is_correct и explanation для студентов (P0) - SQL injection: limit/offset через placeholder вместо template literal - Stored XSS: stripTags для lesson comments, flashcards, redBook sightings - profile.html: escape e.message в showMsg (XSS через server error) - attachment_url: валидация только /uploads/* путей - requestId: генерировать UUID сервером, не доверять клиенту - register: скрыть token_version из ответа Надёжность: - register: обработка UNIQUE constraint race condition - pet buyBg: re-check баланса внутри транзакции - DB errors: скрыть e.message в testController/questionController/courseController - preferences: лимит 50KB на размер JSON UX: - board.html: debounce 250ms на search input Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1376,7 +1376,7 @@
|
||||
const ini = name.split(' ').slice(0,2).map(w=>w[0]?.toUpperCase()||'').join('')||'LS';
|
||||
document.getElementById('big-avatar').textContent = ini;
|
||||
document.getElementById('nav-avatar').textContent = ini;
|
||||
} catch(e) { showMsg(msg, e.message||'Ошибка','err'); }
|
||||
} catch(e) { showMsg(msg, LS.esc(e.message||'Ошибка'),'err'); }
|
||||
finally { btn.disabled = false; }
|
||||
}
|
||||
|
||||
@@ -1395,7 +1395,7 @@
|
||||
await LS.updateProfile({ currentPassword:cur, newPassword:nw });
|
||||
showMsg(msg,'Пароль изменён <svg class="ic" viewBox="0 0 24 24"><polyline points="20 6 9 17 4 12"/></svg>','ok');
|
||||
['inp-cur-pwd','inp-new-pwd','inp-conf-pwd'].forEach(id => document.getElementById(id).value='');
|
||||
} catch(e) { showMsg(msg, e.message||'Ошибка','err'); }
|
||||
} catch(e) { showMsg(msg, LS.esc(e.message||'Ошибка'),'err'); }
|
||||
finally { btn.disabled = false; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user