fix: закрыть уязвимости (CSRF, rate limit, секреты, CSV-injection, LIKE-экранирование)

This commit is contained in:
2026-08-04 00:03:40 +04:00
parent f55735a59e
commit 0c6740ac53
6 changed files with 53 additions and 11 deletions
+3
View File
@@ -81,6 +81,7 @@
{% if consultation["message"] %}<p class="request-message"><span>Комментарий</span>{{ consultation["message"] }}</p>{% endif %}
<div class="request-actions">
<form class="request-status-form" action="{{ url_for('admin_update_status', request_id=consultation["id"]) }}" method="post">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<label for="status-{{ consultation["id"] }}">Статус</label>
<select id="status-{{ consultation["id"] }}" name="status">{% for status_key, status_label in statuses.items() %}<option value="{{ status_key }}" {% if consultation["status"] == status_key %}selected{% endif %}>{{ status_label }}</option>{% endfor %}</select>
<button class="mini-button" type="submit">Сохранить</button>
@@ -88,11 +89,13 @@
<details class="request-note" {% if consultation["admin_note"] %}open{% endif %}>
<summary>{% if consultation["admin_note"] %}Изменить заметку{% else %}Добавить заметку{% endif %} <span></span></summary>
<form action="{{ url_for('admin_update_note', request_id=consultation["id"]) }}" method="post">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<textarea name="admin_note" rows="2" maxlength="2000" placeholder="Например: перезвонить вечером...">{{ consultation["admin_note"] }}</textarea>
<button class="mini-button" type="submit">Сохранить заметку</button>
</form>
</details>
<form class="request-delete-form" action="{{ url_for('admin_delete_request', request_id=consultation["id"]) }}" method="post" data-confirm="Удалить эту заявку? Восстановить её будет нельзя.">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button class="delete-button" type="submit">Удалить</button>
</form>
</div>
+1
View File
@@ -25,6 +25,7 @@
{% endif %}
{% endwith %}
<form action="{{ url_for('admin_login') }}" method="post" class="admin-login-form">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<label for="password">Пароль администратора</label>
<input id="password" type="password" name="password" placeholder="Введите пароль" autocomplete="current-password" required autofocus>
<button class="button button-primary form-button" type="submit">Войти в панель <span></span></button>
+1
View File
@@ -132,6 +132,7 @@
{% endif %}
{% endwith %}
<form action="{{ url_for('submit_request') }}" method="post">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="form-row">
<label>Ваше имя <span>*</span><input type="text" name="name" placeholder="Например, Мария" required></label>
<label>Как связаться <span>*</span><input type="text" name="contact" placeholder="Телефон или Telegram" required></label>