Skip to content

Commit 4cc6b4f

Browse files
committed
Merge branch 'main' of https://github.com/ziadhany/vulnerablecode into view_fix
2 parents d98e37f + 28f5659 commit 4cc6b4f

94 files changed

Lines changed: 878 additions & 245 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ VENV=venv
2727
ACTIVATE?=. ${VENV}/bin/activate;
2828
VIRTUALENV_PYZ=etc/thirdparty/virtualenv.pyz
2929
BLACK_ARGS=-l 100 .
30+
ISORT_ARGS=.
3031
# Do not depend on Python to generate the SECRET_KEY
3132
GET_SECRET_KEY=`base64 /dev/urandom | head -c50`
3233
# Customize with `$ make envfile ENV_FILE=/etc/vulnerablecode/.env`
@@ -61,14 +62,20 @@ envfile:
6162
@echo SECRET_KEY=\"${GET_SECRET_KEY}\" > ${ENV_FILE}
6263

6364
check:
65+
@echo "-> Run isort validation"
66+
@${ACTIVATE} isort --check-only ${ISORT_ARGS}
6467
@echo "-> Run black validation"
6568
@${ACTIVATE} black --check ${BLACK_ARGS}
6669

6770
black:
6871
@echo "-> Apply black code formatter"
6972
${VENV}/bin/black ${BLACK_ARGS}
7073

71-
valid: black
74+
isort:
75+
@echo "-> Apply isort code formatter"
76+
${VENV}/bin/isort ${ISORT_ARGS}
77+
78+
valid: isort black
7279

7380
clean:
7481
@echo "-> Clean the Python env"

SOURCES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@
4747
+----------------+------------------------------------------------------------------------------------------------------+----------------------------------------------------+
4848
|suse_scores | https://ftp.suse.com/pub/projects/security/yaml/suse-cvss-scores.yaml |vulnerability severity scores by SUSE |
4949
+----------------+------------------------------------------------------------------------------------------------------+----------------------------------------------------+
50+
|mozilla | https://github.com/mozilla/foundation-security-advisories |mozilla |
51+
+-----------------------------------------------------------------------------------------------------------------------+----------------------------------------------------+
52+
|mattermost | https://mattermost.com/security-updates/ |mattermost server, desktop and mobile apps |
53+
+----------------+------------------------------------------------------------------------------------------------------+----------------------------------------------------+

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,10 @@ addopts = [
4343
"-rfExXw",
4444
"--strict",
4545
"--doctest-modules"
46-
]
46+
]
47+
48+
[tool.isort]
49+
profile = "black"
50+
line_length = 100
51+
force_single_line = true
52+
skip_gitignore = true

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@ addopts =
3030
--ignore=vulnerabilities/importers/suse_backports.py
3131
--ignore=vulnerabilities/importers/suse_scores.py
3232
--ignore=vulnerabilities/importers/ubuntu_usn.py
33+
--ignore=vulnerabilities/importers/mozilla.py
34+
--ignore=vulnerabilities/importers/mattermost.py
35+
--ignore=vulnerabilities/importers/xen.py
3336
--ignore=vulnerabilities/management/commands/create_cpe_to_purl_map.py
3437
--ignore=vulnerabilities/lib_oval.py

requirements-dev.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
pytest
2-
pytest-django
3-
freezegun
4-
ipython
5-
black
1+
black==22.1.0
2+
freezegun==1.1.0
3+
ipython==8.0.1
4+
isort==5.10.1
5+
pytest==7.0.0
6+
pytest-django==4.5.2

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ lxml>=4.6.4
1717
gunicorn>=20.1.0
1818
django-environ==0.4.5
1919
defusedxml==0.7.1
20+
21+
Markdown==3.3.4

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from setuptools import find_packages
55
from setuptools import setup
66

7-
87
requirements = [
98
r.strip() for r in open("requirements.txt") if r.strip() and not r.strip().startswith("#")
109
]

vulnerabilities/admin.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@
2323

2424
from django.contrib import admin
2525

26-
from vulnerabilities.models import (
27-
PackageRelatedVulnerability,
28-
Package,
29-
Vulnerability,
30-
VulnerabilityReference,
31-
VulnerabilitySeverity,
32-
)
26+
from vulnerabilities.models import Package
27+
from vulnerabilities.models import PackageRelatedVulnerability
28+
from vulnerabilities.models import Vulnerability
29+
from vulnerabilities.models import VulnerabilityReference
30+
from vulnerabilities.models import VulnerabilitySeverity
3331

3432

3533
@admin.register(Vulnerability)

vulnerabilities/api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@
2525

2626
from django_filters import rest_framework as filters
2727
from packageurl import PackageURL
28-
29-
from rest_framework import serializers, viewsets
28+
from rest_framework import serializers
29+
from rest_framework import viewsets
3030
from rest_framework.decorators import action
3131
from rest_framework.response import Response
32+
3233
from vulnerabilities.models import Package
3334
from vulnerabilities.models import Vulnerability
3435
from vulnerabilities.models import VulnerabilityReference

vulnerabilities/fixtures/openssl.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40764,5 +40764,19 @@
4076440764
]
4076540765
}
4076640766
}
40767+
},
40768+
{
40769+
"model": "vulnerabilities.importer",
40770+
"pk": 17,
40771+
"fields": {
40772+
"name": "xen",
40773+
"license": "gplv2",
40774+
"last_run": null,
40775+
"data_source": "XenDataSource",
40776+
"data_source_cfg": {
40777+
"etags": {},
40778+
"db_url": "https://xenbits.xen.org/xsa/xsa.json"
40779+
}
40780+
}
4076740781
}
4076840782
]

0 commit comments

Comments
 (0)