취약점 API
이 문서는 이제 Vulnerabilities에 대한 액세스를 제공하는 새로운 취약점 API를 설명합니다.
응답 페이로드는 GitLab 릴리스 전후로 변경되거나 중단될 수 있습니다.
대신 GraphQL API를 사용하십시오.
자세한 내용은 GraphQL 예제를 참조하십시오.
모든 취약점에 대한 API 호출은 인증되어야 합니다.
인증된 사용자가 취약점을 볼 수 있는 권한이 없는 경우,
이 요청은 403 Forbidden
상태 코드를 반환합니다.
단일 취약점
단일 취약점을 가져옵니다
GET /vulnerabilities/:id
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수 또는 문자열 | 예 | 가져올 취약점의 ID |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/vulnerabilities/1"
예시 응답:
{
"id": 1,
"title": "예측 가능한 의사 난수 생성기",
"description": null,
"state": "opened",
"severity": "medium",
"confidence": "medium",
"report_type": "sast",
"project": {
"id": 32,
"name": "security-reports",
"full_path": "/gitlab-examples/security/security-reports",
"full_name": "gitlab-examples / security / security-reports"
},
"author_id": 1,
"closed_by_id": null,
"created_at": "2019-10-13T15:08:40.219Z",
"updated_at": "2019-10-13T15:09:40.382Z",
"closed_at": null
}
취약점 확인
주어진 취약점을 확인합니다.
취약점이 이미 확인되었다면 상태 코드 304
를 반환합니다.
인증된 사용자가 취약점을 확인할 권한이 없는 경우,
이 요청은 403
상태 코드를 발생시킵니다.
POST /vulnerabilities/:id/confirm
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수 또는 문자열 | 예 | 확인할 취약점의 ID |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/vulnerabilities/5/confirm"
예시 응답:
{
"id": 2,
"title": "예측 가능한 의사 난수 생성기",
"description": null,
"state": "confirmed",
"severity": "medium",
"confidence": "medium",
"report_type": "sast",
"project": {
"id": 32,
"name": "security-reports",
"full_path": "/gitlab-examples/security/security-reports",
"full_name": "gitlab-examples / security / security-reports"
},
"author_id": 1,
"closed_by_id": null,
"created_at": "2019-10-13T15:08:40.219Z",
"updated_at": "2019-10-13T15:09:40.382Z",
"closed_at": null
}
취약점 해결
주어진 취약점을 해결합니다. 취약점이 이미 해결된 경우 상태 코드 304
를 반환합니다.
인증된 사용자가
취약점을 해결할 권한이 없는 경우,
이 요청은 403
상태 코드로 결과가 나타납니다.
POST /vulnerabilities/:id/resolve
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수 또는 문자열 | 예 | 해결할 취약점의 ID |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/vulnerabilities/5/resolve"
예시 응답:
{
"id": 2,
"title": "예측 가능한 의사 난수 생성기",
"description": null,
"state": "resolved",
"severity": "medium",
"confidence": "medium",
"report_type": "sast",
"project": {
"id": 32,
"name": "보안 리포트",
"full_path": "/gitlab-examples/security/security-reports",
"full_name": "gitlab-examples / security / security-reports"
},
"author_id": 1,
"closed_by_id": null,
"created_at": "2019-10-13T15:08:40.219Z",
"updated_at": "2019-10-13T15:09:40.382Z",
"closed_at": null
}
취약점 기각
주어진 취약점을 기각합니다. 취약점이 이미 기각된 경우 상태 코드 304
를 반환합니다.
인증된 사용자가
취약점을 기각할 권한이 없는 경우,
이 요청은 403
상태 코드로 결과가 나타납니다.
POST /vulnerabilities/:id/dismiss
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수 또는 문자열 | 예 | 기각할 취약점의 ID |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/vulnerabilities/5/dismiss"
예시 응답:
{
"id": 2,
"title": "예측 가능한 의사 난수 생성기",
"description": null,
"state": "closed",
"severity": "medium",
"confidence": "medium",
"report_type": "sast",
"project": {
"id": 32,
"name": "보안 리포트",
"full_path": "/gitlab-examples/security/security-reports",
"full_name": "gitlab-examples / security / security-reports"
},
"author_id": 1,
"closed_by_id": null,
"created_at": "2019-10-13T15:08:40.219Z",
"updated_at": "2019-10-13T15:09:40.382Z",
"closed_at": null
}
취약점을 탐지 상태로 되돌리기
주어진 취약점을 탐지 상태로 되돌립니다. 이미 탐지 상태인 경우 상태 코드 304
를 반환합니다.
인증된 사용자가
취약점을 탐지 상태로 되돌릴 권한이 없는 경우,
이 요청은 403
상태 코드로 결과가 나타납니다.
POST /vulnerabilities/:id/revert
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수 또는 문자열 | 예 | 탐지 상태로 되돌릴 취약점의 ID |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/vulnerabilities/5/revert"
예시 응답:
{
"id": 2,
"title": "예측 가능한 의사 난수 생성기",
"description": null,
"state": "detected",
"severity": "medium",
"confidence": "medium",
"report_type": "sast",
"project": {
"id": 32,
"name": "보안 리포트",
"full_path": "/gitlab-examples/security/security-reports",
"full_name": "gitlab-examples / security / security-reports"
},
"author_id": 1,
"closed_by_id": null,
"created_at": "2019-10-13T15:08:40.219Z",
"updated_at": "2019-10-13T15:09:40.382Z",
"closed_at": null
}
취약점 REST API를 GraphQL로 교체하기
Vulnerability REST API 엔드포인트의 예정된 사용 중지를 준비하기 위해 아래의 예제를 사용하여 GraphQL API로 동등한 작업을 수행하세요.
GraphQL - 단일 취약점
Query.vulnerability
를 사용하세요.
{
vulnerability(id: "gid://gitlab/Vulnerability/20345379") {
title
description
state
severity
reportType
project {
id
name
fullPath
}
detectedAt
confirmedAt
resolvedAt
resolvedBy {
id
username
}
}
}
예제 응답:
{
"data": {
"vulnerability": {
"title": "railties의 부적절한 입력 검증",
"description": "개발 모드 Rails beta3에서 원격 코드 실행 취약점이 공격자가 자동으로 생성된 개발 모드 비밀 토큰을 추측할 수 있게 합니다. 이 비밀 토큰은 다른 Rails 내부와 결합하여 원격 코드 실행 악용으로 상승할 수 있습니다.",
"state": "RESOLVED",
"severity": "CRITICAL",
"reportType": "DEPENDENCY_SCANNING",
"project": {
"id": "gid://gitlab/Project/6102100",
"name": "security-reports",
"fullPath": "gitlab-examples/security/security-reports"
},
"detectedAt": "2021-10-14T03:13:41Z",
"confirmedAt": "2021-12-14T01:45:56Z",
"resolvedAt": "2021-12-14T01:45:59Z",
"resolvedBy": {
"id": "gid://gitlab/User/480804",
"username": "thiagocsf"
}
}
}
}
GraphQL - 취약점 확인
Mutation.vulnerabilityConfirm
를 사용하세요.
mutation {
vulnerabilityConfirm(input: { id: "gid://gitlab/Vulnerability/23577695"}) {
vulnerability {
state
}
errors
}
}
예제 응답:
{
"data": {
"vulnerabilityConfirm": {
"vulnerability": {
"state": "CONFIRMED"
},
"errors": []
}
}
}
GraphQL - 취약점 해결
Mutation.vulnerabilityResolve
를 사용하세요.
mutation {
vulnerabilityResolve(input: { id: "gid://gitlab/Vulnerability/23577695"}) {
vulnerability {
state
}
errors
}
}
예제 응답:
{
"data": {
"vulnerabilityConfirm": {
"vulnerability": {
"state": "RESOLVED"
},
"errors": []
}
}
}
GraphQL - 취약점 기각
Mutation.vulnerabilityDismiss
를 사용하세요.
mutation {
vulnerabilityDismiss(input: { id: "gid://gitlab/Vulnerability/23577695"}) {
vulnerability {
state
}
errors
}
}
예제 응답:
{
"data": {
"vulnerabilityConfirm": {
"vulnerability": {
"state": "DISMISSED"
},
"errors": []
}
}
}
GraphQL - 취약성 되돌리기
Mutation.vulnerabilityRevertToDetected
을 사용하세요.
mutation {
vulnerabilityRevertToDetected(input: { id: "gid://gitlab/Vulnerability/20345379"}) {
vulnerability {
state
}
errors
}
}
예제 응답:
{
"data": {
"vulnerabilityConfirm": {
"vulnerability": {
"state": "DETECTED"
},
"errors": []
}
}
}