Implement security hardening across frontend, backend, and infrastructure
- nginx: add X-Content-Type-Options, X-Frame-Options, X-XSS-Protection, and Referrer-Policy headers on all responses; rate limit /api/auth/login to 5 req/min per IP (burst 3) to prevent brute force - frontend: add escHtml() utility to api.js; use it on all notes fields across dashboard, log, history, flock, and budget pages to prevent XSS - log.js: fix broken loadRecent() call referencing removed #recent-body element; replaced with loadHistory() from history.js - schemas.py: raise minimum password length from 6 to 10 characters - admin.py: add audit logging for password reset, disable, delete, and impersonate actions; fix impersonate to use named admin param for logging - main.py: add startup env validation — exits with clear error if any required env var is missing; configure structured logging to stdout - docker-compose.yml: add log rotation (10 MB / 3 files) to all services Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,7 @@ function renderTable() {
|
||||
<td>Feed</td>
|
||||
<td>${parseFloat(e.bags)} bags @ ${fmtMoney(e.price_per_bag)}/bag</td>
|
||||
<td>${fmtMoney(total)}</td>
|
||||
<td class="notes">${e.notes || ''}</td>
|
||||
<td class="notes">${escHtml(e.notes)}</td>
|
||||
<td class="actions">
|
||||
<button class="btn btn-ghost btn-sm" onclick="startEditFeed(${e.id})">Edit</button>
|
||||
<button class="btn btn-danger btn-sm" onclick="deleteFeed(${e.id})">Delete</button>
|
||||
@@ -73,7 +73,7 @@ function renderTable() {
|
||||
<td>Other</td>
|
||||
<td>—</td>
|
||||
<td>${fmtMoney(e.total)}</td>
|
||||
<td class="notes">${e.notes || ''}</td>
|
||||
<td class="notes">${escHtml(e.notes)}</td>
|
||||
<td class="actions">
|
||||
<button class="btn btn-ghost btn-sm" onclick="startEditOther(${e.id})">Edit</button>
|
||||
<button class="btn btn-danger btn-sm" onclick="deleteOther(${e.id})">Delete</button>
|
||||
@@ -111,7 +111,7 @@ function startEditFeed(id) {
|
||||
<input type="number" min="0.01" step="0.01" value="${parseFloat(entry.price_per_bag)}" placeholder="price" style="width:80px;">/bag
|
||||
</td>
|
||||
<td>—</td>
|
||||
<td><input type="text" value="${entry.notes || ''}" placeholder="Notes"></td>
|
||||
<td><input type="text" value="${escHtml(entry.notes)}" placeholder="Notes"></td>
|
||||
<td class="actions">
|
||||
<button class="btn btn-primary btn-sm" onclick="saveEditFeed(${id})">Save</button>
|
||||
<button class="btn btn-ghost btn-sm" onclick="renderTable()">Cancel</button>
|
||||
@@ -165,7 +165,7 @@ function startEditOther(id) {
|
||||
<td>Other</td>
|
||||
<td>—</td>
|
||||
<td><input type="number" min="0.01" step="0.01" value="${parseFloat(entry.total)}" style="width:100px;"></td>
|
||||
<td><input type="text" value="${entry.notes || ''}" placeholder="Notes"></td>
|
||||
<td><input type="text" value="${escHtml(entry.notes)}" placeholder="Notes"></td>
|
||||
<td class="actions">
|
||||
<button class="btn btn-primary btn-sm" onclick="saveEditOther(${id})">Save</button>
|
||||
<button class="btn btn-ghost btn-sm" onclick="renderTable()">Cancel</button>
|
||||
|
||||
Reference in New Issue
Block a user