Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions frontend/src/components/StatusEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ function StatusEditor ({onAddAssessment, progressBar, clearFields: shouldClearFi
className="p-1 px-2 bg-gray-800 mr-4"
name="new_assessment_status"
>
<option value="under_investigation">Community Analysis Pending</option>
<option value="affected">Affected / Exploitable</option>
<option value="fixed">Fixed / Patched</option>
<option value="under_investigation">Community analysis pending</option>
<option value="affected">Affected / exploitable</option>
<option value="fixed">Fixed / patched</option>
<option value="not_affected">Not applicable</option>
<option value="false_positive">False positive</option>
</select>
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/handlers/assessments.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const STATUS_VEX_TO_GRAPH: { [key: string]: string } = {
"under_investigation": "Community Analysis Pending",
"in_triage": "Community Analysis Pending",
"false_positive": "not affected",
"not_affected": "not affected",
"under_investigation": "Community analysis pending",
"in_triage": "Community analysis pending",
"false_positive": "Not affected",
"not_affected": "Not affected",
"exploitable": "Exploitable",
"affected": "Exploitable",
"resolved": "fixed",
"fixed": "fixed",
"resolved_with_pedigree": "fixed"
"resolved": "Fixed",
"fixed": "Fixed",
"resolved_with_pedigree": "Fixed"
};

type Assessment = {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Explorer({ darkMode, setDarkMode }: Readonly<Props>) {
};

const loadPatchData = useCallback((vulns_list: Vulnerability[]) => {
const active_status = ['Exploitable', 'Community Analysis Pending'];
const active_status = ['Exploitable', 'Community analysis pending'];
PatchFinderLogic
.scan(vulns_list.filter(el => active_status.includes(el.simplified_status)).map(el => el.id))
.then((patchData) => {
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/Metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ const packageColumns = [

const dataSetVulnByStatus = useMemo(() => {
return {
labels: ['Not Affected', 'Fixed', 'Community Analysis Pending', 'Exploitable'],
labels: ['Not affected', 'Fixed', 'Community analysis pending', 'Exploitable'],
datasets: [{
label: '# of Vulnerabilities',
data: vulnerabilities.reduce((acc, vuln) => {
const status = vuln.simplified_status;
const index = status == 'not affected' ? 0 : status == 'fixed' ? 1 : status == 'Community Analysis Pending' ? 2 : 3;
const index = status == 'Not affected' ? 0 : status == 'Fixed' ? 1 : status == 'Community analysis pending' ? 2 : 3;
acc[index]++;
return acc;
}, [0, 0, 0, 0]),
Expand Down Expand Up @@ -319,7 +319,7 @@ const packageColumns = [
date_index++;
}

const should_be_active = (assess.simplified_status != 'not affected' && assess.simplified_status != 'fixed');
const should_be_active = (assess.simplified_status != 'Not affected' && assess.simplified_status != 'Fixed');
if (is_active != should_be_active) {
if (should_be_active && dt.getTime() >= time_scales[date_index]?.getTime()) {
// if vulnerability was active at least one time in the month, then classify as active for while month
Expand Down Expand Up @@ -459,7 +459,7 @@ const packageColumns = [
onClick: (_e: ChartEvent, elements: any[]) => {
if (!elements.length) return;
const index = elements[0].index;
const statusOrder = ['not affected', 'fixed', 'Community Analysis Pending', 'Exploitable'];
const statusOrder = ['Not affected', 'Fixed', 'Community analysis pending', 'Exploitable'];
const targetStatus = statusOrder[index];

const matchingStatus = vulnerabilities.find(v =>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/TableVulnerabilities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const sortSeverityFn: SortingFn<Vulnerability> = (rowA, rowB) => {
}

const sortStatusFn: SortingFn<Vulnerability> = (rowA, rowB) => {
const indexA = ['unknown', 'Community Analysis Pending', 'Exploitable', 'not affected', 'fixed'].indexOf(rowA.original.simplified_status)
const indexB = ['unknown', 'Community Analysis Pending', 'Exploitable', 'not affected', 'fixed'].indexOf(rowB.original.simplified_status)
const indexA = ['unknown', 'Community analysis pending', 'Exploitable', 'Not affected', 'Fixed'].indexOf(rowA.original.simplified_status)
const indexB = ['unknown', 'Community analysis pending', 'Exploitable', 'Not affected', 'Fixed'].indexOf(rowB.original.simplified_status)
return indexA - indexB
}

Expand Down Expand Up @@ -248,7 +248,7 @@ function TableVulnerabilities ({ vulnerabilities, filterLabel, filterValue, appe
setHideFixed(enabled);
if (enabled) {
const allStatuses = Array.from(new Set(vulnerabilities.map(v => v.simplified_status)));
const statusesExceptFixed = allStatuses.filter(status => status !== 'fixed');
const statusesExceptFixed = allStatuses.filter(status => status !== 'Fixed');
setSelectedStatuses(statusesExceptFixed);
} else {
setSelectedStatuses([]);
Expand All @@ -257,7 +257,7 @@ function TableVulnerabilities ({ vulnerabilities, filterLabel, filterValue, appe

const handleStatusChange = (newStatuses: string[]) => {
setSelectedStatuses(newStatuses);
if (newStatuses.includes('fixed') && hideFixed) {
if (newStatuses.includes('Fixed') && hideFixed) {
setHideFixed(false);
}
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/tests/unit_tests/test_assessments_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('asAssessment optional fields', () => {
last_update: '2024-02-04T00:00:00'
};
const assessed = asAssessment(data as any) as any;
expect(assessed.simplified_status).toEqual('fixed');
expect(assessed.simplified_status).toEqual('Fixed');
expect(assessed.status_notes).toEqual('note');
expect(assessed.justification).toEqual('justification text');
expect(assessed.impact_statement).toEqual('impact');
Expand Down
18 changes: 9 additions & 9 deletions frontend/tests/unit_tests/test_handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,20 @@ describe('Packages', () => {
expect(vulnerabilities.length).toEqual(2);
expect(thisFetch).toHaveBeenCalledTimes(1);

vulnerabilities[0].simplified_status = 'fixed';
vulnerabilities[1].simplified_status = 'active';
vulnerabilities[0].simplified_status = 'Fixed';
vulnerabilities[1].simplified_status = 'Exploitable';

const enrichedPackages = Packages.enrich_with_vulns(packages, vulnerabilities);
expect(enrichedPackages.length).toEqual(2);

expect(enrichedPackages[0].vulnerabilities["fixed"]).toEqual(1);
expect(enrichedPackages[0].vulnerabilities["active"]).toEqual(1);
expect(enrichedPackages[0].maxSeverity["fixed"].label).toEqual('high');
expect(enrichedPackages[0].maxSeverity["active"].label).toEqual('low');
expect(enrichedPackages[0].vulnerabilities["Fixed"]).toEqual(1);
expect(enrichedPackages[0].vulnerabilities["Exploitable"]).toEqual(1);
expect(enrichedPackages[0].maxSeverity["Fixed"].label).toEqual('high');
expect(enrichedPackages[0].maxSeverity["Exploitable"].label).toEqual('low');
expect(enrichedPackages[0].source).toEqual(['hardcoded', 'cve-finder']);

expect(enrichedPackages[1].vulnerabilities["active"]).toEqual(1);
expect(enrichedPackages[1].maxSeverity["active"].label).toEqual('low');
expect(enrichedPackages[1].vulnerabilities["Exploitable"]).toEqual(1);
expect(enrichedPackages[1].maxSeverity["Exploitable"].label).toEqual('low');
expect(enrichedPackages[1].source).toEqual(['cve-finder']);
});
});
Expand Down Expand Up @@ -221,7 +221,7 @@ describe('Vulnerabilities', () => {
expect(enrichedvuln.length).toEqual(2);

expect(enrichedvuln[0].status).toEqual('fixed');
expect(enrichedvuln[0].simplified_status).toEqual('fixed');
expect(enrichedvuln[0].simplified_status).toEqual('Fixed');
expect(enrichedvuln[0].assessments.length).toEqual(1);

expect(enrichedvuln[1].status).toEqual('affected');
Expand Down
6 changes: 3 additions & 3 deletions frontend/tests/unit_tests/test_vuln_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ describe('Vulnerability Table', () => {
{
...vulnerabilities[0],
id: 'CVE-2020-9999',
simplified_status: 'fixed'
simplified_status: 'Fixed'
}
];

Expand Down Expand Up @@ -751,7 +751,7 @@ describe('Vulnerability Table', () => {
{
...vulnerabilities[0],
id: 'CVE-2020-9999',
simplified_status: 'fixed'
simplified_status: 'Fixed'
}
];

Expand All @@ -772,7 +772,7 @@ describe('Vulnerability Table', () => {
// Now manually select 'fixed' in status filter
const statusBtn = await screen.getByRole('button', { name: /status/i });
await user.click(statusBtn);
const fixedCheckbox = await screen.getByRole('checkbox', { name: 'fixed' });
const fixedCheckbox = await screen.getByRole('checkbox', { name: 'Fixed' });
await user.click(fixedCheckbox);

// ASSERT - Hide fixed toggle should be disabled when fixed is manually selected
Expand Down