Skip to content

Commit ad83334

Browse files
authored
Merge pull request #411 from rbt-mm/master-global-audit-view-vulnerabilities
Global Audit View: Vulnerabilities
2 parents 8b4a8e0 + ef8e1cd commit ad83334

File tree

7 files changed

+1011
-2
lines changed

7 files changed

+1011
-2
lines changed

src/containers/DefaultContainer.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,22 @@
9393
icon: 'fa fa-balance-scale',
9494
permission: permissions.VIEW_PORTFOLIO
9595
},
96+
{
97+
title: true,
98+
name: this.$t('message.global_audit'),
99+
class: '',
100+
wrapper: {
101+
element: '',
102+
attributes: {}
103+
},
104+
permission: permissions.VIEW_VULNERABILITY
105+
},
106+
{
107+
name: this.$t('message.vulnerability_audit'),
108+
url: '/vulnerabilityAudit',
109+
icon: 'fa fa-tasks',
110+
permission: permissions.VIEW_VULNERABILITY
111+
},
96112
{
97113
title: true,
98114
name: this.$t('message.administration'),
@@ -114,7 +130,7 @@
114130
url: '/admin',
115131
icon: 'fa fa-cogs',
116132
permission: permissions.SYSTEM_CONFIGURATION
117-
}
133+
},
118134
]
119135
}
120136
},

src/i18n/locales/en.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@
8282
"last_bom_import": "Last BOM Import",
8383
"overview": "Overview",
8484
"audit": "Audit",
85+
"global_audit": "Global Audit",
86+
"vulnerability_audit": "Vulnerability Audit",
8587
"audit_vulnerabilities": "Audit Vulnerabilities",
8688
"policy_violations": "Policy Violations",
8789
"policy_violations_by_classification": "Policy Violations by Classification",
@@ -136,6 +138,8 @@
136138
"project_cloning_in_progress": "The project is being created with the cloning options specified",
137139
"vulnerability": "Vulnerability",
138140
"analysis": "Analysis",
141+
"analysis_status": "Analysis Status",
142+
"analysis_state": "Analysis State",
139143
"analysis_tooltip": "The current state of an occurrence of a vulnerability",
140144
"justification": "Justification",
141145
"justification_tooltip": "The rationale of why the impact analysis state was asserted to be \"Not Affected\"",
@@ -218,6 +222,7 @@
218222
"rollback": "Rollback",
219223
"workaround_available": "Workaround available",
220224
"response": "Vendor Response (project)",
225+
"vendor_response": "Vendor Response",
221226
"response_tooltip": "A response to the vulnerability by the manufacturer, supplier, or project responsible for the affected component or service",
222227
"analysis_details_tooltip": "Details (explanation, workaround details, and other impact information)",
223228
"updated": "Updated",
@@ -541,6 +546,14 @@
541546
"version_distance_minor": "minor",
542547
"version_distance_patch": "patch",
543548
"version_distance_tooltip": "Specify the difference between version numbers, or empty to ignore",
549+
"filters": "Filters",
550+
"clear_all": "Clear all",
551+
"text_search": "Text Search",
552+
"from": "From",
553+
"to": "To",
554+
"vulnerabilities_by_occurrence": "Vulnerabilities By Occurrence",
555+
"grouped_vulnerabilities": "Grouped Vulnerabilities",
556+
"occurrences_in_projects": "Occurrences in projects",
544557
"matrix": "Matrix"
545558
},
546559
"admin": {

src/router/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const Dashboard = () => import('@/views/Dashboard');
1313
const ProjectList = () => import('@/views/portfolio/projects/ProjectList');
1414
const ComponentSearch = () => import('@/views/portfolio/components/ComponentSearch');
1515
const VulnerabilityList = () => import('@/views/portfolio/vulnerabilities/VulnerabilityList');
16+
const VulnerabilityAudit = () => import('@/views/globalAudit/VulnerabilityAudit');
1617
const LicenseList = () => import('@/views/portfolio/licenses/LicenseList');
1718
const PolicyManagement = () => import('@/views/policy/PolicyManagement');
1819
const Project = () => import('@/views/portfolio/projects/Project');
@@ -655,6 +656,18 @@ function configRoutes() {
655656
}
656657
]
657658
},
659+
{
660+
path: 'vulnerabilityAudit',
661+
name: 'Vulnerability Audit',
662+
alias: ['vulnerabilityAudit/occurrences', 'vulnerabilityAudit/grouped'],
663+
component: VulnerabilityAudit,
664+
meta: {
665+
title: i18n.t('message.vulnerability_audit'),
666+
i18n: 'message.vulnerability_audit',
667+
sectionPath: '/globalAudit',
668+
permission: 'VIEW_VULNERABILITY'
669+
}
670+
},
658671
// The following route redirects URLs from legacy Dependency-Track UI to new URL format.
659672
{
660673
// Old: http://host/project/?uuid=3a38aedf-e9e9-4e0a-8913-2d99951aa76d

src/shared/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function getRedirectUrl(router) {
3838
// An array of acceptable root context paths defined in the UI.
3939
const acceptableRootContextPaths = [
4040
'/dashboard', '/projects', '/components', '/services', '/vulnerabilities', '/licenses', '/policy', '/admin',
41-
'/project', '/component', '/vulnerability', '/license', '/login', '/change-password'
41+
'/project', '/component', '/vulnerability', '/license', '/vulnerabilityAudit', '/login', '/change-password'
4242
];
4343

4444
/**
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<template>
2+
<div class="animated fadeIn" v-model="tabIndex" v-permission="'VIEW_VULNERABILITY'">
3+
<b-tabs class="body-bg-color" style="border-left: 0; border-right:0; border-top:0 ">
4+
<b-tab ref="occurrences" style="border-left: 0; border-right:0; border-top:0 " @click="routeTo()" :active="tabIndex === 0" :lazy="!visitedTabs.has(0)">
5+
<template v-slot:title><i class="fa fa-shield"></i> {{ $t('message.vulnerabilities_by_occurrence') }}</template>
6+
<VulnerabilityAuditByOccurrence />
7+
</b-tab>
8+
<b-tab ref="grouped" style="border-left: 0; border-right:0; border-top:0 " @click="routeTo('grouped')" :active="tabIndex === 1" :lazy="!visitedTabs.has(1)">
9+
<template v-slot:title><i class="fa fa-shield"></i> {{ $t('message.grouped_vulnerabilities') }}</template>
10+
<VulnerabilityAuditGroupedByVulnerability />
11+
</b-tab>
12+
</b-tabs>
13+
</div>
14+
</template>
15+
16+
<script>
17+
import permissionsMixin from "@/mixins/permissionsMixin";
18+
import VulnerabilityAuditGroupedByVulnerability from "@/views/globalAudit/VulnerabilityAuditGroupedByVulnerability";
19+
import VulnerabilityAuditByOccurrence from "@/views/globalAudit/VulnerabilityAuditByOccurrence";
20+
21+
export default {
22+
mixins: [permissionsMixin],
23+
components: {
24+
VulnerabilityAuditByOccurrence,
25+
VulnerabilityAuditGroupedByVulnerability,
26+
},
27+
methods: {
28+
routeTo(path) {
29+
if (path) {
30+
this.visitedTabs.add(path === 'grouped' ? 1 : 0);
31+
if (!this.$route.fullPath.toLowerCase().includes('/' + path.toLowerCase())) {
32+
this.$router.push({path: '/vulnerabilityAudit/' + path});
33+
}
34+
} else if (this.$route.fullPath !== '/audit' && this.$route.fullPath !== '/vulnerabilityAudit/') {
35+
this.visitedTabs.add(0)
36+
this.$router.push({path: '/vulnerabilityAudit/'});
37+
}
38+
},
39+
getTabFromRoute: function () {
40+
let pattern = new RegExp("/vulnerabilityAudit\\/([^\\/]*)", "gi");
41+
let tab = pattern.exec(this.$route.fullPath.toLowerCase());
42+
(tab && tab[1] && tab[1].toLowerCase() === 'grouped') ? this.tabIndex = 1 : this.tabIndex = 0;
43+
return this.$refs[(tab && tab[1]) ? tab[1].toLowerCase() : 'occurrences']
44+
}
45+
},
46+
beforeMount() {
47+
this.getTabFromRoute();
48+
this.visitedTabs.add(this.tabIndex);
49+
},
50+
watch:{
51+
$route (to, from){
52+
this.getTabFromRoute().activate();
53+
}
54+
},
55+
data() {
56+
return {
57+
tabIndex: 0,
58+
visitedTabs: new Set()
59+
}
60+
},
61+
};
62+
</script>

0 commit comments

Comments
 (0)