正式なドキュメントは英語版であり、この日本語訳は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設定を、指定された値に更新します。

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
}