swh.vulns.osv.model module#

class swh.vulns.osv.model.BaseModel[source]#

Bases: object

to_dict()[source]#

Wrapper of attr.asdict that can be overridden by subclasses that have special handling of some of the fields.

classmethod from_dict(d)[source]#
evolve(**kwargs) ModelType[source]#

Alias to call attr.evolve() on this object, returning a new object.

check() None[source]#

Performs internal consistency checks, and raises an error if one fails.

class swh.vulns.osv.model.OSVVulnerabilityEvent(vulnerability_id: str, event_type: Literal['introduced', 'fixed', 'last_affected', 'limit'], origin_url: str, swhid: CoreSWHID | None = None, version: str | None = None, vulnerability_severity: Literal['CVSS_V2', 'CVSS_V3', 'CVSS_V4', 'Ubuntu'] | None = None)[source]#

Bases: BaseModel

Model that represents an OSV vulnerability event for a software origin.

See https://ossf.github.io/osv-schema/ for more details about the OSV database schema.

Method generated by attrs for class OSVVulnerabilityEvent.

vulnerability_id#

OSV vulnerability identifier

event_type#

Type of vulneraibility event

origin_url#

Software origin URL

swhid#

SWHID of software objects (either release or revision) related to the vulnerability event

version#

Optional software version associated to the SWHID

vulnerability_severity#

Severity of vulnerability

check_swhid(attribute, value)[source]#
to_dict()[source]#

Wrapper of attr.asdict that can be overridden by subclasses that have special handling of some of the fields.

classmethod from_dict(d)[source]#