プロジェクトのセキュリティ設定API
- プラン: Ultimate
- 提供形態: GitLab.com、GitLab Self-Managed、GitLab Dedicated
プロジェクトセキュリティ設定に対するすべてのAPIコールは、認証される必要があります。
プロジェクトがプライベートで、かつユーザーがセキュリティ設定が属するプロジェクトのメンバーでない場合、そのプロジェクトへのリクエストは404 Not Foundステータスコードを返します。
すべてのプロジェクトセキュリティ設定を一覧表示する
プロジェクトのすべてのセキュリティ設定を一覧表示します。
前提条件:
- プロジェクトのセキュリティマネージャー、デベロッパー、メンテナー、またはオーナーロールが必要です。
GET /projects/:id/security_settings| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
curl --request GET \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/7/security_settings"レスポンス例:
{
"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設定を更新する
指定されたプロジェクトのsecret_push_protection_enabled設定を更新します。
前提条件:
- プロジェクトのメンテナーまたはオーナーロールが必要です。
PUT /projects/:id/security_settings| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス。 |
secret_push_protection_enabled | ブール値 | はい | プロジェクトのシークレットプッシュ保護を有効にします。 |
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"レスポンス例:
{
"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
}