Skip to main content
이제 REST API의 버전이 지정되었습니다. 자세한 내용은 "API 버전 관리 정보"를 참조하세요.

종속성 제출에 대한 REST API 엔드포인트

REST API를 사용하여 종속성을 제출합니다.

종속성 제출 정보

REST API를 사용하여 프로젝트에 대한 종속성을 제출할 수 있습니다. 이를 통해 소프트웨어가 컴파일되거나 빌드될 때 확인된 종속성 등의 종속성을 GitHub의 종속성 그래프 기능에 추가하여 프로젝트의 모든 종속성을 보다 완벽하게 파악할 수 있습니다.

종속성 그래프는 리포지토리의 매니페스트 또는 잠금 파일(예: JavaScript 프로젝트의 package-lock.json 파일)에서 식별되는 종속성 외에 API를 사용하여 제출하는 모든 종속성을 보여 줍니다. 종속성 그래프 보기에 대한 자세한 내용은 리포지토리의 종속성 탐색을(를) 참조하세요.

제출된 종속성은 알려진 취약성에 대해 Dependabot alerts 및 Dependabot security updates를 받게 됩니다. GitHub Advisory Database의 지원되는 에코시스템 중 하나에서 발생한 종속성에 대한 Dependabot alerts만 가져옵니다. 이러한 에코시스템에 대한 자세한 내용은 GitHub Advisory Database 정보을(를) 참조하세요. 종속성 제출 API을(를) 통해 제출된 전환 종속성의 경우 업데이트를 사용할 수 있으면 Dependabot에서 자동으로 끌어오기 요청을 열어 상위 종속성을 업데이트합니다.

제출된 종속성은 종속성 검토에 표시되지만, 조직의 종속성 인사이트에서는 사용할 수 없습니다.

Note

종속성 제출 API 및 종속성 검토 API는 함께 작동합니다. 즉, 종속성 검토 API에는 종속성 제출 API을(를) 통해 제출된 종속성이 포함됩니다.

스냅샷 형식으로 종속성을 제출할 수 있습니다. 스냅샷은 커밋 SHA 및 기타 메타데이터와 연결된 종속성 집합으로, 커밋에 대한 리포지토리의 현재 상태를 반영합니다. 미리 만들어진 작업을 사용하거나 프로젝트를 빌드할 때마다 고유한 작업을 만들어 종속성을 필요한 형식으로 제출할 수 있습니다. 자세한 내용은 종속성 제출 API 사용을(를) 참조하세요.

종속성 그래프에 포함할 여러 종속성 집합을 제출할 수 있습니다. 이 REST API는 스냅샷의 job.correlator 속성 및 detector.name 범주를 사용하여 각 워크플로에 대한 최신 제출이 표시되도록 합니다. correlator 속성 자체는 독립적인 제출을 고유하게 유지하는 데 사용하는 기본 필드입니다. 예를 들어 correlator은 작업 실행 <GITHUB_WORKFLOW> <GITHUB_JOB>에서 사용할 수 있는 두 변수의 간단한 조합일 수 있습니다.

Create a snapshot of dependencies for a repository

Create a new snapshot of a repository's dependencies.

The authenticated user must have access to the repository.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

"Create a snapshot of dependencies for a repository"에 대한 세분화된 액세스 토큰

이 엔드포인트는 다음 세분화된 토큰 형식에서 작동합니다.:

세분화된 토큰에는 다음 권한 집합이 있어야 합니다.:

  • "Contents" repository permissions (write)

"Create a snapshot of dependencies for a repository"에 대한 매개 변수

머리글
속성, 형식, 설명
accept string

Setting to application/vnd.github+json is recommended.

경로 매개 변수
속성, 형식, 설명
owner string Required

The account owner of the repository. The name is not case sensitive.

repo string Required

The name of the repository without the .git extension. The name is not case sensitive.

본문 매개 변수
속성, 형식, 설명
version integer Required

The version of the repository snapshot submission.

job object Required
속성, 형식, 설명
id string Required

The external ID of the job.

correlator string Required

Correlator provides a key that is used to group snapshots submitted over time. Only the "latest" submitted snapshot for a given combination of job.correlator and detector.name will be considered when calculating a repository's current dependencies. Correlator should be as unique as it takes to distinguish all detection runs for a given "wave" of CI workflow you run. If you're using GitHub Actions, a good default value for this could be the environment variables GITHUB_WORKFLOW and GITHUB_JOB concatenated together. If you're using a build matrix, then you'll also need to add additional key(s) to distinguish between each submission inside a matrix variation.

html_url string

The url for the job.

sha string Required

The commit SHA associated with this dependency snapshot. Maximum length: 40 characters.

ref string Required

The repository branch that triggered this snapshot.

detector object Required

A description of the detector used.

속성, 형식, 설명
name string Required

The name of the detector used.

version string Required

The version of the detector used.

url string Required

The url of the detector used.

metadata object

User-defined metadata to store domain-specific information limited to 8 keys with scalar values.

manifests object

A collection of package manifests, which are a collection of related dependencies declared in a file or representing a logical group of dependencies.

속성, 형식, 설명
key object

A user-defined key to represent an item in manifests.

속성, 형식, 설명
name string Required

The name of the manifest.

file object
속성, 형식, 설명
source_location string

The path of the manifest file relative to the root of the Git repository.

metadata object

User-defined metadata to store domain-specific information limited to 8 keys with scalar values.

resolved object

A collection of resolved package dependencies.

속성, 형식, 설명
key object

A user-defined key to represent an item in resolved.

속성, 형식, 설명
package_url string

Package-url (PURL) of dependency. See https://github.com/package-url/purl-spec for more details.

metadata object

User-defined metadata to store domain-specific information limited to 8 keys with scalar values.

relationship string

A notation of whether a dependency is requested directly by this manifest or is a dependency of another dependency.

다음 중 하나일 수 있습니다.: direct, indirect

scope string

A notation of whether the dependency is required for the primary build artifact (runtime) or is only used for development. Future versions of this specification may allow for more granular scopes.

다음 중 하나일 수 있습니다.: runtime, development

dependencies array of strings

Array of package-url (PURLs) of direct child dependencies.

scanned string Required

The time at which the snapshot was scanned.

"Create a snapshot of dependencies for a repository"에 대한 HTTP 응답 상태 코드

상태 코드설명
201

Created

"Create a snapshot of dependencies for a repository"에 대한 코드 샘플

GHE.com에서 GitHub에 액세스하는 경우 api.github.comapi.SUBDOMAIN.ghe.com의 엔터프라이즈 전용 하위 도메인으로 바꾸세요.

요청 예제

post/repos/{owner}/{repo}/dependency-graph/snapshots
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/dependency-graph/snapshots \ -d '{"version":0,"sha":"ce587453ced02b1526dfb4cb910479d431683101","ref":"refs/heads/main","job":{"correlator":"yourworkflowname_youractionname","id":"yourrunid"},"detector":{"name":"octo-detector","version":"0.0.1","url":"https://github.com/octo-org/octo-repo"},"scanned":"2022-06-14T20:25:00Z","manifests":{"package-lock.json":{"name":"package-lock.json","file":{"source_location":"src/package-lock.json"},"resolved":{"@actions/core":{"package_url":"pkg:/npm/%40actions/core@1.1.9","dependencies":["@actions/http-client"]},"@actions/http-client":{"package_url":"pkg:/npm/%40actions/http-client@1.0.7","dependencies":["tunnel"]},"tunnel":{"package_url":"pkg:/npm/tunnel@0.0.6"}}}}}'

Response

Status: 201
{ "id": 12345, "created_at": "2018-05-04T01:14:52Z", "message": "Dependency results for the repo have been successfully updated.", "result": "SUCCESS" }