正式なドキュメントは英語版であり、この日本語訳はAI支援翻訳により作成された参考用のものです。日本語訳の一部の内容は人間によるレビューがまだ行われていないため、翻訳のタイミングにより英語版との間に差異が生じることがあります。最新かつ正確な情報については、英語版をご参照ください。

プロジェクトのセキュリティ設定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
}