chore: bootstrap project (sprint 0)
Lay down the project foundation before Sprint 1 implementation: - SPEC.md enriched with a "Décisions techniques" section that pins down 3-role auth (admin super-user / redteam / soc), JWT bearer, single-container Flask+React topology, minimal Engagement model, local MITRE STIX bundle, and the Makefile target list. - .claude/agents/ defines the 6 sub-agents per SPEC.md § Team: backend-builder, frontend-builder, spec-reviewer (project override covering plan-vs-spec + code-vs-spec), code-reviewer, test-verifier, devil-advocate. - tasks/todo.md holds the full Sprint 1 plan (Auth + CRUD Engagement) validated by spec-reviewer on 2026-05-26 after one round of fixes. - CHANGELOG.md and tasks/lessons.md scaffolded. - .gitignore covers Python, Node, Playwright, secrets, build artifacts and Claude Code worktrees. No application code is shipped in this commit — Sprint 1 will be a separate branch and PR. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
99
SPEC.md
99
SPEC.md
@@ -111,4 +111,101 @@ Pour ce projet, j'ai besoin d'une équipe d'agent réparti de la manière suivan
|
||||
- Quand tout est ok pour le test verifier en informer le team lead afin qu'il prépare la PR.
|
||||
6. Devil advocate : **modèle Opus**
|
||||
- Dans le cas de questions structurantes sur le projet, faire intervenir cet agent en tant que tierce personne n'ayant pas connaissance de tout le projet mais permettant d'avoir un regarde neuf sur ces questions.
|
||||
|
||||
|
||||
# Décisions techniques
|
||||
|
||||
Décisions arrêtées avec l'utilisateur au démarrage du projet. Ces choix doivent guider les sprints et peuvent évoluer — toute évolution est tracée dans le `CHANGELOG.md`.
|
||||
|
||||
## Authentification & rôles
|
||||
* **Trois rôles** : `admin`, `redteam`, `soc`.
|
||||
- `admin` : super-user. Gestion des comptes (CRUD users) **et** CRUD complet sur engagements/simulations (cumule les droits de redteam). Décision élargie le 2026-05-26 pour éviter qu'un admin doive se créer un second compte redteam pour gérer les engagements opérationnellement.
|
||||
- `redteam` : CRUD complet sur engagements et simulations (tous champs).
|
||||
- `soc` : lecture des simulations, écriture restreinte à la partie SOC (logs, sources, commentaires, n° incident).
|
||||
* **Méthode** : JWT Bearer token (login `/api/auth/login` → access token). Refresh token à décider plus tard si besoin.
|
||||
* **Mot de passe** : hash argon2 (ou bcrypt si argon2 indisponible).
|
||||
* **Création de comptes** : par admin uniquement via UI. Pas de self-registration.
|
||||
* **Bootstrap du 1er admin** : commande Flask `flask create-admin <user> <pass>` exposée via une target Makefile (`make create-admin USER=… PASS=…`) qui wrap `docker exec mimic flask create-admin …`. Aucun credential par défaut, aucun secret persisté en `.env`.
|
||||
|
||||
## Modèle de données — V1
|
||||
|
||||
### `User`
|
||||
| Champ | Type | Notes |
|
||||
|---|---|---|
|
||||
| id | int (PK) | |
|
||||
| username | str unique | |
|
||||
| password_hash | str | argon2/bcrypt |
|
||||
| role | enum(admin/redteam/soc) | |
|
||||
| created_at | datetime | |
|
||||
|
||||
### `Engagement`
|
||||
Modèle **minimal** Sprint 1 (extensible plus tard) :
|
||||
| Champ | Type | Notes |
|
||||
|---|---|---|
|
||||
| id | int (PK) | |
|
||||
| name | str | requis |
|
||||
| description | text | optionnel |
|
||||
| start_date | date | requis |
|
||||
| end_date | date | optionnel, ≥ start_date |
|
||||
| status | enum(planned/active/closed) | défaut `planned` |
|
||||
| created_at | datetime | |
|
||||
| created_by | FK User | |
|
||||
|
||||
### `Simulation` (Sprint 2+)
|
||||
Conforme à la spec (partie RedTeam + partie SOC). Workflow Pending → In progress → Review required → Done. Détaillé dans le sprint correspondant.
|
||||
|
||||
## Référentiel MITRE ATT&CK
|
||||
* **Bundle local** : JSON officiel STIX 2.1 MITRE Enterprise embarqué dans l'image (`backend/data/mitre/enterprise-attack.json`).
|
||||
* Pas d'appel réseau au runtime. Seed/refresh manuel via `make update-mitre`.
|
||||
* Utilisé au Sprint 2+ pour l'autocomplete des TTPs (T-id + nom + tactique).
|
||||
|
||||
## Stack technique précisée
|
||||
* **Backend** : Python 3.12, Flask, SQLAlchemy, Alembic, pytest, ruff, mypy. Auth via `PyJWT` + middleware decorator.
|
||||
* **Frontend** : React 18, Vite, TailwindCSS, TanStack Query, React Router, Vitest pour les unit tests composants.
|
||||
* **Tests acceptance** : Playwright (TS), exécutés dans le container ou via runner CI.
|
||||
* **Conteneurisation** : **Container unique** — Flask sert l'API sous `/api/*` et le build statique de Vite (`frontend/dist`) sous `/`. Un seul `Dockerfile` multistage (stage Node pour build front, stage Python pour run).
|
||||
* **Makefile** : targets `build`, `start`, `stop`, `restart`, `update`, `logs`, `create-admin USER=… PASS=…`, `update-mitre`, `test-backend`, `test-frontend`, `test-e2e`.
|
||||
|
||||
## Arborescence cible
|
||||
```
|
||||
mimic/
|
||||
├── backend/
|
||||
│ ├── app/
|
||||
│ │ ├── __init__.py # create_app() factory
|
||||
│ │ ├── config.py
|
||||
│ │ ├── extensions.py # db, migrate
|
||||
│ │ ├── models/
|
||||
│ │ ├── api/ # blueprints
|
||||
│ │ ├── services/
|
||||
│ │ ├── auth/ # jwt, decorators
|
||||
│ │ └── cli.py # flask create-admin
|
||||
│ ├── migrations/ # alembic
|
||||
│ ├── tests/
|
||||
│ ├── data/mitre/
|
||||
│ ├── pyproject.toml
|
||||
│ └── requirements.txt
|
||||
├── frontend/
|
||||
│ ├── src/
|
||||
│ │ ├── components/
|
||||
│ │ ├── pages/
|
||||
│ │ ├── hooks/
|
||||
│ │ ├── api/ # client + types
|
||||
│ │ └── styles/
|
||||
│ ├── tests/
|
||||
│ ├── package.json
|
||||
│ ├── vite.config.ts
|
||||
│ └── tailwind.config.ts
|
||||
├── e2e/ # Playwright tests
|
||||
├── docker/
|
||||
│ └── Dockerfile
|
||||
├── tasks/ # plans sprint, lessons
|
||||
├── DESIGN.md
|
||||
├── SPEC.md
|
||||
├── README.md
|
||||
├── CHANGELOG.md
|
||||
└── Makefile
|
||||
```
|
||||
|
||||
## Workflow git
|
||||
* Branche par sprint : `sprint/<num>-<short-name>` (ex : `sprint/1-auth-engagements`).
|
||||
* Sous-branches par builder si besoin : `sprint/1-auth-engagements/backend`, `…/frontend`.
|
||||
* PR à la fin du sprint, validée par l'utilisateur après récap synthétique du team-lead.
|
||||
|
||||
Reference in New Issue
Block a user