knacky e2f030e0e1 feat(backend): /api/v1/users CRUD endpoints (sprint 2)
Four routes, all gated by `USER_MANAGE` (D-015 — rt_lead only):

- `GET /api/v1/users` paginated, optional `?type=` filter. Returns
  `Page[UserRead]`.
- `POST /api/v1/users` hashes the password with bcrypt, attaches the user
  to the matching F11 group (rt_operator → `rt_operator`, rt_lead →
  `rt_lead`, soc_analyst → `soc_analyst`). Returns 201 with `UserRead`, or
  409 `email_taken` on duplicate email (active or already-disabled).
- `PATCH /api/v1/users/<uid>` partial. Changing `type` realigns the user's
  *global* F11 membership (engagement_id IS NULL) and leaves per-engagement
  memberships untouched. Password rotation rehashes with bcrypt; audit row
  carries a `password_rotated` flag rather than logging the value.
- `DELETE /api/v1/users/<uid>` sets `disabled_at = now()`. Idempotent —
  a second call on a disabled user returns 204 without an extra audit row.
  Hard-delete is intentionally absent: keeps audit-trail FKs valid and
  matches NF-AUDIT (we never lose actor-id linkage).

`_TYPE_TO_GROUP` translates `UserType` enum → `GroupName`; `_resolve_group`
loads the corresponding row from `group` (raises 500 if the seed didn't
run, surfaced through the global JSON error handler).
2026-05-23 15:53:09 +02:00

Mimic

Internal BAS (Breach & Attack Simulation) platform for the Red Team. Replays TTPs from engagement journals or an internal ATT&CK library against client infrastructure through VPN/relay, in white-glove coordination with the SOC.

Output: a coverage report mapped to MITRE ATT&CK — measurable, reproducible, archived.

Status

ready-with-prereqs — spec frozen on 2026-05-19, 23 review patches integrated. Code start blocked on:

  • PR1 — Mythic API documentation + pinned version (lead RT)
  • PR2 — Internal C2 interface spec + journal export example (internal C2 team)
  • PR3 — RT graphic charter for the PDF report (lead RT)

While PR1/PR2/PR3 are open, sprint 0 focuses on the unblocked skeleton.

Spec

The authoritative spec lives in the RT-SecondBrain vault: Projects/Mimic — Spec.md. Do not duplicate it here.

In-repo documentation:

  • CHANGELOG.md — chronological log of features, decisions, rollbacks.
  • tasks/spec-decisions.md — implementation arbitrations on top of the spec.
  • tasks/todo.md — current sprint backlog.

Stack (frozen)

  • Backend Python 3.12 / Flask / Flask-SocketIO / SQLAlchemy 2 / Pydantic 2 / Alembic / WeasyPrint / pytest + testcontainers / ruff / mypy strict
  • Frontend TypeScript / React 18+ / Vite / Tailwind 4 / TanStack Query 5 / Recharts / Playwright
  • Storage Postgres (prod) / SQLite (pure-logic unit tests) / testcontainers Postgres (audit log, RBAC, write-only role — incl. unit tests of Postgres-specific behavior, per H38)
  • Deploy Docker images + Ansible deployment playbook (per D-010). Reverse proxy (Caddy + TLS + IP allowlist) handled by existing RT infrastructure, out of Mimic scope (D-007).

Layout

mimic/
├── backend/    # Flask app, connectors, orchestrator, reporting, CLI
├── frontend/   # Vite + React app
├── docs/       # Architecture notes, ADRs, deployment
└── tasks/      # Sprint backlog, decisions, lessons

Conventions

  • Branches: feature/<scope>, fix/<scope>, docs/<scope>, chore/<scope>. Long-lived: main.
  • Commits: Conventional Commits (feat:, fix:, chore:, docs:, test:, refactor:).
  • PRs: each branch → review (code-reviewer) → team-lead merges. No direct push to main.

Build & run

make targets land at the end of sprint 0. For now the repo is skeleton-only.

Licensing

Internal — proprietary, RT use only. Do not redistribute.

Description
No description provided
Readme 565 KiB
Languages
Python 53.4%
TypeScript 39.4%
CSS 4.6%
Dockerfile 1%
Makefile 0.8%
Other 0.8%