Skip to content

Commit d4d2672

Browse files
authored
Merge pull request #997 from nexB/nvd-improvements
Improve NVD handling and more This PR - improves how we handle NVD data - refactors the purl2cpe script - aligns some key internal names with UI and API (affected and fixed) - uses querysets as model managers and streamline views Signed-off-by: Philippe Ombredanne <[email protected]>
2 parents c9f70a0 + 464adb3 commit d4d2672

File tree

14 files changed

+700
-405
lines changed

14 files changed

+700
-405
lines changed

CHANGELOG.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@ Release notes
33

44

55

6-
Version v30.2.2
6+
Version v30.3.0
77
----------------
88

99
- We enabled API throttling for a basic user and for a staff user
1010
they can have unlimited access on API.
1111

1212
- We added throttle rate for each API endpoint and it can be
13-
configured from the settings #991 https://github.com/nexB/vulnerablecode/issues/991.
13+
configured from the settings #991 https://github.com/nexB/vulnerablecode/issues/991
14+
15+
- We improved how we import NVD data
16+
- We refactored and made the purl2cpe script work to dump purl to CPE mappings
17+
18+
Internally:
19+
20+
- We aligned key names internally with the names used in the UI and API (such as affected and fixed)
21+
- We now use querysets as model managers and have streamlined view code
1422

1523

1624
Version v30.2.1

docs/source/command-line-interface.rst

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Command Line Interface
44
======================
55

6-
The main entry point is Django's :guilabel:`manage.py` management commands.
6+
The main entry point is the Django :guilabel:`manage.py` management command script.
77

88
``$ ./manage.py --help``
99
------------------------
@@ -14,9 +14,10 @@ VulnerableCode's own commands are listed under the ``[vulnerabilities]`` section
1414
$ ./manage.py --help
1515
...
1616
[vulnerabilities]
17-
create_cpe_to_purl_map
18-
importer
19-
improver
17+
import
18+
improve
19+
purl2cpe
20+
2021

2122
``$ ./manage.py <subcommand> --help``
2223
---------------------------------------
@@ -58,3 +59,17 @@ Other variations:
5859

5960
* ``--list`` List all available improvers
6061
* ``--all`` Run all available improvers
62+
63+
64+
65+
``$ ./manage.py purl2cpe --destination <directory``
66+
------------------------------------------
67+
68+
Dump a mapping of CPEs to PURLs grouped by vulnerability in the ``destination``
69+
directory.
70+
71+
72+
Other variations:
73+
74+
* ``--limit`` Limit the number of processed vulnerabilities
75+

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ addopts = [
6666
"--ignore=vulnerabilities/importers/mozilla.py",
6767
"--ignore=vulnerabilities/importers/mattermost.py",
6868
"--ignore=vulnerabilities/importers/xen.py",
69-
"--ignore=vulnerabilities/management/commands/create_cpe_to_purl_map.py",
69+
"--ignore=vulnerabilities/management/commands/purl2cpe.py",
7070
"--ignore=vulnerabilities/lib_oval.py",
7171
]
7272

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = vulnerablecode
3-
version = 30.2.1
3+
version = 30.3.0
44
license = Apache-2.0 AND CC-BY-SA-4.0
55

66
# description must be on ONE line https://github.com/pypa/setuptools/issues/1390

vulnerabilities/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class VulnerabilitySerializer(serializers.HyperlinkedModelSerializer):
9494
fixed_packages = MinimalPackageSerializer(
9595
many=True, source="filtered_fixed_packages", read_only=True
9696
)
97-
affected_packages = MinimalPackageSerializer(many=True, source="vulnerable_to", read_only=True)
97+
affected_packages = MinimalPackageSerializer(many=True, read_only=True)
9898

9999
references = VulnerabilityReferenceSerializer(many=True, source="vulnerabilityreference_set")
100100
aliases = AliasSerializer(many=True, source="alias")

0 commit comments

Comments
 (0)