For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Deliver a static security scan report (SQLi/XSS etc., no business code fixes) and a script to reset sys_user passwords that verify as 111111 to Zkxw@123.
Architecture: Static grep/read audit of backend/app and frontend src trees; findings written to Markdown. Weak-password reset uses bcrypt verify in a one-off Python script; SQL file documents why pure SQL cannot match hashes and points to the script.
Tech Stack: Python 3.9, bcrypt, SQLAlchemy/pymysql via existing backend settings; Markdown reports under docs/.
Spec: docs/superpowers/specs/2026-10-16-security-scan-and-weak-password-design.md
Files:
Create: docs/testing/2026-10-16-security-scan-report.md
[x] Step 1: Search backend for SQL injection patterns
Run from repo root:
rg -n "text\(|execute\(|f[\"'].*(SELECT|INSERT|UPDATE|DELETE)|%\s*\(.*SELECT|\.format\(" backend/app --glob '*.py'
rg -n "sql_template|strategy.*sql|_FORBIDDEN_SQL" backend/app --glob '*.py'
Read each hit that builds or runs SQL with possible user/config input (especially workflow_engine.py SQL approver strategy). Note file:line, risk, suggestion.
rg -n "v-html|innerHTML|document\.write|eval\(|new Function" web-admin/src mobile-oa-h5/src mobile-h5 miniprogram --glob '*.{vue,js,ts}'
For each v-html, check whether content passes sanitizeHtml / DOMPurify. Exclude vendor noise.
Confirm password hashing (backend/app/core/security.py), default admin/111111 docs (AGENTS.md, backend/README.md). Record as 信息 if relevant.
Create docs/testing/2026-10-16-security-scan-report.md with:
Do not modify business application code.
Files:
backend/scripts/reset_weak_password_111111.pyCreate: docs/sql/2026-10-16-reset-weak-password-111111.sql
[x] Step 1: Implement Python script
Create backend/scripts/reset_weak_password_111111.py that:
backend to sys.path and loads settings like other scripts (reuse app.core.database / app.core.config / app.core.security).SysUser where del_flag == 0.verify_password("111111", password); if true and not --dry-run, set password via get_password_hash("Zkxw@123") and update update_time if present.--dry-run (list only) and optional --commit or default commit with clear print of counts.user_no, id, status for each hit.Follow patterns in existing backend/scripts/*.py for DB session bootstrap.
Create docs/sql/2026-10-16-reset-weak-password-111111.sql explaining bcrypt limitation; include example:
-- 说明:无法用 WHERE password='111111' 命中弱密码。
-- 请使用: python backend/scripts/reset_weak_password_111111.py [--dry-run]
-- 以下仅为「已知单用户」手工更新模板(哈希需现场生成):
-- UPDATE sys_user SET password = '<bcrypt of Zkxw@123>', update_time = NOW()
-- WHERE id = '<user_id>' AND del_flag = 0;
Generate one real bcrypt hash of Zkxw@123 in comments for operators who must UPDATE a known id manually.
cd backend && source venv/bin/activate && python scripts/reset_weak_password_111111.py --dry-run
Expected: script starts, lists matching users or “0 matches”, does not write. If DB unavailable, document in report/script README comment how to run when DB is up; do not invent failures as bugs.
[x] Step 1: Confirm deliverables exist
[x] docs/testing/2026-10-16-security-scan-report.md
[x] backend/scripts/reset_weak_password_111111.py
[x] docs/sql/2026-10-16-reset-weak-password-111111.sql
[x] No unrelated business code changes
[x] Step 2: Stop for human review (no auto-commit unless user asks)