Tests de sécurité
English: en/testing.md
Tests du Control Plane
cd services/control-plane
pytest -q tests/test_security_*.py tests/test_platform_security_manifests.py
| Fichier | Couvre |
|---|---|
test_security_api.py | API de posture et réglages de sécurité |
test_security_auth.py | JWT (alg none, confusion HS/RS, kid, claims), clés API |
test_security_commands.py | safe_exec : injection de commande, ffmpeg, garak |
test_security_config.py | Défauts sûrs et analyse des listes |
test_security_egress.py | Garde de sortie : SSRF, rebinding DNS, redirections, métadonnées |
test_security_egress_wiring.py | Garde de sortie branchée sur outils, MCP, OAuth |
test_security_events.py | Événements de sécurité dans la chaîne d'audit |
test_security_http.py | En-têtes, limites de corps, hôtes, proxys, limitation de débit, garde de démarrage |
test_security_inputs.py | Gabarits, YAML, traversée de chemin, IDOR, affectation de masse, CSV |
test_security_prompt_injection.py | Injection directe et indirecte, sortie, canari |
test_security_sql_inputs.py, test_security_sql_static.py | Injection SQL (charges et vérificateur statique) |
test_security_tenant_settings.py | Validation des réglages de tenant |
test_security_attack_suite.py | Suite d'attaques sur toutes les opérations de l'API : authentification, rôles, fuzz d'injection, IDOR, affectation de masse, WebSocket, webhooks |
test_platform_security_manifests.py | Manifestes Helm, Cilium, Kyverno, PostgreSQL |
Scanners (commandes de .gitlab-ci.yml)
| Outil | Commande locale | Job GitLab | Job Forgejo |
|---|---|---|---|
| bandit | bandit -r services/control-plane/src sdks/python/src --severity-level high --confidence-level medium | bandit | security-sast |
| semgrep | semgrep scan --config p/owasp-top-ten --config p/python --config p/typescript --severity ERROR --error | semgrep | security-semgrep |
| pip-audit | pip-audit --strict <projet> | pip-audit | security-deps-python |
| npm audit | npm audit --audit-level=high --omit=dev | npm-audit | security-deps-node |
| gitleaks | gitleaks git --redact --exit-code 1 . puis gitleaks dir --redact --exit-code 1 . | gitleaks | security-secrets |
| Trivy | trivy fs ., trivy config deploy, trivy image <image> | trivy-fs, trivy-config, trivy-image | security-fs |
| OWASP ZAP baseline | zap-baseline.py -t <cible> (image ghcr.io/zaproxy/zaproxy) | zap-baseline | security-dast |
| kyverno | kyverno test deploy/policies/kyverno/tests | manifests | security-manifests |
| opa | opa test deploy/policies/opa -v | opa | policies |
| garak | python -m garak --model_type rest --generator_option_file deploy/ci/garak-rest.json --probes promptinject,dan,leakreplay | garak | ai-redteam |
| promptfoo | npx --yes promptfoo@latest eval -c deploy/ci/promptfoo.yaml | promptfoo | ai-redteam |
Les seuils et la politique de blocage sont décrits dans ci-security-gates.