취약점 API
- GitLab 12.6에서 도입되었습니다.
last_edited_at
는 GitLab 16.7에서 사용이 중단되었습니다.start_date
는 GitLab 16.7에서 사용이 중단되었습니다.updated_by_id
는 GitLab 16.7에서 사용이 중단되었습니다.last_edited_by_id
는 GitLab 16.7에서 사용이 중단되었습니다.due_date
는 GitLab 16.7에서 사용이 중단되었습니다.
취약점에 대한 모든 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": "Predictable pseudorandom number generator",
"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": "Predictable pseudorandom number generator",
"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": "Predictable pseudorandom number generator",
"description": null,
"state": "resolved",
"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/dismiss
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id
| 정수 또는 문자열 | 예 | 해제할 취약점의 ID |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/vulnerabilities/5/dismiss"
예시 응답:
{
"id": 2,
"title": "Predictable pseudorandom number generator",
"description": null,
"state": "closed",
"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/revert
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id
| 정수 또는 문자열 | 예 | 감지된 상태로 복원할 취약점의 ID |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/vulnerabilities/5/revert"
예시 응답:
{
"id": 2,
"title": "Predictable pseudorandom number generator",
"description": null,
"state": "detected",
"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
}
취약점 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": "개발 모드 레일즈 beta3에서의 원격 코드 실행 취약점은 공격자가 자동으로 생성된 개발 모드 비밀 토큰을 추측할 수 있게 합니다. 이 비밀 토큰은 다른 레일즈 내부 기능과 결합하여 원격 코드 실행 익스플로잇으로 승격될 수 있습니다.",
"state": "해결됨",
"severity": "심각함",
"reportType": "의존성 스캐닝",
"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": "확인됨"
},
"errors": []
}
}
}
GraphQL - 취약점 해결
Mutation.vulnerabilityResolve
을 사용하세요.
mutation {
vulnerabilityResolve(input: { id: "gid://gitlab/Vulnerability/23577695"}) {
vulnerability {
state
}
errors
}
}
예시 응답:
{
"data": {
"vulnerabilityConfirm": {
"vulnerability": {
"state": "해결됨"
},
"errors": []
}
}
}
GraphQL - 취약점 해제
Mutation.vulnerabilityDismiss
을 사용하세요.
mutation {
vulnerabilityDismiss(input: { id: "gid://gitlab/Vulnerability/23577695"}) {
vulnerability {
state
}
errors
}
}
예시 응답:
{
"data": {
"vulnerabilityConfirm": {
"vulnerability": {
"state": "해제됨"
},
"errors": []
}
}
}
GraphQL - 취약점을 감지된 상태로 되돌리기
Mutation.vulnerabilityRevertToDetected
을 사용하세요.
mutation {
vulnerabilityRevertToDetected(input: { id: "gid://gitlab/Vulnerability/20345379"}) {
vulnerability {
state
}
errors
}
}
예시 응답:
{
"data": {
"vulnerabilityConfirm": {
"vulnerability": {
"state": "감지됨"
},
"errors": []
}
}
}