프로젝트 취약성 API

Tier: Ultimate Offering: GitLab.com, Self-Managed, GitLab Dedicated
History
caution
이 API는 폐기되었으며 불안정한 것으로 간주됩니다. 응답 페이로드는 GitLab의 릴리스 간에 바뀔 수 있거나 손상될 수 있습니다. 대신 GraphQL 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": "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"
    }
]

새로운 취약성

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

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

POST /projects/:id/vulnerabilities?finding_id=<your_finding_id>
속성 유형 필수 설명
id 정수 또는 문자열 인증된 사용자가 구성원으로 있는 프로젝트의 ID 또는 URL 인코딩된 경로
finding_id 정수 또는 문자열 새로운 취약성을 생성하기 위한 취약성 판단(Finding)의 ID

새로 생성된 취약성의 다른 속성은 해당 출처 취약성 판단(Finding)에서 채워지거나 다음의 기본값으로 설정됩니다:

속성
author 인증된 사용자
title 취약성 판단(Finding)의 name 속성
state opened
severity 취약성 판단(Finding)의 severity 속성
confidence 취약성 판단(Finding)의 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": [
      "결함을 찾을 수 없거나 이미 취약점에 연결되어 있습니다"
    ]
  }
}