취약성 검색 API
Tier: Ultimate
Offering: GitLab.com, Self-managed, GitLab Dedicated
이 API 리소스는 취약성을 취급하는 것이 아니라 취약성 오브젝트를 제공하기 위해 이전의 취약성 API에서 취약성 검색으로 이름이 변경되었습니다.
이전의 취약성 API와 관련된 모든 통합을 수정하려면
vulnerabilities
URL 부분을 vulnerability_findings
로 변경하세요.취약성 검색에 대한 모든 API 호출은 인증되어야 합니다.
만약 사용자에게 프로젝트 보안 대시보드 사용 권한이 없으면, 해당 프로젝트의 취약성 검색에 대한 모든 요청에 403 Forbidden
상태 코드가 반환됩니다.
이 API는 폐기 중인 프로세스이며 불안정한 것으로 간주됩니다.
응답 페이로드는 GitLab 릴리스 간에 변경 또는 파괴될 수 있습니다. 대신 GraphQL API를 사용하세요. 더 많은 정보는 GraphQL 예시에서 확인하세요.
취약성 검색 페이징
기본적으로 GET
요청은 API 결과가 페이지로 구성되기 때문에 한 번에 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?confidence=unknown,experimental
GET /projects/:id/vulnerability_findings?pipeline_id=42
GitLab 12.9부터
undefined
심각도 및 신뢰 수준은 더 이상 보고되지 않습니다.속성 | 유형 | 필수 여부 | 설명 |
---|---|---|---|
id
| integer/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 . 기본값은 모두입니다.
|
confidence
| string array | 아니요 | 지정된 신뢰 수준에 속하는 취약성 검색을 반환합니다: ignore , unknown , experimental , low , medium , high , 또는 confirmed . 기본값은 모두입니다.
|
pipeline_id
| integer/string | 아니요 | 지정된 파이프라인에 속하는 취약성 검색을 반환합니다. |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/vulnerability_findings"
예시 응답:
[
{
"id": null,
"report_type": "sast",
"name": "가능한 명령 삽입",
"severity": "high",
"confidence": "high",
"scanner": {
"external_id": "brakeman",
"name": "Brakeman",
"vendor": "GitLab"
},
"identifiers": [
{
"external_type": "brakeman_warning_code",
"external_id": "14",
"name": "브레이크맨 경고 코드 14",
"url": "https://brakemanscanner.org/docs/warning_types/command_injection/"
}
],
"project_fingerprint": "ac218b1770af030cfeef967752ab803c55afb36d",
"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": "관리자 / 테스트 거짓 긍정"
},
"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": "검출됨",
"scan": {
"type": "sast",
"status": "성공",
"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"
}
]
GraphQL을 사용하여 취약점 검색 REST API 대체
다가오는 폐기에 대비하여 취약점 검색 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
}
]
}
}
]
}
}
}
}