|
| 1 | +"""DO NOT EDIT THIS FILE! |
| 2 | +
|
| 3 | +This file is automatically @generated by githubkit using the follow command: |
| 4 | +
|
| 5 | +bash ./scripts/run-codegen.sh |
| 6 | +
|
| 7 | +See https://github.com/github/rest-api-description for more information. |
| 8 | +""" |
| 9 | + |
| 10 | +from __future__ import annotations |
| 11 | + |
| 12 | +import datetime as _dt |
| 13 | +from typing import Annotated, Literal, Union |
| 14 | + |
| 15 | +from pydantic import Field |
| 16 | + |
| 17 | +from githubkit.compat import GitHubModel, model_rebuild |
| 18 | +from githubkit.typing import Missing |
| 19 | +from githubkit.utils import UNSET |
| 20 | + |
| 21 | +from .group_0001 import CvssSeverities |
| 22 | +from .group_0002 import SecurityAdvisoryEpss |
| 23 | +from .group_0005 import GlobalAdvisoryPropCreditsItems |
| 24 | + |
| 25 | + |
| 26 | +class GlobalAdvisory(GitHubModel): |
| 27 | + """GlobalAdvisory |
| 28 | +
|
| 29 | + A GitHub Security Advisory. |
| 30 | + """ |
| 31 | + |
| 32 | + ghsa_id: str = Field(description="The GitHub Security Advisory ID.") |
| 33 | + cve_id: Union[str, None] = Field( |
| 34 | + description="The Common Vulnerabilities and Exposures (CVE) ID." |
| 35 | + ) |
| 36 | + url: str = Field(description="The API URL for the advisory.") |
| 37 | + html_url: str = Field(description="The URL for the advisory.") |
| 38 | + repository_advisory_url: Union[str, None] = Field( |
| 39 | + description="The API URL for the repository advisory." |
| 40 | + ) |
| 41 | + summary: str = Field( |
| 42 | + max_length=1024, description="A short summary of the advisory." |
| 43 | + ) |
| 44 | + description: Union[Annotated[str, Field(max_length=65535)], None] = Field( |
| 45 | + description="A detailed description of what the advisory entails." |
| 46 | + ) |
| 47 | + type: Literal["reviewed", "unreviewed", "malware"] = Field( |
| 48 | + description="The type of advisory." |
| 49 | + ) |
| 50 | + severity: Literal["critical", "high", "medium", "low", "unknown"] = Field( |
| 51 | + description="The severity of the advisory." |
| 52 | + ) |
| 53 | + source_code_location: Union[str, None] = Field( |
| 54 | + description="The URL of the advisory's source code." |
| 55 | + ) |
| 56 | + identifiers: Union[list[GlobalAdvisoryPropIdentifiersItems], None] = Field() |
| 57 | + references: Union[list[str], None] = Field() |
| 58 | + published_at: _dt.datetime = Field( |
| 59 | + description="The date and time of when the advisory was published, in ISO 8601 format." |
| 60 | + ) |
| 61 | + updated_at: _dt.datetime = Field( |
| 62 | + description="The date and time of when the advisory was last updated, in ISO 8601 format." |
| 63 | + ) |
| 64 | + github_reviewed_at: Union[_dt.datetime, None] = Field( |
| 65 | + description="The date and time of when the advisory was reviewed by GitHub, in ISO 8601 format." |
| 66 | + ) |
| 67 | + nvd_published_at: Union[_dt.datetime, None] = Field( |
| 68 | + description="The date and time when the advisory was published in the National Vulnerability Database, in ISO 8601 format.\nThis field is only populated when the advisory is imported from the National Vulnerability Database." |
| 69 | + ) |
| 70 | + withdrawn_at: Union[_dt.datetime, None] = Field( |
| 71 | + description="The date and time of when the advisory was withdrawn, in ISO 8601 format." |
| 72 | + ) |
| 73 | + vulnerabilities: Union[list[Vulnerability], None] = Field( |
| 74 | + description="The products and respective version ranges affected by the advisory." |
| 75 | + ) |
| 76 | + cvss_severities: Missing[Union[CvssSeverities, None]] = Field(default=UNSET) |
| 77 | + epss: Missing[Union[SecurityAdvisoryEpss, None]] = Field( |
| 78 | + default=UNSET, |
| 79 | + description="The EPSS scores as calculated by the [Exploit Prediction Scoring System](https://www.first.org/epss).", |
| 80 | + ) |
| 81 | + cwes: Union[list[GlobalAdvisoryPropCwesItems], None] = Field() |
| 82 | + credits_: Union[list[GlobalAdvisoryPropCreditsItems], None] = Field( |
| 83 | + alias="credits", description="The users who contributed to the advisory." |
| 84 | + ) |
| 85 | + |
| 86 | + |
| 87 | +class GlobalAdvisoryPropIdentifiersItems(GitHubModel): |
| 88 | + """GlobalAdvisoryPropIdentifiersItems""" |
| 89 | + |
| 90 | + type: Literal["CVE", "GHSA"] = Field(description="The type of identifier.") |
| 91 | + value: str = Field(description="The identifier value.") |
| 92 | + |
| 93 | + |
| 94 | +class GlobalAdvisoryPropCwesItems(GitHubModel): |
| 95 | + """GlobalAdvisoryPropCwesItems""" |
| 96 | + |
| 97 | + cwe_id: str = Field(description="The Common Weakness Enumeration (CWE) identifier.") |
| 98 | + name: str = Field(description="The name of the CWE.") |
| 99 | + |
| 100 | + |
| 101 | +class Vulnerability(GitHubModel): |
| 102 | + """Vulnerability |
| 103 | +
|
| 104 | + A vulnerability describing the product and its affected versions within a GitHub |
| 105 | + Security Advisory. |
| 106 | + """ |
| 107 | + |
| 108 | + package: Union[VulnerabilityPropPackage, None] = Field( |
| 109 | + description="The name of the package affected by the vulnerability." |
| 110 | + ) |
| 111 | + vulnerable_version_range: Union[str, None] = Field( |
| 112 | + description="The range of the package versions affected by the vulnerability." |
| 113 | + ) |
| 114 | + first_patched_version: Union[str, None] = Field( |
| 115 | + description="The package version that resolves the vulnerability." |
| 116 | + ) |
| 117 | + vulnerable_functions: Union[list[str], None] = Field( |
| 118 | + description="The functions in the package that are affected by the vulnerability." |
| 119 | + ) |
| 120 | + |
| 121 | + |
| 122 | +class VulnerabilityPropPackage(GitHubModel): |
| 123 | + """VulnerabilityPropPackage |
| 124 | +
|
| 125 | + The name of the package affected by the vulnerability. |
| 126 | + """ |
| 127 | + |
| 128 | + ecosystem: Literal[ |
| 129 | + "rubygems", |
| 130 | + "npm", |
| 131 | + "pip", |
| 132 | + "maven", |
| 133 | + "nuget", |
| 134 | + "composer", |
| 135 | + "go", |
| 136 | + "rust", |
| 137 | + "erlang", |
| 138 | + "actions", |
| 139 | + "pub", |
| 140 | + "other", |
| 141 | + "swift", |
| 142 | + ] = Field(description="The package's language or package management ecosystem.") |
| 143 | + name: Union[str, None] = Field( |
| 144 | + description="The unique package name within its ecosystem." |
| 145 | + ) |
| 146 | + |
| 147 | + |
| 148 | +model_rebuild(GlobalAdvisory) |
| 149 | +model_rebuild(GlobalAdvisoryPropIdentifiersItems) |
| 150 | +model_rebuild(GlobalAdvisoryPropCwesItems) |
| 151 | +model_rebuild(Vulnerability) |
| 152 | +model_rebuild(VulnerabilityPropPackage) |
| 153 | + |
| 154 | +__all__ = ( |
| 155 | + "GlobalAdvisory", |
| 156 | + "GlobalAdvisoryPropCwesItems", |
| 157 | + "GlobalAdvisoryPropIdentifiersItems", |
| 158 | + "Vulnerability", |
| 159 | + "VulnerabilityPropPackage", |
| 160 | +) |
0 commit comments