Skip to main content

repository_advisories

Creates, updates, deletes, gets or lists a repository_advisories resource.

Overview

Namerepository_advisories
TypeResource
Idgithub.security_advisories.repository_advisories

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
cve_idstringThe Common Vulnerabilities and Exposures (CVE) ID.
ghsa_idstringThe GitHub Security Advisory ID.
authorobjectThe author of the advisory. (title: Simple User)
closed_atstring (date-time)The date and time of when the advisory was closed, in ISO 8601 format.
collaborating_teamsarrayA list of teams that collaborate on the advisory.
collaborating_usersarrayA list of users that collaborate on the advisory.
created_atstring (date-time)The date and time of when the advisory was created, in ISO 8601 format.
creditsarray
credits_detailedarray
cvssobject
cvss_severitiesobject
cwe_idsarrayA list of only the CWE IDs.
cwesarray
descriptionstringA detailed description of what the advisory entails.
html_urlstring (uri)The URL for the advisory.
identifiersarray
private_forkobjectA temporary private fork of the advisory's repository for collaborating on a fix. (title: Simple Repository)
published_atstring (date-time)The date and time of when the advisory was published, in ISO 8601 format.
publisherobjectThe publisher of the advisory. (title: Simple User)
severitystringThe severity of the advisory. (critical, high, medium, low)
statestringThe state of the advisory. (published, closed, withdrawn, draft, triage)
submissionobject
summarystringA short summary of the advisory.
updated_atstring (date-time)The date and time of when the advisory was last updated, in ISO 8601 format.
urlstring (uri)The API URL for the advisory.
vulnerabilitiesarray
withdrawn_atstring (date-time)The date and time of when the advisory was withdrawn, in ISO 8601 format.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_repository_advisoryselectowner, repo, ghsa_idGet a repository security advisory using its GitHub Security Advisory (GHSA) identifier.

Anyone can access any published security advisory on a public repository.

The authenticated user can access an unpublished security advisory from a repository if they are a security manager or administrator of that repository, or if they are a
collaborator on the security advisory.

OAuth app tokens and personal access tokens (classic) need the repo or repository_advisories:read scope to to get a published security advisory in a private repository, or any unpublished security advisory that the authenticated user has access to.
list_repository_advisoriesselectowner, repodirection, sort, before, after, per_page, stateLists security advisories in a repository.

The authenticated user can access unpublished security advisories from a repository if they are a security manager or administrator of that repository, or if they are a collaborator on any security advisory.

OAuth app tokens and personal access tokens (classic) need the repo or repository_advisories:read scope to to get a published security advisory in a private repository, or any unpublished security advisory that the authenticated user has access to.
list_org_repository_advisoriesselectorgdirection, sort, before, after, per_page, stateLists repository security advisories for an organization.

The authenticated user must be an owner or security manager for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the repo or repository_advisories:write scope to use this endpoint.
create_repository_advisory_cve_requestinsertowner, repo, ghsa_idIf you want a CVE identification number for the security vulnerability in your project, and don't already have one, you can request a CVE identification number from GitHub. For more information see "Requesting a CVE identification number."

You may request a CVE for public repositories, but cannot do so for private repositories.

In order to request a CVE for a repository security advisory, the authenticated user must be a security manager or administrator of that repository.

OAuth app tokens and personal access tokens (classic) need the repo or repository_advisories:write scope to use this endpoint.
create_repository_advisoryinsertowner, repo, summary, description, vulnerabilitiesCreates a new repository security advisory.

In order to create a draft repository security advisory, the authenticated user must be a security manager or administrator of that repository.

OAuth app tokens and personal access tokens (classic) need the repo or repository_advisories:write scope to use this endpoint.
update_repository_advisoryupdateowner, repo, ghsa_idUpdate a repository security advisory using its GitHub Security Advisory (GHSA) identifier.

In order to update any security advisory, the authenticated user must be a security manager or administrator of that repository,
or a collaborator on the repository security advisory.

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

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
ghsa_idstringThe GHSA (GitHub Security Advisory) identifier of the advisory.
orgstringThe organization name. The name is not case sensitive.
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository without the .git extension. The name is not case sensitive.
afterstringA cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."
beforestringA cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
directionstringThe direction to sort the results by.
per_pageintegerThe number of advisories to return per page. For more information, see "Using pagination in the REST API."
sortstringThe property to sort the results by.
statestringFilter by the state of the repository advisories. Only advisories of this state will be returned.

SELECT examples

Get a repository security advisory using its GitHub Security Advisory (GHSA) identifier.

Anyone can access any published security advisory on a public repository.

The authenticated user can access an unpublished security advisory from a repository if they are a security manager or administrator of that repository, or if they are a
collaborator on the security advisory.

OAuth app tokens and personal access tokens (classic) need the repo or repository_advisories:read scope to to get a published security advisory in a private repository, or any unpublished security advisory that the authenticated user has access to.

SELECT
cve_id,
ghsa_id,
author,
closed_at,
collaborating_teams,
collaborating_users,
created_at,
credits,
credits_detailed,
cvss,
cvss_severities,
cwe_ids,
cwes,
description,
html_url,
identifiers,
private_fork,
published_at,
publisher,
severity,
state,
submission,
summary,
updated_at,
url,
vulnerabilities,
withdrawn_at
FROM github.security_advisories.repository_advisories
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND ghsa_id = '{{ ghsa_id }}' -- required
;

INSERT examples

If you want a CVE identification number for the security vulnerability in your project, and don't already have one, you can request a CVE identification number from GitHub. For more information see "Requesting a CVE identification number."

You may request a CVE for public repositories, but cannot do so for private repositories.

In order to request a CVE for a repository security advisory, the authenticated user must be a security manager or administrator of that repository.

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

INSERT INTO github.security_advisories.repository_advisories (
owner,
repo,
ghsa_id
)
SELECT
'{{ owner }}',
'{{ repo }}',
'{{ ghsa_id }}'
;

UPDATE examples

Update a repository security advisory using its GitHub Security Advisory (GHSA) identifier.

In order to update any security advisory, the authenticated user must be a security manager or administrator of that repository,
or a collaborator on the repository security advisory.

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

UPDATE github.security_advisories.repository_advisories
SET
summary = '{{ summary }}',
description = '{{ description }}',
cve_id = '{{ cve_id }}',
vulnerabilities = '{{ vulnerabilities }}',
cwe_ids = '{{ cwe_ids }}',
credits = '{{ credits }}',
severity = '{{ severity }}',
cvss_vector_string = '{{ cvss_vector_string }}',
state = '{{ state }}',
collaborating_users = '{{ collaborating_users }}',
collaborating_teams = '{{ collaborating_teams }}'
WHERE
owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND ghsa_id = '{{ ghsa_id }}' --required
RETURNING
cve_id,
ghsa_id,
author,
closed_at,
collaborating_teams,
collaborating_users,
created_at,
credits,
credits_detailed,
cvss,
cvss_severities,
cwe_ids,
cwes,
description,
html_url,
identifiers,
private_fork,
published_at,
publisher,
severity,
state,
submission,
summary,
updated_at,
url,
vulnerabilities,
withdrawn_at;