knacky 4bade795fd test(backend): sprint 2 unit + integration coverage
Unit (`tests/unit/test_user_schemas.py`):
- 4 tests on `UserCreate` (happy path, password min length, email
  validation, invalid type).
- 2 tests on `UserUpdate` (all-optional, password validation when set).
- 3 tests on `EngagementMemberCreate` (default `"member"`, explicit role,
  max-length 40).
- 4 tests on `PageQuery` (defaults, offset arithmetic, page_size cap,
  page lower bound).

Integration (`tests/integration/test_user_mgmt_e2e.py`, marked
`integration`):
- The critical MA6-in-practice flow: rt_lead creates rt_operator, assigns
  to engagement A, the operator signs in, lists engagements and sees only
  A, `GET /engagements/B` returns 404 (anti-leak), `GET /engagements/B/members`
  returns 404 too, `/engagements/A/members` is reachable, `GET /users` is
  forbidden for the operator.
- `USER_MANAGE` gate: anonymous → 401, operator session → 403,
  lead session → 200.
- 409 `email_taken` on duplicate `POST /users`.
- `/audit/log` is lead-only, paginates with `page_size`, filters by
  `?action=`.
- Disabling a user blocks subsequent logins (same uniform
  `invalid_credentials` envelope as for bad passwords — no enumeration
  leak of "this account was disabled").

74 unit tests pass (61 sprint 1 + 13 sprint 2); integration tests run on
the testcontainers Postgres fixture in CI.
2026-05-23 15:53:35 +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%