취약점 발견 사항 API
Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
이 API 리소스는 Vulnerabilities에서 Vulnerability Findings로 이름이 변경되었습니다. 이 API를 사용하여 취약점 발견 사항을 검색합니다. 사용자가 프로젝트 보안 대시보드를 사용할 권한이 없으면, 이 프로젝트의 취약점 발견 사항에 대한 모든 요청이 403 Forbidden 상태 코드를 반환합니다.
이 API 리소스는 Vulnerabilities에서 Vulnerability Findings로 이름이 변경되었습니다. Vulnerability 오브젝트 제공을 위해 Vulnerabilities가 예약되어 있기 때문입니다.
이전 Vulnerabilities API와의 손상된 통합을 수정하려면 vulnerabilities URL 부분을 vulnerability_findings로 변경하세요.
이 API를 사용하여 취약점 발견 사항을 검색합니다. 이 API에 대한 모든 호출에는 인증이 필요합니다.
사용자가 프로젝트 보안 대시보드를 사용할 권한이 없으면,
이 프로젝트의 취약점 발견 사항에 대한 모든 요청이 403 Forbidden 상태 코드를 반환합니다.
이 API는 더 이상 사용되지 않는 과정에 있으며 불안정한 것으로 간주됩니다. 응답 페이로드는 GitLab 릴리스 간에 변경되거나 손상될 수 있습니다. 대신 GraphQL API를 사용하세요. 자세한 내용은 GraphQL 예시를 참조하세요.
모든 프로젝트 취약점 발견 사항 목록#
지정된 프로젝트의 모든 취약점 발견 사항을 나열합니다.
응답은 페이지네이션되며 기본적으로 20개의 결과를 반환합니다.
GET /projects/:id/vulnerability_findings
GET /projects/:id/vulnerability_findings?report_type=sast
GET /projects/:id/vulnerability_findings?report_type=container_scanning
GET /projects/:id/vulnerability_findings?report_type=sast,dast
GET /projects/:id/vulnerability_findings?scope=all
GET /projects/:id/vulnerability_findings?scope=dismissed
GET /projects/:id/vulnerability_findings?severity=high
GET /projects/:id/vulnerability_findings?pipeline_id=42
| 속성 | 유형 | 필수 | 설명 |
|---|---|---|---|
id |
integer or string | 예 | 인증된 사용자가 구성원인 프로젝트의 ID 또는 URL 인코딩된 경로. |
report_type |
string array | 아니요 | 지정된 보고서 유형에 속하는 취약점 발견 사항을 반환합니다. 유효한 값: sast, dast, dependency_scanning, 또는 container_scanning. 기본값은 모두입니다. |
scope |
string | 아니요 | 주어진 범위에 대한 취약점 발견 사항을 반환합니다: all 또는 dismissed. 기본값은 dismissed입니다. |
severity |
string array | 아니요 | 지정된 심각도 수준에 속하는 취약점 발견 사항을 반환합니다: info, unknown, low, medium, high, 또는 critical. 기본값은 모두입니다. |
pipeline_id |
integer or string | 아니요 | 지정된 파이프라인에 속하는 취약점 발견 사항을 반환합니다. |
curl --request GET \
--header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/projects/4/vulnerability_findings"
응답 예시:
[
{
"id": null,
"report_type": "sast",
"name": "Possible command injection",
"severity": "high",
"scanner": {
"external_id": "brakeman",
"name": "Brakeman",
"vendor": "GitLab"
},
"identifiers": [
{
"external_type": "brakeman_warning_code",
"external_id": "14",
"name": "Brakeman Warning Code 14",
"url": "https://brakemanscanner.org/docs/warning_types/command_injection/"
}
],
"uuid": "ad5e3be3-a193-55f5-a200-bc12865fb09c",
"create_jira_issue_url": null,
"false_positive": true,
"create_vulnerability_feedback_issue_path": "/root/test-false-positive/-/vulnerability_feedback",
"create_vulnerability_feedback_merge_request_path": "/root/test-false-positive/-/vulnerability_feedback",
"create_vulnerability_feedback_dismissal_path": "/root/test-false-positive/-/vulnerability_feedback",
"project": {
"id": 2,
"name": "Test False Positive",
"full_path": "/root/test-false-positive",
"full_name": "Administrator / Test False Positive"
},
"dismissal_feedback": null,
"issue_feedback": null,
"merge_request_feedback": null,
"description": null,
"links": [],
"location": {
"file": "app/controllers/users_controller.rb",
"start_line": 42,
"class": "UsersController",
"method": "list_users"
},
"remediations": [
null
],
"solution": null,
"evidence": null,
"request": null,
"response": null,
"evidence_source": null,
"supporting_messages": [],
"assets": [],
"details": {},
"state": "detected",
"scan": {
"type": "sast",
"status": "success",
"start_time": "2021-09-02T20:55:48",
"end_time": "2021-09-02T20:55:48"
},
"blob_path": "/root/test-false-positive/-/blob/dfd75607752a839bbc9c7362d111effaa470fecd/app/controllers/users_controller.rb#L42"
}
]
Vulnerability Findings REST API를 GraphQL로 교체#
Vulnerability Findings REST API 엔드포인트의 예정된 더 이상 사용 중단을 준비하기 위해, 아래 예시를 사용하여 GraphQL API로 동등한 작업을 수행하세요.
GraphQL - 프로젝트 취약점 발견 사항#
Pipeline.securityReportFindings를 사용합니다.
query VulnerabilityFindings {
project(fullPath: "gitlab-examples/security/security-reports") {
pipelines(first:1) {
nodes {
securityReportFindings(first:1) {
nodes {
title
severity
state
scanner {
externalId
name
vendor
}
identifiers {
externalType
externalId
name
url
}
uuid
falsePositive
description
location {
... on VulnerabilityLocationSast {
file
startLine
endLine
vulnerableClass
vulnerableMethod
blobPath
}
... on VulnerabilityLocationContainerScanning {
dependency {
package {
name
}
version
}
image
operatingSystem
}
... on VulnerabilityLocationDependencyScanning {
file
blobPath
dependency {
version
}
}
}
remediations {
diff
summary
}
solution
evidence {
request {
body
headers {
name
value
}
method
url
}
}
}
}
}
}
}
}
응답 예시:
{
"data": {
"project": {
"pipelines": {
"nodes": [
{
"securityReportFindings": {
"nodes": [
{
"title": "Deserialization of Untrusted Data",
"severity": "CRITICAL",
"state": "CONFIRMED",
"scanner": {
"externalId": "gemnasium",
"name": "Gemnasium",
"vendor": "GitLab"
},
"identifiers": [
{
"externalType": "gemnasium",
"externalId": "b60c2d6b-9083-4a97-a1b2-f7dc79bff74c",
"name": "Gemnasium-b60c2d6b-9083-4a97-a1b2-f7dc79bff74c",
"url": "https://gitlab.com/gitlab-org/security-products/gemnasium-db/-/blob/master/gem/activerecord/CVE-2022-32224.yml"
},
{
"externalType": "cve",
"externalId": "CVE-2022-32224",
"name": "CVE-2022-32224",
"url": "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-32224"
},
{
"externalType": "ghsa",
"externalId": "GHSA-3hhc-qp5v-9p2j",
"name": "GHSA-3hhc-qp5v-9p2j",
"url": "https://github.com/advisories/GHSA-3hhc-qp5v-9p2j"
}
],
"uuid": "c9e40395-72cd-54f5-962f-e1d52c0dffab",
"falsePositive": false,
"description": "A possible escalation to RCE vulnerability exists when using YAML serialized columns in Active Record < 7.0.3.1, <6.1.6.1, <6.0.5.1 and <5.2.8.1 which could allow an attacker, that can manipulate data in the database (via means like SQL injection), the ability to escalate to an RCE.",
"location": {
"file": "dependency-scanning-files/Gemfile.lock",
"blobPath": null,
"dependency": {
"version": "5.0.0"
}
},
"remediations": [],
"solution": "Upgrade to versions 5.2.8.1, 6.0.5.1, 6.1.6.1, 7.0.3.1 or above.",
"evidence": null
}
]
}
}
]
}
}
}
}
