Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/v0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mms-gianni committed Jan 25, 2022
2 parents 1c4e542 + 366e17a commit 9ce07c8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/Http/Controllers/VulnerabilitiesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ public function apiListVulnerabilities(Request $request)
}
*/

if ($vulnerability['cvss']['version'] >= 3) {
if (isset($vulnerability['cvss']['version']) && $vulnerability['cvss']['version'] >= 3) {
$vulnerability['cvss_base_score'] = $vulnerability['cvss']['v3']['scores']['base'];
} elseif ($vulnerability['cvss']['version'] == 2) {
} elseif (isset($vulnerability['cvss']['version']) && $vulnerability['cvss']['version'] == 2) {
$vulnerability['cvss_base_score'] = $vulnerability['cvss']['v2']['scores']['base'];
} else {
$vulnerability['cvss_base_score'] = '?';
Expand Down Expand Up @@ -276,9 +276,9 @@ public function details($vulnerability_id)
}
*/

if ($vulnerability['cvss']['version'] >= 3) {
if (isset($vulnerability['cvss']['version']) && $vulnerability['cvss']['version'] >= 3) {
$vulnerability['cvss_base_score'] = $vulnerability['cvss']['v3']['scores']['base'];
} elseif ($vulnerability['cvss']['version'] == 2) {
} elseif (isset($vulnerability['cvss']['version']) && $vulnerability['cvss']['version'] == 2) {
$vulnerability['cvss_base_score'] = $vulnerability['cvss']['v2']['scores']['base'];
} else {
$vulnerability['cvss_base_score'] = '?';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ public function up()
(severity ASC NULLS LAST)
TABLESPACE pg_default;
SQL;

$create_sql[] = <<<SQL
CREATE INDEX IF NOT EXISTS k_vuln_trivy_severity_vulnerability_id
ON public.k_vuln_trivy USING btree
(severity ASC NULLS LAST,
vulnerability_id ASC NULLS LAST)
TABLESPACE pg_default;
SQL;

foreach ($create_sql as $sql ) {
DB::statement($sql);
Expand Down
12 changes: 12 additions & 0 deletions database/migrations/2021_11_29_100000_v0_6_0.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ public function up()
DROP TABLE IF EXISTS public.k_vuln_anchore;
SQL;

$create_sql[] = <<<SQL
CREATE INDEX IF NOT EXISTS k_vuln_trivy_severity_vulnerability_id
ON public.k_vuln_trivy USING btree
(severity ASC NULLS LAST,
vulnerability_id ASC NULLS LAST)
TABLESPACE pg_default;
SQL;

foreach ($create_sql as $sql ) {
DB::statement($sql);
}
Expand Down Expand Up @@ -87,6 +95,10 @@ public function down()
(report_uid COLLATE pg_catalog."default" ASC NULLS LAST)
TABLESPACE pg_default;
SQL;

$create_sql[] = <<<SQL
DROP INDEX IF EXISTS k_vuln_trivy_severity_vulnerability_id;
SQL;

foreach ($create_sql as $sql ) {
DB::statement($sql);
Expand Down

0 comments on commit 9ce07c8

Please sign in to comment.