doc-locale/fr-fr/api/project_security_settings.md
{{< details >}}
{{< /details >}}
Chaque appel d'API aux paramètres de sécurité du projet doit être authentifié.
Si un projet est privé et qu'un utilisateur n'est pas membre du projet auquel appartient le paramètre de sécurité, les requêtes adressées à ce projet renvoient un code de statut 404 Not Found.
Répertorie tous les paramètres de sécurité du projet.
Prérequis :
GET /projects/:id/security_settings
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | entier ou chaîne | oui | L'ID ou le chemin encodé en URL du projet. |
curl --request GET \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/7/security_settings"
Exemple de réponse :
{
"project_id": 7,
"created_at": "2024-08-27T15:30:33.075Z",
"updated_at": "2024-10-16T05:09:22.233Z",
"auto_fix_container_scanning": true,
"auto_fix_dast": true,
"auto_fix_dependency_scanning": true,
"auto_fix_sast": true,
"continuous_vulnerability_scans_enabled": true,
"container_scanning_for_registry_enabled": false,
"secret_push_protection_enabled": true
}
secret_push_protection_enabled {#update-the-secret_push_protection_enabled-setting}{{< history >}}
pre_receive_secret_detection_enabled dans GitLab 17.11.{{< /history >}}
Met à jour le paramètre secret_push_protection_enabled pour le projet spécifié.
Prérequis :
PUT /projects/:id/security_settings
| Attribut | Type | Obligatoire | Description |
|---|---|---|---|
id | entier ou chaîne | Oui | ID ou chemin encodé en URL d'un projet. |
secret_push_protection_enabled | boolean | Oui | Active la protection push contre les secrets pour le projet. |
curl --request PUT \
--header "PRIVATE-TOKEN: <your_access_token>" \
--data "secret_push_protection_enabled=false" \
--url "https://gitlab.example.com/api/v4/projects/7/security_settings"
Exemple de réponse :
{
"project_id": 7,
"created_at": "2024-08-27T15:30:33.075Z",
"updated_at": "2024-10-16T05:09:22.233Z",
"auto_fix_container_scanning": true,
"auto_fix_dast": true,
"auto_fix_dependency_scanning": true,
"auto_fix_sast": true,
"continuous_vulnerability_scans_enabled": true,
"container_scanning_for_registry_enabled": false,
"secret_push_protection_enabled": false
}