Skip to content

Commit fc8362b

Browse files
committed
Rename and improve cpe<->purl mapping
* Use proper queryset instead of duplicated code. * Update Package and Vulnerability querysets and use these This streamlines some of the core naming and duplication issues * Refactor NVD importer core logic around a CveItem object * Use new querysets rather than refetching from the NVD * Add license and license notice * Update documentation and tests accordingly Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent caaf6c0 commit fc8362b

File tree

10 files changed

+683
-402
lines changed

10 files changed

+683
-402
lines changed

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

vulnerabilities/api.py

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

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

0 commit comments

Comments
 (0)