Commit Graph

2 Commits

Author SHA1 Message Date
ogt
38586deff1 security: harden alert_routes.py — auth coverage + input validation
All checks were successful
CD Pipeline / deploy (push) Successful in 1m19s
Issues fixed:

1. [CRITICAL] /api/alert/fix unauthenticated (CWE-306)
   POST /api/alert/fix had no @check_alert_auth and was CSRF-exempt.
   Any unauthenticated caller could trigger docker restart or
   docker exec on arbitrary container names (container_name is validated
   by is_valid_container_name but restart of any valid name is still
   a DoS vector). Fix: @check_alert_auth added.

2. [HIGH] Hardcoded ALERT_WEBHOOK_PASSWORD fallback (CWE-798)
   Default 'wooo_alert_2026' exposed in source. Fix: default='',
   startup warning if unset. check_alert_auth now fail-secure:
   returns 503 if password not configured.

3. [MEDIUM] /api/alert/history and /api/alert/analyze unauthenticated
   Both endpoints expose container names, memory usage, CPU stats,
   system recommendations. Fix: @check_alert_auth added to both.

4. [MEDIUM] issue_type unvalidated in manual_fix (CWE-20)
   Any string value could be passed through to auto_fix_container.
   Fix: ALLOWED_ISSUE_TYPES frozenset — only memory/cpu variants allowed.

5. [LOW] limit parameter unbounded in get_alert_history
   Arbitrarily large limit → large list slice → memory pressure.
   Fix: clamped to [1, 200].

NOTE: L177 docker stats command (original report) is SAFE as-is —
list argv, fixed arguments, no user input. nosec B603 correctly placed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 05:49:04 +08:00
ogt
1b4f3a7bbe feat: EwoooC 初始化 — 完整專案推版至 Gitea
Some checks failed
CD Pipeline / deploy (push) Failing after 59s
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml)
- 部署模式: rsync Python 檔案至 188 → docker restart (volume mount)
- Dockerfile/requirements 變動時自動重建 Docker image
- 部署通知: Telegram (開始/成功/失敗)
- 健康檢查: https://mo.wooo.work/health (最多 5 次重試)
- 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 01:21:13 +08:00