프로젝트 취약점 API

Tier: Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated
History
caution
이 API는 사용 중단될 예정이며 불안정하다고 간주됩니다.
응답 페이로드는 GitLab 릴리즈를 통해 변경되거나 깨질 수 있습니다.
대신 GraphQL API를 사용하세요.

모든 취약점에 대한 API 호출은 인증되어야 합니다.

취약점 권한은 해당 프로젝트에서 권한을 상속받습니다.
프로젝트가 비공개이고, 사용자가 취약점이 속한 프로젝트의 구성원이 아닌 경우,
해당 프로젝트에 대한 요청은 404 Not Found 상태 코드를 반환합니다.

취약점 페이지네이션

API 결과는 페이지네이션되며, GET 요청은 기본적으로 한 번에 20개의 결과를 반환합니다.

페이지네이션에 대해 자세히 알아보세요.

프로젝트 취약점 목록

프로젝트의 모든 취약점을 나열합니다.

인증된 사용자가 프로젝트 보안 대시보드를 사용할 권한이 없는 경우,
이 프로젝트의 취약점에 대한 GET 요청은 403 상태 코드를 반환합니다.

GET /projects/:id/vulnerabilities  
속성 유형 필수 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL로 인코딩된 경로.
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/vulnerabilities"  

예제 응답:

[  
    {  
        "author_id": 1,  
        "confidence": "medium",  
        "created_at": "2020-04-07T14:01:04.655Z",  
        "description": null,  
        "dismissed_at": null,  
        "dismissed_by_id": null,  
        "finding": {  
            "confidence": "medium",  
            "created_at": "2020-04-07T14:01:04.630Z",  
            "id": 103,  
            "location_fingerprint": "228998b5db51d86d3b091939e2f5873ada0a14a1",  
            "metadata_version": "2.0",  
            "name": "정규 표현식 서비스 거부 공격(debug)",  
            "primary_identifier_id": 135,  
            "project_fingerprint": "05e7cc9978ca495cf739a9f707ed34811e41c615",  
            "project_id": 24,  
            "raw_metadata": "{\"category\":\"dependency_scanning\",\"name\":\"Regular Expression Denial of Service\",\"message\":\"정규 표현식 서비스 거부 공격(debug)\",\"description\":\"debug 모듈은 신뢰할 수 없는 사용자 입력이 `o` 포맷터로 전달될 때 정규 표현식 서비스 거부 공격에 취약합니다. 이 문제를 차단하는 데 약 50k 문자가 필요하며 2초 동안 차단됩니다.\",\"cve\":\"yarn.lock:debug:gemnasium:37283ed4-0380-40d7-ada7-2d994afcc62a\",\"severity\":\"Unknown\",\"solution\":\"최신 버전으로 업그레이드하십시오.\",\"scanner\":{\"id\":\"gemnasium\",\"name\":\"Gemnasium\"},\"location\":{\"file\":\"yarn.lock\",\"dependency\":{\"package\":{\"name\":\"debug\"},\"version\":\"1.0.5\"}},\"identifiers\":[{\"type\":\"gemnasium\",\"name\":\"Gemnasium-37283ed4-0380-40d7-ada7-2d994afcc62a\",\"value\":\"37283ed4-0380-40d7-ada7-2d994afcc62a\",\"url\":\"https://deps.sec.gitlab.com/packages/npm/debug/versions/1.0.5/advisories\"}],\"links\":[{\"url\":\"https://nodesecurity.io/advisories/534\"},{\"url\":\"https://github.com/visionmedia/debug/issues/501\"},{\"url\":\"https://github.com/visionmedia/debug/pull/504\"}],\"remediations\":[null]}",  
            "report_type": "dependency_scanning",  
            "scanner_id": 63,  
            "severity": "low",  
            "updated_at": "2020-04-07T14:01:04.664Z",  
            "uuid": "f1d528ae-d0cc-47f6-a72f-936cec846ae7",  
            "vulnerability_id": 103  
        },  
        "id": 103,  
        "project": {  
            "created_at": "2020-04-07T13:54:25.634Z",  
            "description": "",  
            "id": 24,  
            "name": "security-reports",  
            "name_with_namespace": "gitlab-org / security-reports",  
            "path": "security-reports",  
            "path_with_namespace": "gitlab-org/security-reports"  
        },  
        "project_default_branch": "main",  
        "report_type": "dependency_scanning",  
        "resolved_at": null,  
        "resolved_by_id": null,  
        "resolved_on_default_branch": false,  
        "severity": "low",  
        "state": "detected",  
        "title": "정규 표현식 서비스 거부 공격(debug)",  
        "updated_at": "2020-04-07T14:01:04.655Z"  
    }  
]  

새로운 취약점

새로운 취약점을 생성합니다.

인증된 사용자가 새로운 취약점을 생성할 수 있는 권한이 없는 경우, 이 요청은 403 상태 코드를 반환합니다.

POST /projects/:id/vulnerabilities?finding_id=<your_finding_id>
속성 유형 필수 설명
id 정수 또는 문자열 인증된 사용자가 소속된 프로젝트의 ID 또는 URL-인코딩 경로
finding_id 정수 또는 문자열 새 취약점을 생성하기 위한 취약점 탐지의 ID

새로 생성된 취약점의 다른 속성은 해당 소스 취약점 탐지로부터 채워지거나 이러한 기본 값으로 설정됩니다:

속성
author 인증된 사용자
title 취약점 탐지의 name 속성
state opened
severity 취약점 탐지의 severity 속성
confidence 취약점 탐지의 confidence 속성
curl --header POST "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/vulnerabilities?finding_id=1"

예시 응답:

{
    "author_id": 1,
    "confidence": "medium",
    "created_at": "2020-04-07T14:01:04.655Z",
    "description": null,
    "dismissed_at": null,
    "dismissed_by_id": null,
    "finding": {
        "confidence": "medium",
        "created_at": "2020-04-07T14:01:04.630Z",
        "id": 103,
        "location_fingerprint": "228998b5db51d86d3b091939e2f5873ada0a14a1",
        "metadata_version": "2.0",
        "name": "디버그에서의 정규 표현식 서비스 거부",
        "primary_identifier_id": 135,
        "project_fingerprint": "05e7cc9978ca495cf739a9f707ed34811e41c615",
        "project_id": 24,
        "raw_metadata": "{\"category\":\"dependency_scanning\",\"name\":\"Regular Expression Denial of Service\",\"message\":\"Regular Expression Denial of Service in debug\",\"description\":\"The debug module is vulnerable to regular expression denial of service when untrusted user input is passed into the `o` formatter. It takes around 50k characters to block for 2 seconds making this a low severity issue.\",\"cve\":\"yarn.lock:debug:gemnasium:37283ed4-0380-40d7-ada7-2d994afcc62a\",\"severity\":\"Unknown\",\"solution\":\"Upgrade to latest versions.\",\"scanner\":{\"id\":\"gemnasium\",\"name\":\"Gemnasium\"},\"location\":{\"file\":\"yarn.lock\",\"dependency\":{\"package\":{\"name\":\"debug\"},\"version\":\"1.0.5\"}},\"identifiers\":[{\"type\":\"gemnasium\",\"name\":\"Gemnasium-37283ed4-0380-40d7-ada7-2d994afcc62a\",\"value\":\"37283ed4-0380-40d7-ada7-2d994afcc62a\",\"url\":\"https://deps.sec.gitlab.com/packages/npm/debug/versions/1.0.5/advisories\"}],\"links\":[{\"url\":\"https://nodesecurity.io/advisories/534\"},{\"url\":\"https://github.com/visionmedia/debug/issues/501\"},{\"url\":\"https://github.com/visionmedia/debug/pull/504\"}],\"remediations\":[null]}",
        "report_type": "dependency_scanning",
        "scanner_id": 63,
        "severity": "low",
        "updated_at": "2020-04-07T14:01:04.664Z",
        "uuid": "f1d528ae-d0cc-47f6-a72f-936cec846ae7",
        "vulnerability_id": 103
    },
    "id": 103,
    "project": {
        "created_at": "2020-04-07T13:54:25.634Z",
        "description": "",
        "id": 24,
        "name": "security-reports",
        "name_with_namespace": "gitlab-org / security-reports",
        "path": "security-reports",
        "path_with_namespace": "gitlab-org/security-reports"
    },
    "project_default_branch": "main",
    "report_type": "dependency_scanning",
    "resolved_at": null,
    "resolved_by_id": null,
    "resolved_on_default_branch": false,
    "severity": "low",
    "state": "detected",
    "title": "디버그에서의 정규 표현식 서비스 거부",
    "updated_at": "2020-04-07T14:01:04.655Z"
}

오류

이 오류는 선택한 Finding이 존재하지 않거나 이미 다른 Vulnerability에 연결되어 있을 때 발생합니다:

Vulnerability Finding이 존재하지 않거나 이미 다른 Vulnerability에 연결되어 있습니다.

상태 코드: 400

예시 응답:

{
  "message": {
    "base": [
      "finding is not found or is already attached to a vulnerability"
    ]
  }
}