Skip to content

Commit 6ef57fd

Browse files
committed
Merge branch 'main' into update-rtd
Signed-off-by: John M. Horan [email protected]
2 parents e2276b1 + 7c5164f commit 6ef57fd

26 files changed

+4443
-360
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,39 @@ Version v30.0.0
88
transform imported data and convert that in Vulnerabilities and Packages. Improvers can
99
also improve and refine imported and existing data as well as enrich data using external
1010
data sources. The migration to this new architecture is under way and not all importers
11-
are available. You can track the progress in this issue: https://github.com/nexB/vulnerablecode/issues/597
11+
are available.
1212
Because of these extensive changes, it is not possible to migrate existing imported
1313
data to the new schema. You will need instead to restart imports from an empty database
1414
or request access to the new vulnerablecode.io live instance.
15+
You can track the progress in this issue: https://github.com/nexB/vulnerablecode/issues/597
1516

1617
- We added new data sources including PYSEC, GitHub and GitLab.
1718

1819
- We improved the documentation including adding development examples for importers and improvers.
1920

20-
- We removed the ability to edit relationships from the UI. The UI is now read-only
21-
and we will need to design a different UI for proper review and curation of vulnerabilities.
21+
- We removed the ability to edit relationships from the UI. The UI is now read-only.
22+
- We replace the web UI with a brand new UI based on the same overall look and feel as ScanCode.io.
2223

2324
- We added support for NixOS as a Linux deployment target.
2425

2526
- The aliases of a vulnerabily are reported in the API vulnerabilities/ endpoint
2627

27-
2828
- There are breaking Changes at API level with changes in the data structure:
2929

3030
- in the /api/vulnerabilities/ endpoint:
3131

3232
- Rename `resolved_packages` to `fixed_packages`
3333
- Rename `unresolved_packages` to `affected_packages`
3434
- Rename `url` to `reference_url` in the reference list
35+
- Add is_vulnerable property in fixed and affected_packages.
3536

3637
- in the /api/packages/ endpoint:
3738

3839
- Rename `unresolved_vulnerabilities` to `affected_by_vulnerabilities`
3940
- Rename `resolved_vulnerabilities` to `fixing_vulnerabilities`
4041
- Rename `url` to `reference_url` in the reference list
42+
- Add new attribute `is_resolved`
43+
- Add namespace filter
4144

4245
- We have provided backward compatibility for `url` and `unresolved_vulnerabilities` for now
4346

@@ -66,8 +69,6 @@ Version v30.0.0
6669
their API Key in the REST API.
6770
Users can be created using the Django "createsuperuser" management command.
6871

69-
- Add is_vulnerable property in fixed and affected_packages.
70-
7172
Other:
7273

7374
- we dropped calver to use a plain semver.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ sqlite:
109109
@$(MAKE) migrate
110110

111111
run:
112-
${MANAGE} runserver 8001 --noreload --insecure
112+
${MANAGE} runserver 8001 --insecure
113113

114114
test:
115115
@echo "-> Run the test suite"

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
aiohttp==3.8.1
21
aiosignal==1.2.0
32
alabaster==0.7.12
43
asgiref==3.5.0

setup.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ classifiers =
2525
Topic :: Security
2626
Topic :: Software Development :: Bug Tracking
2727
Framework :: Django
28-
28+
2929
keywords =
3030
open source
3131
vulnerability
@@ -81,7 +81,6 @@ install_requires =
8181

8282
# networking
8383
GitPython>=3.1.17
84-
aiohttp>=3.7.4.post0
8584
requests>=2.25.1
8685
fetchcode>=0.1.0
8786

vulnerabilities/api.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,15 @@ class PackageFilterSet(filters.FilterSet):
190190

191191
class Meta:
192192
model = Package
193-
fields = ["name", "type", "version", "subpath", "purl", "packagerelatedvulnerability__fix"]
193+
fields = [
194+
"name",
195+
"type",
196+
"version",
197+
"subpath",
198+
"purl",
199+
"namespace",
200+
"packagerelatedvulnerability__fix",
201+
]
194202

195203
def filter_purl(self, queryset, name, value):
196204
purl = unquote(value)

vulnerabilities/forms.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ class PackageForm(forms.Form):
3434

3535
type = forms.ChoiceField(choices=get_package_types)
3636
name = forms.CharField(
37-
required=False, widget=forms.TextInput(attrs={"placeholder": "package name"})
37+
required=False, widget=forms.TextInput(attrs={"placeholder": "Package name or purl"})
3838
)
3939

4040

4141
class CVEForm(forms.Form):
4242

43-
vuln_id = forms.CharField(widget=forms.TextInput(attrs={"placeholder": "vulnerability id"}))
43+
vuln_id = forms.CharField(
44+
required=False,
45+
widget=forms.TextInput(attrs={"placeholder": "Vulnerability ID or CVE/GHSA"}),
46+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 4.0.6 on 2022-08-18 20:58
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('vulnerabilities', '0017_delete_reference_to_cpes_with_empty_urls'),
10+
]
11+
12+
operations = [
13+
migrations.AlterModelOptions(
14+
name='alias',
15+
options={'ordering': ['alias']},
16+
),
17+
]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 4.0.6 on 2022-08-23 19:15
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('vulnerabilities', '0018_alter_alias_options'),
10+
]
11+
12+
operations = [
13+
migrations.AlterModelOptions(
14+
name='vulnerabilityreference',
15+
options={'ordering': ['reference_id', 'url']},
16+
),
17+
]

vulnerabilities/models.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class Meta:
124124
"url",
125125
"reference_id",
126126
)
127+
ordering = ["reference_id", "url"]
127128

128129
def __str__(self):
129130
reference_id = f" {self.reference_id}" if self.reference_id else ""
@@ -362,6 +363,21 @@ class Alias(models.Model):
362363
related_name="aliases",
363364
)
364365

366+
@property
367+
def url(self):
368+
"""
369+
Create a URL for the alias.
370+
"""
371+
alias: str = self.alias
372+
if alias.startswith("CVE"):
373+
return f"https://nvd.nist.gov/vuln/detail/{alias}"
374+
375+
if alias.startswith("GHSA"):
376+
return f"https://github.com/advisories/{alias}"
377+
378+
class Meta:
379+
ordering = ["alias"]
380+
365381
def __str__(self):
366382
return self.alias
367383

vulnerabilities/package_managers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
# FIXME: use purl for cache key, rather than an undefined package_name key
3838
# FIXME: DO NOT cache by default as this is an optimization that does not work for long running processes
3939
# FIXME: DO NOT use set() for storing version lists: they lose the original ordering
40-
# FIXME: DO NOT use aiohttp that makes the code more complex before this is can be tested for correctness first
4140

4241

4342
@dataclasses.dataclass(frozen=True)

0 commit comments

Comments
 (0)