脆弱性API
GitLab Ultimate12.6で導入されました。
脆弱性へのAPIコールはすべて認証されなければなりません。
脆弱性の権限はそのプロジェクトの権限を継承します。 プロジェクトが非公開であり、ユーザが脆弱性が属するプロジェクトのメンバでない場合、そのプロジェクトへのリクエストは404 Not Found
ステータスコードを返します。
単一の脆弱性
単一の脆弱性を取得
GET /vulnerabilities/:id
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数または文字列 | はい | 取得する脆弱性のID |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/vulnerabilities/1"
回答例
{
"id": 1,
"title": "Predictable pseudorandom number generator",
"description": null,
"state": "opened",
"severity": "medium",
"confidence": "medium",
"report_type": "sast",
"project": {
"id": 32,
"name": "security-reports",
"full_path": "/gitlab-examples/security/security-reports",
"full_name": "gitlab-examples / security / security-reports"
},
"author_id": 1,
"updated_by_id": null,
"last_edited_by_id": null,
"closed_by_id": null,
"start_date": null,
"due_date": null,
"created_at": "2019-10-13T15:08:40.219Z",
"updated_at": "2019-10-13T15:09:40.382Z",
"last_edited_at": null,
"closed_at": null
}
脆弱性の確認
指定された脆弱性を確認します。 脆弱性がすでに確認されている場合は、ステータスコード304
を返します。
認証されたユーザが脆弱性を確認する権限を持っていない場合、このリクエストは403
というステータスコードになります。
POST /vulnerabilities/:id/confirm
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数または文字列 | はい | 確認する脆弱性のID |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/vulnerabilities/5/confirm"
回答例
{
"id": 2,
"title": "Predictable pseudorandom number generator",
"description": null,
"state": "confirmed",
"severity": "medium",
"confidence": "medium",
"report_type": "sast",
"project": {
"id": 32,
"name": "security-reports",
"full_path": "/gitlab-examples/security/security-reports",
"full_name": "gitlab-examples / security / security-reports"
},
"author_id": 1,
"updated_by_id": null,
"last_edited_by_id": null,
"closed_by_id": null,
"start_date": null,
"due_date": null,
"created_at": "2019-10-13T15:08:40.219Z",
"updated_at": "2019-10-13T15:09:40.382Z",
"last_edited_at": null,
"closed_at": null
}
脆弱性の解消
指定された脆弱性を解決します。 脆弱性がすでに解決されている場合は、ステータスコード304
を返します。
認証されたユーザが脆弱性を解決する権限を持っていない場合、このリクエストは403
というステータスコードになります。
POST /vulnerabilities/:id/resolve
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数または文字列 | はい | 解決すべき脆弱性のID |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/vulnerabilities/5/resolve"
回答例
{
"id": 2,
"title": "Predictable pseudorandom number generator",
"description": null,
"state": "resolved",
"severity": "medium",
"confidence": "medium",
"report_type": "sast",
"project": {
"id": 32,
"name": "security-reports",
"full_path": "/gitlab-examples/security/security-reports",
"full_name": "gitlab-examples / security / security-reports"
},
"author_id": 1,
"updated_by_id": null,
"last_edited_by_id": null,
"closed_by_id": null,
"start_date": null,
"due_date": null,
"created_at": "2019-10-13T15:08:40.219Z",
"updated_at": "2019-10-13T15:09:40.382Z",
"last_edited_at": null,
"closed_at": null
}
脆弱性の解消
指定された脆弱性を却下します。 脆弱性がすでに却下されている場合は、ステータスコード304
を返します。
認証されたユーザが脆弱性を解除する権限を持っていない場合、このリクエストは403
というステータスコードになります。
POST /vulnerabilities/:id/dismiss
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数または文字列 | はい | 却下する脆弱性のID |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/vulnerabilities/5/dismiss"
回答例
{
"id": 2,
"title": "Predictable pseudorandom number generator",
"description": null,
"state": "closed",
"severity": "medium",
"confidence": "medium",
"report_type": "sast",
"project": {
"id": 32,
"name": "security-reports",
"full_path": "/gitlab-examples/security/security-reports",
"full_name": "gitlab-examples / security / security-reports"
},
"author_id": 1,
"updated_by_id": null,
"last_edited_by_id": null,
"closed_by_id": null,
"start_date": null,
"due_date": null,
"created_at": "2019-10-13T15:08:40.219Z",
"updated_at": "2019-10-13T15:09:40.382Z",
"last_edited_at": null,
"closed_at": null
}