취약성 검색 API
Tier: Ultimate
Offering: GitLab.com, Self-managed, GitLab Dedicated
- GitLab 12.5에서 도입되었습니다.
이 API 리소스는 취약점을 취약성 검색으로 이름을 변경했습니다. 취약점은 취약점 객체를 위해 예약되어 있습니다.
이전 취약점 API와의 연동을 수정하려면
vulnerabilities
URL 부분을 vulnerability_findings
로 변경하세요.취약성 검색에 대한 모든 API 호출은 인증되어야 합니다.
만약 사용자가 프로젝트 보안 대시보드를 사용할 수 있는 권한이 없다면,
이 프로젝트의 취약성 검색에 대한 모든 요청은 403 금지됨
상태 코드를 반환합니다.
이 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 | yes | 인증된 사용자가 속한 프로젝트의 ID 또는 URL 인코딩된 경로입니다. |
report_type
| string array | no | 지정된 보고 유형에 속하는 취약성 검색을 반환합니다. 유효한 값: sast , dast , dependency_scanning , 또는 container_scanning . 기본값은 모두입니다.
|
scope
| string | no | 주어진 범위에 대한 취약성 검색을 반환합니다: all 또는 dismissed . 기본값은 dismissed 입니다.
|
severity
| string array | no | 지정된 심각도 수준에 속하는 취약성 검색을 반환합니다: info , unknown , low , medium , high , 또는 critical . 기본값은 모두입니다.
|
confidence
| string array | no | 지정된 신뢰 수준에 속하는 취약성 검색을 반환합니다: ignore , unknown , experimental , low , medium , high , confirmed . 기본값은 모두입니다.
|
pipeline_id
| integer/string | no | 지정된 파이프라인에 속하는 취약성 검색을 반환합니다. |
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": "Brakeman 경고 코드 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": "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
}
]
}
}
]
}
}
}
}