Pipeline DevSecOps
Chaque commit déclenche un pipeline CI/CD complet avec validation de sécurité. Toutes les étapes de sécurité sont bloquantes — aucune image vulnérable n'atteint la production.
Étapes du pipeline
Commit GitLab
│
├── [Test] pytest + lint (ruff, mypy)
├── [SAST] Semgrep + Bandit → DefectDojo
├── [Build] Docker build (Python 3.13-slim)
├── [SCAN] Trivy → DefectDojo
├── [Push] Harbor (harbor.mounik.ovh)
├── [DAST] OWASP ZAP → DefectDojo
└── [Deploy] ArgoCD sync → k3s
Outils de sécurité
| Outil |
Type |
Usage |
| Semgrep |
SAST |
Analyse statique multi-langage, règles auto + custom |
| Bandit |
SAST |
Analyse statique Python, sécurité standard library |
| Trivy |
SCAN |
Scan des vulnérabilités dans les images Docker |
| OWASP ZAP |
DAST |
Test d'intrusion automatique sur l'application déployée |
| DefectDojo |
Agrégation |
Centralisation de tous les rapports de sécurité |
Règles de blocage
| Étape |
Condition de blocage |
| SAST |
Semgrep : erreur de sécurité haute/critique. Bandit : score > 0 |
| SCAN |
Trivy : vulnérabilité CRITICAL dans l'image |
| DAST |
OWASP ZAP : alerte haute/critique confirmée |
Intégration DefectDojo
Chaque outil envoie son rapport à DefectDojo via l'API REST :
curl -X POST "${DD_URL}/api/v2/import-scan/" \
-H "Authorization: Token ${DD_API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"product_name": "fastapi",
"scan_type": "Semgrep JSON Report",
"file": "$(cat semgrep-report.json)"
}'
Variables CI/CD requises
| Variable |
Source |
Description |
HARBOR_PASSWORD |
Vault (homelab/harbor) |
Auth registry Harbor |
DD_API_TOKEN |
Interface DefectDojo |
API pour push des rapports |
GITLAB_TOKEN |
GitLab.com |
Push manifests vers homelab-proxmox |
ARGOCD_PASSWORD |
Vault (homelab/argocd) |
Auth ArgoCD |
VAULT_ADDR |
Défini dans GitLab |
URL du serveur Vault |
VAULT_TOKEN |
Vault |
Token d'accès aux secrets |
Pour aller plus loin