File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed
Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 1212from 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+
1521def 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
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ <h2>{{ control.title }}</h2>
66 < p >
77 < b > STIG ID:</ b > {{ control.disa_stig_id }} |
88 < b > SRG: </ b > < a href ="{{ control.srg.url }} "> {{ control.srg.srg_id }}</ a > |
9- < b > Severity: </ b > {{ control.severity }} |
9+ < b > Severity: </ b > {{ control.severity }} ({{ control.severity | severity_to_cat }}) |
1010 < b > CCI: </ b > {{ ",".join(control.cci) }} |
1111 < b > Vulnerability Id:</ b > V-{{ control.vulnerability_id }}
1212 </ p >
Original file line number Diff line number Diff 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 > |
1313 < b > SRG: </ b > < a href ="{{ control.srg.url }} "> {{ control.srg.srg_id }}</ a > |
14- < b > Severity: </ b > {{ control.severity }} |
14+ < b > Severity: </ b > {{ control.severity }} ({{ control.severity | severity_to_cat }}) |
1515 < b > CCI: </ b > {{ ",".join(control.cci) }} |
1616 < b > Vulnerability Id:</ b > V-{{ control.vulnerability_id }}
1717 </ p >
You can’t perform that action at this time.
0 commit comments