Skip to content

Commit 07a0fce

Browse files
authored
Merge pull request #206 from Mab879/fix_174
Add CAT-X to severity
2 parents f5dd1bb + 7e0b606 commit 07a0fce

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

stigaview_static/html_output.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@
1212
from stigaview_static.utils import get_config, get_git_revision_short_hash
1313

1414

15+
def _severity_to_cat(severity: str) -> str:
16+
"""Convert severity level to DISA CAT level."""
17+
mapping = {"high": "CAT I", "medium": "CAT II", "low": "CAT III"}
18+
return mapping.get(severity.lower(), severity)
19+
20+
1521
def render_template(template: str, out_path: str, **kwargs):
1622
file_loader = FileSystemLoader("templates")
1723
env = Environment(loader=file_loader)
24+
env.filters["severity_to_cat"] = _severity_to_cat
1825
template = env.get_template(template)
1926
config = get_config()
2027
context = kwargs | config

templates/control.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ <h2>{{ control.title }}</h2>
66
<p>
77
<b>STIG ID:</b> {{ control.disa_stig_id }} &nbsp;|&nbsp;
88
<b>SRG: </b><a href="{{ control.srg.url }}">{{ control.srg.srg_id }}</a>&nbsp;|&nbsp;
9-
<b>Severity: </b>{{ control.severity }}&nbsp;|&nbsp;
9+
<b>Severity: </b>{{ control.severity }} ({{ control.severity | severity_to_cat }}) &nbsp;|&nbsp;
1010
<b>CCI: </b>{{ ",".join(control.cci) }}&nbsp;|&nbsp;
1111
<b>Vulnerability Id:</b> V-{{ control.vulnerability_id }}
1212
</p>

templates/one_page_stig.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ <h2 id="{{ control.disa_stig_id }}">{{ control.title }}</h2>
1111
<b><a href="#{{ control.disa_stig_id }}">STIG ID</a>:</b>
1212
<a href="/products/{{ product.short_name }}/{{ stig.short_version.lower() }}/{{ control.disa_stig_id }}">{{ control.disa_stig_id }}</a>&nbsp;|&nbsp;
1313
<b>SRG: </b><a href="{{ control.srg.url }}">{{ control.srg.srg_id }}</a>&nbsp;|&nbsp;
14-
<b>Severity: </b>{{ control.severity }} &nbsp;|&nbsp;
14+
<b>Severity: </b>{{ control.severity }} ({{ control.severity | severity_to_cat }}) &nbsp;|&nbsp;
1515
<b>CCI: </b>{{ ",".join(control.cci) }}&nbsp;|&nbsp;
1616
<b>Vulnerability Id:</b> V-{{ control.vulnerability_id }}
1717
</p>

0 commit comments

Comments
 (0)