Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hdf2ckl severity #5866

Merged
merged 81 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
c778a18
use severity tag in hdf2ckl mapping
kemley76 May 31, 2024
209a77b
use default values in severity check
kemley76 May 31, 2024
ac6c378
update hdf2ckl test
kemley76 May 31, 2024
d6c6d50
fix inconsistencies with how severity is computed and displayed
kemley76 Jun 5, 2024
e0f18f2
linting
kemley76 Jun 5, 2024
fa53293
add clarifying comments for severity computation
kemley76 Jun 5, 2024
fb1093e
update ckl2hdf tests
kemley76 Jun 12, 2024
b56c07a
remove unecessary lowercase conversion
kemley76 Jun 12, 2024
fa98d0d
show severityoverride and severity justification in details panel
kemley76 Jun 14, 2024
cdcf937
severity override info displayed in results table
kemley76 Jun 14, 2024
77aac4b
format results view impact column to show severity as well
kemley76 Jun 14, 2024
c560395
linting
kemley76 Jun 14, 2024
9e2b5b9
added severity and severity overrides to hdf2ckl and ckl2hdf
kemley76 Jun 17, 2024
8f80059
ensure severity low and critical get mapped properly in hdf2ckl
kemley76 Jun 17, 2024
14312e6
fix fallbacks in ControlRowHeader for showing severity override
kemley76 Jun 17, 2024
62cedce
linting
kemley76 Jun 17, 2024
87dd363
split impact and severity into two columns
kemley76 Jun 17, 2024
6953dfb
linting
kemley76 Jun 17, 2024
499141c
add information labels on severity and impact table headers
kemley76 Jun 17, 2024
c88e4a3
linting
kemley76 Jun 17, 2024
e5c5cee
add visual spacing between delta and severity level for overridden se…
kemley76 Jun 17, 2024
58aa1cf
update impact ranges for results table header tooltip
kemley76 Jun 18, 2024
6cba39d
removed transparancy from v-tooltip backgrounds
kemley76 Jun 21, 2024
c4a463e
refactor checklist mapper to use result type when parsing Json
kemley76 Jun 21, 2024
79ea5f8
use severity form Third_Party_Tools section if present upon ckl2hdf
kemley76 Jun 21, 2024
7ded3a8
ensure that impact is computed using computed severity upon ckl2hdf
kemley76 Jun 21, 2024
33a5207
add data to ckl thirdPartyTools to ensure hdf's severity and impact a…
kemley76 Jun 21, 2024
6d60163
add severityoverride tag to control when impact and severity differ
kemley76 Jun 24, 2024
c744e28
recombine severity into impact column and indicate if they differ
kemley76 Jun 24, 2024
0533bbb
linting
kemley76 Jun 24, 2024
0b19038
add ability to filter controls by the presence of specific tags
kemley76 Jun 24, 2024
de004d4
create InfoCardRow component to alert user to any severity overrides
kemley76 Jun 24, 2024
9675b4e
bring back severity column
kemley76 Jun 24, 2024
6b7cfee
linting
kemley76 Jun 25, 2024
e22cbfd
remove impact column, only showing severity
kemley76 Jun 25, 2024
7461544
revert changes to include severityoverride when severity and impact d…
kemley76 Jun 25, 2024
ac5d06d
ensure hdf to ckl to hdf doesn't add extra metadata
kemley76 Jun 25, 2024
2c01f34
update hdf2ckl test
kemley76 Jun 25, 2024
965fa19
linting
kemley76 Jun 26, 2024
a0c4fa2
remove extra code leftover from removed impact column
kemley76 Jun 26, 2024
2f6994c
removed ts specific code tested in frontend test that caused error
kemley76 Jun 26, 2024
044f468
linting
kemley76 Jun 26, 2024
902f99d
updated ckl2hdf tests to consider third party tools
kemley76 Jun 26, 2024
4134db4
add checklist with overrides file to sample files
kemley76 Jun 27, 2024
0776bc7
expanded checklist override test to include non-overridden vuln sever…
kemley76 Jun 27, 2024
63888e1
added frontend test to ensure severity overrides can be filtered prop…
kemley76 Jun 28, 2024
ad6d471
add cypress test to ensure severity override lables appear
kemley76 Jun 28, 2024
8f789ed
clean up vue logic for severity override display
kemley76 Jun 28, 2024
5da3f38
account for non-lowercase severity tags
kemley76 Jun 28, 2024
76ba8c4
remove unneeded code bits
kemley76 Jun 28, 2024
5711083
fix sample loading in cypress test
kemley76 Jun 28, 2024
48e0988
fix hdf2checklist third party tools computation
kemley76 Jun 28, 2024
3c1ed41
Merge branch 'master' into hdf2ckl-severity
kemley76 Jun 28, 2024
c7bee1a
update control search help menu with tag filter
kemley76 Jun 28, 2024
c41780c
fixed issue with critical severity being lost in hdf to ckl to hdf
kemley76 Jul 2, 2024
689154b
fix logic and complexity of hdf2ckl addHdfSpecificData
kemley76 Jul 2, 2024
312c92d
linting
kemley76 Jul 2, 2024
b568258
accounted for possiblity of nil severity tag when doing hdf2ckl
kemley76 Jul 8, 2024
a34998a
Merge branch 'master' into hdf2ckl-severity
kemley76 Jul 8, 2024
92a817c
add severity name constants in inspecJs as utility
kemley76 Jul 8, 2024
d087af9
added test util for version replacement for ckl and xccdf reverse tes…
kemley76 Jul 8, 2024
dd60821
add parseJson to util file with better return type
kemley76 Jul 8, 2024
96b4d97
relocate ckl2hdf helper function
kemley76 Jul 8, 2024
bbe988e
refactor hdf2ckl computeImpact to use standard util function
kemley76 Jul 9, 2024
9492de7
remove redundant 'active-class' in results table's chips
kemley76 Jul 9, 2024
8bda1d7
fix weird autoformating instances in vue
kemley76 Jul 9, 2024
eb5204a
fix comment typo
kemley76 Jul 9, 2024
0711df7
fix messed up test in checklist reverse mapper
kemley76 Jul 9, 2024
f9137fe
Merge branch 'master' into hdf2ckl-severity
kemley76 Jul 9, 2024
9496c73
fix typo
kemley76 Jul 9, 2024
cf3e3e6
refactored to remove unecessary type casting
kemley76 Jul 10, 2024
23a8cc0
use more representative type for JSON parse output
kemley76 Jul 10, 2024
0292f89
simplify ckl mapper helper function
kemley76 Jul 10, 2024
7b234e5
linting
kemley76 Jul 10, 2024
d929425
remove unused imports
kemley76 Jul 10, 2024
65237ef
export inspecJS function for converting impact into severity
kemley76 Jul 10, 2024
0724908
Merge branch 'master' into hdf2ckl-severity
mergify[bot] Jul 10, 2024
9937386
Merge branch 'master' into hdf2ckl-severity
kemley76 Jul 11, 2024
642f4b4
restart CI
kemley76 Jul 11, 2024
0c815a2
merge master into hdf2ckl-severity
kemley76 Jul 11, 2024
9792e0c
Merge branch 'master' into hdf2ckl-severity
kemley76 Jul 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
907 changes: 907 additions & 0 deletions apps/frontend/public/static/samples/small_overrides_hdf.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion apps/frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
v-if="classification"
:style="classificationStyle"
class="classification-footer"
>{{ classification }}</span
>
{{ classification }}
</span>
<!-- Router view. Typically a "subclass" of Base -->
<router-view :key="$route.fullPath" :class="classification ? 'pt-5' : ''" />
<!-- Footer -->
Expand Down
68 changes: 68 additions & 0 deletions apps/frontend/src/components/cards/InfoCardRow.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<template>
<v-row>
<v-col v-if="severityOverrideProps.number" cols="12">
<v-card
:color="severityOverrideProps.color"
class="d-flex flex-no-wrap justify-space-between"
elevation="12"
>
<div>
<v-card-title>
<v-icon class="pr-3" large>
mdi-{{ severityOverrideProps.icon }}
</v-icon>
<span class="title">{{
`${severityOverrideProps.title}: ${severityOverrideProps.number}`
}}</span>
</v-card-title>
<v-card-text>{{ severityOverrideProps.subtitle }}</v-card-text>
</div>
<v-card-actions>
<v-btn
:disabled="
filter.tagFilter &&
filter.tagFilter.indexOf('severityoverride') !== -1
"
@click="$emit('show-severity-overrides')"
>
Filter to Severity Overrides
</v-btn>
</v-card-actions>
</v-card>
</v-col>
</v-row>
</template>

<script lang="ts">
import {Filter, FilteredDataModule} from '@/store/data_filters';
import Vue from 'vue';
import Component from 'vue-class-component';
import {Prop} from 'vue-property-decorator';

interface CardProps {
icon: string;
title: string;
number: number;
subtitle: string;
color: string;
}

@Component
export default class InfoCardRow extends Vue {
@Prop({type: Object, required: true}) readonly filter!: Filter;

get severityOverrideProps(): CardProps {
const filter = {
...this.filter,
tagFilter: ['severityoverride']
};
return {
icon: 'delta',
title: 'Severity Overrides',
subtitle: 'Some controls have overridden severities',
color: 'cyan',
number: FilteredDataModule.controls(filter).length
};
}
}
</script>
6 changes: 4 additions & 2 deletions apps/frontend/src/components/cards/StatusCardRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
<v-btn
:disabled="filter.status.indexOf('Profile Error') !== -1"
@click="$emit('show-errors')"
>Filter to Errors</v-btn
>
Filter to Errors
</v-btn>
</v-card-actions>
</v-card>
</v-col>
Expand Down Expand Up @@ -75,8 +76,9 @@
<v-btn
:disabled="filter.status.indexOf('Waived') !== -1"
@click="$emit('show-waived')"
>Filter to Waived</v-btn
>
Filter to Waived
</v-btn>
</v-card-actions>
</v-card>
</v-col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
</span>
</div>
<span v-if="caveat">Caveat: {{ caveat }}<br /></span>
<span v-if="justification"
>Justification: {{ justification }}<br
/></span>

<span v-if="justification">
Justification: {{ justification }}
<br />
</span>
<span v-if="rationale">Rationale: {{ rationale }}<br /></span>
<span v-if="comments">Comments: {{ comments }}<br /></span>
<v-divider />
Expand Down Expand Up @@ -202,7 +202,23 @@ export default class ControlRowDetails extends mixins(HtmlSanitizeMixin) {
detailsMap.set('Caveat', this.control.hdf.descriptions.caveat);
detailsMap.set('Desc', this.control.data.desc);
detailsMap.set('Rationale', this.control.hdf.descriptions.rationale);
detailsMap.set('Severity', this.control.root.hdf.severity);
// default to showing severity tag, otherwise show the computed severity (based on impact or severityoverride)
detailsMap.set(
'Severity',
_.get(
this.control.root.data.tags,
'severity',
this.control.root.hdf.severity
)
);
detailsMap.set(
'Severity Override',
_.get(this.control.root.data.tags, 'severityoverride')
);
detailsMap.set(
'Severity Override Justification',
_.get(this.control.root.data.tags, 'severityjustification')
);
detailsMap.set('Impact', this.control.data.impact);
detailsMap.set('NIST Controls', this.control.hdf.rawNistTags.join(', '));
detailsMap.set('CCI Controls', this.cciControlString);
Expand All @@ -219,7 +235,10 @@ export default class ControlRowDetails extends mixins(HtmlSanitizeMixin) {
const sparseControl = _.omit(this.control, [
'data.tags.nist',
'data.tags.cci',
'data.tags.cwe'
'data.tags.cwe',
'data.tags.severity',
'data.tags.severityoverride',
'data.tags.severityjustification'
]);

// Convert all tags to Details
Expand Down Expand Up @@ -253,7 +272,7 @@ export default class ControlRowDetails extends mixins(HtmlSanitizeMixin) {
}

return Array.from(detailsMap, ([name, value]) => ({name, value})).filter(
(v) => v.value
(v) => v.value !== undefined
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,36 @@

<template #severity>
<v-card-text class="pa-2">
<div v-if="showImpact">
<CircleRating
:filled-count="severity_arrow_count(control.hdf.severity)"
:total-count="4"
/>
<v-divider class="mx-1" />
<v-tooltip v-if="'severityoverride' in control.data.tags" bottom>
<template #activator="{on}">
<span v-on="on">
<v-chip outlined :color="severity_color">
<v-icon size="16" class="mr-1" data-cy="severityOverride">
mdi-delta
</v-icon>
{{ (control.hdf.severity || 'none').toUpperCase() }}
</v-chip>
</span>
</template>
<span>
<span>
Severity has been overridden from
<span v-if="'severity' in control.data.tags">
{{ control.data.tags['severity'] }}
</span>
<span v-else> Unknown </span>
to {{ control.data.tags['severityoverride'] }}
<br />
<span v-if="'severityjustification' in control.data.tags">
Justification: {{ control.data.tags['severityjustification'] }}
</span>
<span v-else> No justification provided </span>
</span>
</span>
</v-tooltip>
<v-chip v-else outlined :color="severity_color">
{{ (control.hdf.severity || 'none').toUpperCase() }}
</div>
<div v-else>
<CircleRating
:filled-count="severity_arrow_count(control.data.tags.severity)"
:total-count="4"
/>
<br />
<v-divider class="mx-1" />
{{ (control.data.tags.severity || 'none').toUpperCase() }}
</div>
</v-chip>
</v-card-text>
</template>

Expand All @@ -79,25 +92,20 @@
</v-card-text>
</template>
<template #tags>
<v-chip-group column active-class="NONE">
<v-chip-group column>
<v-tooltip v-for="(tag, i) in nistTags" :key="'nist-chip' + i" bottom>
<template #activator="{on}">
<v-chip
:href="tag.url"
target="_blank"
active-class="NONE"
v-on="on"
>
<v-chip :href="tag.url" target="_blank" v-on="on">
{{ tag.label }}
</v-chip>
</template>
<span>{{ tag.description }}</span>
</v-tooltip>
</v-chip-group>
<v-chip-group column active-class="NONE">
<v-chip-group column>
<v-tooltip v-for="(tag, i) in cciTags" :key="'cci-chip' + i" bottom>
<template #activator="{on}">
<v-chip style="cursor: help" active-class="NONE" v-on="on">
<v-chip style="cursor: help" v-on="on">
{{ tag.label }}
</v-chip>
</template>
Expand All @@ -109,8 +117,8 @@
<template #runTime>
<v-card-text class="pa-2 title font-weight-bold">{{
runTime
}}</v-card-text></template
>
}}</v-card-text>
</template>

<template #viewed>
<v-container class="py-0 my-0 fill-height">
Expand All @@ -133,7 +141,6 @@

<script lang="ts">
import ResponsiveRowSwitch from '@/components/cards/controltable/ResponsiveRowSwitch.vue';
import CircleRating from '@/components/generic/CircleRating.vue';
import HtmlSanitizeMixin from '@/mixins/HtmlSanitizeMixin';
import {CCI_DESCRIPTIONS} from '@/utilities/cci_util';
import {getControlRunTime} from '@/utilities/delta_util';
Expand All @@ -151,8 +158,7 @@ interface Tag {

@Component({
components: {
ResponsiveRowSwitch,
CircleRating
ResponsiveRowSwitch
}
})
export default class ControlRowHeader extends mixins(HtmlSanitizeMixin) {
Expand All @@ -163,7 +169,6 @@ export default class ControlRowHeader extends mixins(HtmlSanitizeMixin) {
readonly viewedControls!: string[];

@Prop({type: Boolean, default: false}) readonly controlExpanded!: boolean;
@Prop({type: Boolean, default: false}) readonly showImpact!: boolean;

get runTime(): string {
return `${_.truncate(getControlRunTime(this.control).toString(), {
Expand All @@ -189,6 +194,10 @@ export default class ControlRowHeader extends mixins(HtmlSanitizeMixin) {
return `status${this.control.root.hdf.status.replace(' ', '')}`;
}

get severity_color(): string {
return `severity${_.startCase(this.control.hdf.severity)}`;
}

get wasViewed(): boolean {
return this.viewedControls.indexOf(this.control.data.id) !== -1;
}
Expand All @@ -205,21 +214,6 @@ export default class ControlRowHeader extends mixins(HtmlSanitizeMixin) {
);
}

severity_arrow_count(severity: string): number {
switch (severity) {
case 'low':
return 1;
case 'medium':
return 2;
case 'high':
return 3;
case 'critical':
return 4;
default:
return 0;
}
}

// Get NIST tag description for NIST tag, this is pulled from the 800-53 xml
// and relies on a script not contained in the project
descriptionForTag(tag: string): string {
Expand Down
20 changes: 8 additions & 12 deletions apps/frontend/src/components/cards/controltable/ControlTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@
</v-row>
</template>

<template #title>
<ColumnHeader text="Title" sort="disabled" />
</template>

<template #severity>
<ColumnHeader
:text="showImpact ? 'Impact' : 'Severity'"
:text="'Severity'"
:sort="sortSeverity"
@input="set_sort('severity', $event)"
/>
</template>

<template #title>
<ColumnHeader text="Title" sort="disabled" />
</template>

<template #tags>
<ColumnHeader text="800-53 Controls & CCIs" sort="disabled" />
</template>
Expand Down Expand Up @@ -128,7 +128,6 @@
:style="controlRowPinOffset"
:control="item.control"
:expanded="expanded.includes(item.key)"
:show-impact="showImpact"
:viewed-controls="viewedControlIds"
@toggle="toggle(item.key)"
@control-viewed="toggleControlViewed"
Expand All @@ -153,7 +152,7 @@ import {Filter, FilteredDataModule} from '@/store/data_filters';
import {HeightsModule} from '@/store/heights';
import {getControlRunTime} from '@/utilities/delta_util';
import {control_unique_key} from '@/utilities/format_util';
import {ContextualizedControl} from 'inspecjs';
import {ContextualizedControl, severities} from 'inspecjs';
import * as _ from 'lodash';
import Vue from 'vue';
import Component from 'vue-class-component';
Expand All @@ -166,7 +165,7 @@ interface ListElt {

filename: string;

// Computed values for status and severity "value", for sorting
// Computed values for status and severity, for sorting
status_val: number;
severity_val: number;

Expand All @@ -184,7 +183,6 @@ interface ListElt {
export default class ControlTable extends Vue {
@Ref('controlTableTitle') readonly controlTableTitle!: Element;
@Prop({type: Object, required: true}) readonly filter!: Filter;
@Prop({type: Boolean, required: true}) readonly showImpact!: boolean;

// Whether to allow multiple expansions
singleExpand = true;
Expand Down Expand Up @@ -361,9 +359,7 @@ export default class ControlTable extends Vue {
'Profile Error',
'Failed'
].indexOf(d.root.hdf.status),
severity_val: ['none', 'low', 'medium', 'high', 'critical'].indexOf(
d.root.hdf.severity
),
severity_val: severities.indexOf(d.root.hdf.severity),
filename: _.get(
d,
'sourcedFrom.sourcedFrom.from_file.filename'
Expand Down
Loading
Loading