Skip to content

Commit 9b53f52

Browse files
authored
Add CVSS Qualitative Severity Rating Scale decision point (#712)
* add CVSS qualitative severity as a decision point * make json in `example_block()` optional * markdownlint * add qualitative severity link to cvss/index.md
1 parent 3fd228b commit 9b53f52

File tree

5 files changed

+101
-8
lines changed

5 files changed

+101
-8
lines changed

docs/reference/decision_points/cvss/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ We have organized them into groups according to where they belong in the
2323
been refined over different versions of the CVSS specification. These versions
2424
do _not_ correspond the CVSS specification versions (2.0, 3.0, 3.1, 4.0 etc.).
2525

26+
### Qualitative Severity
27+
28+
<div class="grid cards" markdown>
29+
- [CVSS Qualitative Severity Rating Scale](qualitative_severity.md)
30+
</div>
31+
2632
### Base Metrics
2733

2834
<div class="grid cards" markdown>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# CVSS Qualitative Severity Rating Scale
2+
3+
```python exec="true" idprefix=""
4+
from ssvc.decision_points.cvss.qualitative_severity import LATEST
5+
from ssvc.doc_helpers import example_block
6+
7+
print(example_block(LATEST))
8+
```
9+
10+
The [CVSS Qualitative Severity Rating Scale](https://www.first.org/cvss/v4.0/specification-document#Qualitative-Severity-Rating-Scale)
11+
is a set of labels that describe the severity of a vulnerability based on the
12+
CVSS Score.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ nav:
7373
- Utility: 'reference/decision_points/utility.md'
7474
- CVSS-based decision points:
7575
- 'reference/decision_points/cvss/index.md'
76+
- Qualitative Severity: 'reference/decision_points/cvss/qualitative_severity.md'
7677
- Base Metrics:
7778
- Attack Vector: 'reference/decision_points/cvss/attack_vector.md'
7879
- Attack Complexity: 'reference/decision_points/cvss/attack_complexity.md'
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env python
2+
"""
3+
Provides a decision point for the [CVSS Qualitative Severity Rating Scale](https://www.first.org/cvss/v4.0/specification-document#Qualitative-Severity-Rating-Scale).
4+
"""
5+
# Copyright (c) 2025 Carnegie Mellon University and Contributors.
6+
# - see Contributors.md for a full list of Contributors
7+
# - see ContributionInstructions.md for information on how you can Contribute to this project
8+
# Stakeholder Specific Vulnerability Categorization (SSVC) is
9+
# licensed under a MIT (SEI)-style license, please see LICENSE.md distributed
10+
# with this Software or contact [email protected] for full terms.
11+
# Created, in part, with funding and support from the United States Government
12+
# (see Acknowledgments file). This program may include and/or can make use of
13+
# certain third party source code, object code, documentation and other files
14+
# (“Third Party Software”). See LICENSE.md for more details.
15+
# Carnegie Mellon®, CERT® and CERT Coordination Center® are registered in the
16+
# U.S. Patent and Trademark Office by Carnegie Mellon University
17+
18+
from ssvc.decision_points import SsvcDecisionPointValue
19+
from ssvc.decision_points.cvss.base import CvssDecisionPoint
20+
from ssvc.decision_points.helpers import print_versions_and_diffs
21+
22+
QS_NONE = SsvcDecisionPointValue(
23+
name="None",
24+
key="N",
25+
description="No severity rating (0.0)",
26+
)
27+
28+
LOW = SsvcDecisionPointValue(
29+
name="Low",
30+
key="L",
31+
description="Low (0.1 - 3.9)",
32+
)
33+
MEDIUM = SsvcDecisionPointValue(
34+
name="Medium",
35+
key="M",
36+
description="Medium (4.0 - 6.9)",
37+
)
38+
HIGH = SsvcDecisionPointValue(
39+
name="High",
40+
key="H",
41+
description="High (7.0 - 8.9)",
42+
)
43+
CRITICAL = SsvcDecisionPointValue(
44+
name="Critical",
45+
key="C",
46+
description="Critical (9.0 - 10.0)",
47+
)
48+
49+
QUALITATIVE_SEVERITY = CvssDecisionPoint(
50+
name="CVSS Qualitative Severity Rating Scale",
51+
key="QS",
52+
description="The CVSS Qualitative Severity Rating Scale provides "
53+
"a categorical representation of a CVSS Score.",
54+
version="1.0.0",
55+
values=(
56+
QS_NONE,
57+
LOW,
58+
MEDIUM,
59+
HIGH,
60+
CRITICAL,
61+
),
62+
)
63+
64+
VERSIONS = (QUALITATIVE_SEVERITY,)
65+
LATEST = VERSIONS[-1]
66+
67+
68+
def main():
69+
print_versions_and_diffs(VERSIONS)
70+
71+
72+
if __name__ == "__main__":
73+
main()

src/ssvc/doc_helpers.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ def example_block_tabbed(dp: SsvcDecisionPoint, indent=4) -> str:
6969
return "\n".join(rows)
7070

7171

72-
def example_block(dp: SsvcDecisionPoint, indent=4) -> str:
72+
def example_block(
73+
dp: SsvcDecisionPoint, indent: int = 4, include_json: bool = True
74+
) -> str:
7375
"""Given a decision point, return a markdown block that contains an example of the decision point."""
7476

75-
indent_ = " " * 4
77+
indent_ = " " * indent
7678
rows = []
7779
rows.append(f'!!! note "{dp.name} v{dp.version}"')
7880
rows.append("")
@@ -81,12 +83,11 @@ def example_block(dp: SsvcDecisionPoint, indent=4) -> str:
8183
rows.append(indent_ + row)
8284
rows.append("")
8385

84-
rows.append(
85-
indent_ + f'??? example "{dp.name} v{dp.version} JSON Example"'
86-
)
87-
rows.append("")
88-
for row in json_example(dp, indent=4).splitlines():
89-
rows.append(indent_ + row)
86+
if include_json:
87+
rows.append(indent_ + f'??? example "{dp.name} v{dp.version} JSON Example"')
88+
rows.append("")
89+
for row in json_example(dp, indent=4).splitlines():
90+
rows.append(indent_ + row)
9091

9192
return "\n".join(rows)
9293

0 commit comments

Comments
 (0)