InfoGrab Docs

취약점 API

요약

이전 취약점 API는 취약점 발견 API로 이름이 변경되었으며, 문서는 다른 위치로 이동되었습니다. 취약점에 대한 모든 API 호출은 인증이 필요합니다. 인증된 사용자가 취약점 보고서 보기 권한이 없는 경우, 이 요청은 403 Forbidden 상태 코드를 반환합니다.

히스토리
  • 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에서 폐기.
Note

이전 취약점 API는 취약점 발견 API로 이름이 변경되었으며, 문서는 다른 위치로 이동되었습니다. 이 문서는 이제 취약점에 대한 접근을 제공하는 새 취약점 API를 설명합니다.

취약점에 대한 모든 API 호출은 인증이 필요합니다.

인증된 사용자가 취약점 보고서 보기 권한이 없는 경우, 이 요청은 403 Forbidden 상태 코드를 반환합니다.

Warning

이 API는 폐기 중이며 불안정한 것으로 간주됩니다. 응답 페이로드는 GitLab 릴리스에 따라 변경되거나 중단될 수 있습니다. 대신 GraphQL API를 사용하세요. 자세한 내용은 GraphQL 예시를 참조하세요.

취약점 조회#

지정된 취약점을 조회합니다.

GET /vulnerabilities/:id
속성 유형 필수 설명
id integer or string 가져올 취약점의 ID
curl --request GET \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 integer or string 확인할 취약점의 ID
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 integer or string 해결할 취약점의 ID
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 integer or string 기각할 취약점의 ID
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 integer or string 감지 상태로 되돌릴 취약점의 ID
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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로 대체#

취약점 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": "Improper Input Validation in railties",
      "description": "A remote code execution vulnerability in development mode Rails beta3 can allow an attacker to guess the automatically generated development mode secret token. This secret token can be used in combination with other Rails internals to escalate to a remote code execution exploit.",
      "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": []
    }
  }
}

취약점 API

Tier: Ultimate
Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
원문 보기
요약

이전 취약점 API는 취약점 발견 API로 이름이 변경되었으며, 문서는 다른 위치로 이동되었습니다. 취약점에 대한 모든 API 호출은 인증이 필요합니다. 인증된 사용자가 취약점 보고서 보기 권한이 없는 경우, 이 요청은 403 Forbidden 상태 코드를 반환합니다.

히스토리
  • 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에서 폐기.
Note

이전 취약점 API는 취약점 발견 API로 이름이 변경되었으며, 문서는 다른 위치로 이동되었습니다. 이 문서는 이제 취약점에 대한 접근을 제공하는 새 취약점 API를 설명합니다.

취약점에 대한 모든 API 호출은 인증이 필요합니다.

인증된 사용자가 취약점 보고서 보기 권한이 없는 경우, 이 요청은 403 Forbidden 상태 코드를 반환합니다.

Warning

이 API는 폐기 중이며 불안정한 것으로 간주됩니다. 응답 페이로드는 GitLab 릴리스에 따라 변경되거나 중단될 수 있습니다. 대신 GraphQL API를 사용하세요. 자세한 내용은 GraphQL 예시를 참조하세요.

취약점 조회#

지정된 취약점을 조회합니다.

GET /vulnerabilities/:id
속성 유형 필수 설명
id integer or string 가져올 취약점의 ID
curl --request GET \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 integer or string 확인할 취약점의 ID
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 integer or string 해결할 취약점의 ID
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 integer or string 기각할 취약점의 ID
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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 integer or string 감지 상태로 되돌릴 취약점의 ID
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "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로 대체#

취약점 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": "Improper Input Validation in railties",
      "description": "A remote code execution vulnerability in development mode Rails beta3 can allow an attacker to guess the automatically generated development mode secret token. This secret token can be used in combination with other Rails internals to escalate to a remote code execution exploit.",
      "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": []
    }
  }
}