プロジェクトセキュリティ設定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設定を、指定された値に更新します。
trueに設定して、プロジェクトのシークレットプッシュ保護を有効にします。
前提要件:
- プロジェクトのメンテナー以上のロールを持っている必要があります。
| 属性 | 型 | 必須 | 説明 |
|---|---|---|---|
id | 整数または文字列 | はい | 認証済みユーザーがメンバーであるプロジェクトのURLエンコードされたパスまたはID |
secret_push_protection_enabled | ブール値 | はい | secret_push_protection_enabledを更新する値 |
curl --request PUT \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/7/security_settings?secret_push_protection_enabled=false"レスポンス例:
{
"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
}