-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #909 from nexB/prepare-release30
Prepare release 30
- Loading branch information
Showing
38 changed files
with
5,071 additions
and
5,042 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
# backup current Db | ||
|
||
DBDUMP=vcio-db-dump-$(date +"%Y-%m-%d_%H%M").dump | ||
echo "Backup vulnerablecode current DB to: $DBDUMP" | ||
sudo -u postgres pg_dump --format=c vulnerablecode > $DBDUMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
# backup current Db and then restore a dump | ||
|
||
./backup.sh | ||
echo "Restore vulnerablecode dump from: $1" | ||
sudo -u postgres dropdb vulnerablecode | ||
sudo -u postgres createdb --encoding=utf-8 --owner=vulnerablecode vulnerablecode | ||
sudo -u postgres pg_restore --verbose -d vulnerablecode $1 | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# | ||
# Copyright (c) nexB Inc. and others. All rights reserved. | ||
# VulnerableCode is a trademark of nexB Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text. | ||
# See https://github.com/nexB/vulnerablecode for support or download. | ||
# See https://aboutcode.org for more information about nexB OSS projects. | ||
# | ||
|
||
import re | ||
from typing import Iterable | ||
|
||
from django.db.models import Q | ||
from django.db.models.query import QuerySet | ||
|
||
from vulnerabilities.importer import AdvisoryData | ||
from vulnerabilities.improver import Improver | ||
from vulnerabilities.improver import Inference | ||
from vulnerabilities.models import VulnerabilityReference | ||
|
||
""" | ||
Improver that looks for CVE References without an id and tries to set one. | ||
""" | ||
|
||
|
||
class CveIdImprover(Improver): | ||
""" | ||
Add a CVE reference id when missing. | ||
Note that we only look for uppercase CVE for now | ||
""" | ||
|
||
@property | ||
def interesting_advisories(self) -> QuerySet: | ||
return VulnerabilityReference.objects.filter( | ||
Q(reference_id__isnull=True) | Q(reference_id__exact=""), | ||
url__contains="nvd.nist.gov/vuln/detail/CVE-", | ||
) | ||
|
||
def get_inferences(self, advisory_data: AdvisoryData) -> Iterable[Inference]: | ||
cve_pattern = re.compile(r"(CVE-\d{4}-\d{4,7})").search | ||
for ref in self.interesting_advisories: | ||
cve_match = cve_pattern(ref.url) | ||
if cve_match: | ||
cve = cve_match.group() | ||
ref.reference_id = cve | ||
ref.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# Generated by Django 4.0.2 on 2022-03-29 09:38 | ||
|
||
import hashlib | ||
import json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.