취약점 발견 API
이유는 취약점이 Vulnerability objects를 제공하는 데 예약되어 있기 때문입니다.
이전 취약점 API와의 통합이 깨졌다면,
vulnerabilities
URL 부분을 vulnerability_findings
로 변경하십시오.취약점 발견에 대한 모든 API 호출은 인증 되어야 합니다.
사용자가
프로젝트 보안 대시보드 사용 권한이 없을 경우,
해당 프로젝트의 취약점 발견에 대한 요청은 403 Forbidden
상태 코드를 반환합니다.
응답 페이로드는 GitLab 릴리즈 간에 변경되거나 깨질 수 있습니다.
대신 GraphQL API를 사용하십시오.
자세한 내용은 GraphQL 예제를 참조하십시오.
취약점 발견 페이지 매김
기본적으로 GET
요청은 한 번에 20개의 결과를 반환합니다.
API 결과는 페이지 매김되어 있습니다.
페이지 매김에 대한 자세한 내용을 읽어보세요.
프로젝트 취약점 발견 목록
프로젝트의 모든 취약점 발견을 나열합니다.
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 |
정수/문자열 | 예 | 인증된 사용자가 속한 프로젝트의 ID 또는 URL 인코딩된 경로입니다. |
report_type |
문자열 배열 | 아니요 | 지정된 보고서 유형에 속하는 취약점 발견을 반환합니다. 유효한 값: sast , dast , dependency_scanning , 또는 container_scanning . 기본값은 모두입니다. |
scope |
문자열 | 아니요 | 주어진 범위에 대한 취약점 발견을 반환합니다: all 또는 dismissed . 기본값은 dismissed 입니다. |
severity |
문자열 배열 | 아니요 | 지정된 심각도 수준에 속하는 취약점 발견을 반환합니다: info , unknown , low , medium , high , 또는 critical . 기본값은 모두입니다. |
pipeline_id |
정수/문자열 | 아니요 | 지정된 파이프라인에 속하는 취약점 발견을 반환합니다. |
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",
"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": "테스트 잘못된 긍정",
"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": "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"
}
]
취약성 발견 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": "신뢰할 수 없는 데이터의 역직렬화",
"severity": "위험",
"state": "확인됨",
"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": "Active Record < 7.0.3.1, <6.1.6.1, <6.0.5.1 및 <5.2.8.1에서 YAML 직렬화된 열을 사용할 때 RCE로 상승할 수 있는 취약점이 존재하며, 이는 데이터베이스(예: SQL 인젝션)를 조작할 수 있는 공격자가 RCE로 상승할 수 있는 가능성을 허용합니다.",
"location": {
"file": "dependency-scanning-files/Gemfile.lock",
"blobPath": null,
"dependency": {
"version": "5.0.0"
}
},
"remediations": [],
"solution": "버전 5.2.8.1, 6.0.5.1, 6.1.6.1, 7.0.3.1 또는 그 이상의 버전으로 업그레이드하세요.",
"evidence": null
}
]
}
}
]
}
}
}
}