Object: severitycountsobject.py - Object container for severity counts

Purpose:

This module provides the object implementation for the SeverityCounts object.

This object is used as a storage container and accessor to the number of vulnerabilities for each severity class, for a given project or release.

Platform:

Linux/Windows | Python 3.8+

Developer:

J Berendt

Email:

development@s3dev.uk

Comments:

n/a

class SeverityCountsObject(vulns: list)[source]

Bases: object

Container and accessor class for vulnerability severity counts.

Parameters:

vulns (list) –

A list of dictionary objects containing the vulnerabilities for a given project or release. Note, this is expected to be a list of dict objects, each containing at least a 'severity' key. The case of the severity string value does not matter.

Example expected minimal vulns structure:

[
 {'severity': 'Low'},
 ...,
 {'severity': 'High'}
]

Expected severity string values:

  • Low

  • Moderate or Medium

  • High

  • Critical

property low: int

Accessor to the number of LOW severity class entries.

property moderate: int

Accessor to the number of MODERATE severity class entries.

This accessor applies to both the MODERATE and MEDIUM classes.

property high: int

Accessor to the number of HIGH severity class entries.

property critical: int

Accessor to the number of CRITICAL severity class entries.

property total: int

Accessor to the TOTAL number of vulnerabilities for a release.

_set(vulns: list) None[source]

Set the vulnerability counts based on the input data.

Parameters:

vulns (list) – The vulns list passed into the class.