프로젝트 취약점 API

Tier: Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated
caution
이 API는 폐기(dedprecated) 프로세스에 있으며 불안정한 것으로 간주됩니다. 응답 내용은 GitLab 릴리스 간에 변경되거나 중단될 수 있습니다. 대신 GraphQL API를 사용하십시오.

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

취약점 권한은 해당 프로젝트의 권한을 상속합니다. 프로젝트가 비공개이고 사용자가 해당 프로젝트의 멤버가 아니면 해당 프로젝트로의 요청은 404 Not Found 상태 코드를 반환합니다.

취약점 페이지네이션

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

pagination에서 자세히 알아보기

프로젝트의 취약점 목록

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

인증된 사용자가 프로젝트 보안 대시보드를 사용할 수 없는 경우 이 프로젝트의 취약점에 대한 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,
        ...
    }
]

새 취약점

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

인증된 사용자가 새로운 취약점을 생성하는 권한을 가지지 않은 경우, 이 요청은 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": "Regular Expression Denial of Service in debug",
        "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": "Regular Expression Denial of Service in debug",
    "updated_at": "2020-04-07T14:01:04.655Z"
}

오류

이 오류는 취약점을 생성하기 위해 선택된 결함이 찾을 수 없거나 이미 다른 취약점과 연관되어 있는 경우 발생합니다:

취약점 발견이 찾을 수 없거나 이미 다른 취약점과 연관되어 있습니다

상태 코드: 400

예시 응답:

{
  "message": {
    "base": [
      "결함을 찾을 수 없거나 이미 취약점에 연결되어 있습니다"
    ]
  }
}