|
27 | 27 |
|
28 | 28 | class Vulnerability(models.Model): |
29 | 29 | """ |
30 | | - Stores summary and cvss id of a vulnerability. |
| 30 | + A software vulnerability with minimal information. |
| 31 | + Identifiers are stored as VulnerabilityReference. |
31 | 32 | """ |
32 | | - summary = models.TextField(max_length=50, help_text="Summary of the vulnerability") |
33 | | - cvss = models.FloatField(max_length=50, help_text="CVSS Score") |
| 33 | + summary = models.TextField(max_length=1024, |
| 34 | + help_text="Summary of the vulnerability") |
| 35 | + cvss = models.FloatField(help_text="CVSS Score") |
34 | 36 |
|
35 | 37 |
|
36 | 38 | class VulnerabilityReference(models.Model): |
37 | 39 | """ |
38 | | - Stores reference data for a vulnerability. |
| 40 | + Stores one or more remote web site references about a software |
| 41 | + vulnerability data on such as a CVE ID and its web page |
| 42 | + at the NVD, a bug id and similar references. |
39 | 43 | """ |
40 | 44 | vulnerability = models.ForeignKey('Vulnerability') |
41 | | - source = models.CharField(max_length=50, help_text="Source's name eg:NVD") |
42 | | - reference_id = models.CharField(max_length=50, help_text="Reference ID, eg:CVE-ID") |
43 | | - url = models.URLField(max_length=1024, help_text="URL of Vulnerability data") |
| 45 | + source = models.CharField(max_length=50, |
| 46 | + help_text="Source's name eg:NVD") |
| 47 | + reference_id = models.CharField(max_length=50, |
| 48 | + help_text="Reference ID, eg:CVE-ID") |
| 49 | + url = models.URLField(max_length=1024, |
| 50 | + help_text="URL of Vulnerability data") |
| 51 | + |
| 52 | + class Meta: |
| 53 | + unique_together = ('vulnerability', 'source', 'reference_id') |
44 | 54 |
|
45 | 55 |
|
46 | 56 | class ImpactedPackage(models.Model): |
47 | 57 | """ |
48 | | - Links vulnerability to the package(s) impacted. |
| 58 | + Relates a vulnerability to package(s) impacted by it. |
49 | 59 | """ |
50 | 60 | vulnerability = models.ForeignKey('Vulnerability') |
51 | 61 | package = models.ForeignKey('Package') |
52 | 62 |
|
53 | 63 |
|
54 | 64 | class ResolvedPackage(models.Model): |
55 | 65 | """ |
56 | | - Links vulnerability to resolved package(s). |
| 66 | + Relates a vulnerability to package(s) that contain |
| 67 | + a fix or resolution of this vulnerability. |
57 | 68 | """ |
58 | 69 | vulnerability = models.ForeignKey('Vulnerability') |
59 | 70 | package = models.ForeignKey('Package') |
60 | 71 |
|
61 | 72 |
|
62 | 73 | class Package(models.Model): |
63 | 74 | """ |
64 | | - Stores data about a package. |
| 75 | + A software package with minimal identifying information. |
| 76 | + Other identifiers are stored as PackageReference. |
65 | 77 | """ |
66 | | - platform = models.CharField(max_length=50, help_text="Package platform eg:maven") |
| 78 | + platform = models.CharField(max_length=50, |
| 79 | + help_text="Package platform eg:maven") |
67 | 80 | name = models.CharField(max_length=50, help_text="Package name") |
68 | 81 | version = models.CharField(max_length=50, help_text="Pacakge version") |
69 | 82 |
|
| 83 | + class Meta: |
| 84 | + unique_together = ('platform', 'name', 'version') |
| 85 | + |
70 | 86 |
|
71 | 87 | class PackageReference(models.Model): |
72 | 88 | """ |
73 | | - Stores package reference data. |
| 89 | + One or more identifiers and references for a software package |
| 90 | + in a package repository, such as a Debian, Maven or NPM repository. |
74 | 91 | """ |
75 | 92 | package = models.ForeignKey('Package') |
76 | 93 | repository = models.CharField(max_length=1024, |
|
0 commit comments