Skip to content

Commit acb46e7

Browse files
committed
Add UI for V2
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 990121a commit acb46e7

29 files changed

+1974
-66
lines changed

vulnerabilities/forms.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ class VulnerabilitySearchForm(forms.Form):
3535
)
3636

3737

38+
class AdvisorySearchForm(forms.Form):
39+
40+
search = forms.CharField(
41+
required=True,
42+
widget=forms.TextInput(
43+
attrs={"placeholder": "Advisory id or alias such as CVE or GHSA"}
44+
),
45+
)
46+
3847
class ApiUserCreationForm(forms.ModelForm):
3948
"""
4049
Support a simplified creation for API-only users directly from the UI.

vulnerabilities/improvers/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
from vulnerabilities.pipelines import flag_ghost_packages
2121
from vulnerabilities.pipelines import populate_vulnerability_summary_pipeline
2222
from vulnerabilities.pipelines import remove_duplicate_advisories
23+
from vulnerabilities.pipelines.v2_improvers import compute_package_risk as compute_package_risk_v2
24+
from vulnerabilities.pipelines.v2_improvers import (
25+
computer_package_version_rank as compute_version_rank_v2,
26+
)
27+
from vulnerabilities.pipelines.v2_improvers import enhance_with_exploitdb as exploitdb_v2
28+
from vulnerabilities.pipelines.v2_improvers import enhance_with_kev as enhance_with_kev_v2
29+
from vulnerabilities.pipelines.v2_improvers import (
30+
enhance_with_metasploit as enhance_with_metasploit_v2,
31+
)
32+
from vulnerabilities.pipelines.v2_improvers import flag_ghost_packages as flag_ghost_packages_v2
2333

2434
IMPROVERS_REGISTRY = [
2535
valid_versions.GitHubBasicImprover,
@@ -49,6 +59,12 @@
4959
add_cvss31_to_CVEs.CVEAdvisoryMappingPipeline,
5060
remove_duplicate_advisories.RemoveDuplicateAdvisoriesPipeline,
5161
populate_vulnerability_summary_pipeline.PopulateVulnerabilitySummariesPipeline,
62+
exploitdb_v2.ExploitDBImproverPipeline,
63+
enhance_with_kev_v2.VulnerabilityKevPipeline,
64+
flag_ghost_packages_v2.FlagGhostPackagePipeline,
65+
enhance_with_metasploit_v2.MetasploitImproverPipeline,
66+
compute_package_risk_v2.ComputePackageRiskPipeline,
67+
compute_version_rank_v2.ComputeVersionRankPipeline,
5268
]
5369

5470
IMPROVERS_REGISTRY = {

vulnerabilities/migrations/0092_advisoryalias_advisoryreference_advisoryseverity_and_more.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 4.2.20 on 2025-05-21 05:33
1+
# Generated by Django 4.2.20 on 2025-05-27 10:43
22

33
from django.db import migrations, models
44

@@ -67,7 +67,7 @@ class Migration(migrations.Migration):
6767
blank=True,
6868
db_index=True,
6969
help_text="An optional reference ID, such as DSA-4465-1 when available",
70-
max_length=200,
70+
max_length=500,
7171
),
7272
),
7373
],
@@ -261,7 +261,7 @@ class Migration(migrations.Migration):
261261
(
262262
"advisory_id",
263263
models.CharField(
264-
help_text="An advisory is a unique vulnerability identifier in some database, such as CVE-2020-2233",
264+
help_text="An advisory is a unique vulnerability identifier in some database, such as PYSEC-2020-2233",
265265
max_length=50,
266266
),
267267
),
@@ -293,7 +293,7 @@ class Migration(migrations.Migration):
293293
),
294294
),
295295
(
296-
"created_by",
296+
"datasource_ID",
297297
models.CharField(
298298
help_text="Fully qualified name of the importer prefixed with themodule name importing the advisory. Eg:vulnerabilities.pipeline.nginx_importer.NginxImporterPipeline",
299299
max_length=100,
@@ -330,7 +330,7 @@ class Migration(migrations.Migration):
330330
"affecting_packages",
331331
models.ManyToManyField(
332332
help_text="A list of packages that are affected by this advisory.",
333-
related_name="fixing_advisories",
333+
related_name="affected_by_advisories",
334334
to="vulnerabilities.packagev2",
335335
),
336336
),
@@ -346,7 +346,7 @@ class Migration(migrations.Migration):
346346
"fixed_by_packages",
347347
models.ManyToManyField(
348348
help_text="A list of packages that are reported by this advisory.",
349-
related_name="affected_by_advisories",
349+
related_name="fixing_advisorues",
350350
to="vulnerabilities.packagev2",
351351
),
352352
),

vulnerabilities/migrations/0093_alter_advisoryreference_reference_id.py

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Generated by Django 4.2.20 on 2025-05-27 12:30
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
("vulnerabilities", "0092_advisoryalias_advisoryreference_advisoryseverity_and_more"),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name="advisoryv2",
16+
name="datasource_ID",
17+
field=models.CharField(
18+
help_text="Fully qualified name of the importer prefixed with themodule name importing the advisory. Eg:nginx_importer_v2",
19+
max_length=100,
20+
),
21+
),
22+
migrations.AlterField(
23+
model_name="advisoryv2",
24+
name="fixed_by_packages",
25+
field=models.ManyToManyField(
26+
help_text="A list of packages that are reported by this advisory.",
27+
related_name="fixing_advisories",
28+
to="vulnerabilities.packagev2",
29+
),
30+
),
31+
migrations.CreateModel(
32+
name="AdvisoryExploit",
33+
fields=[
34+
(
35+
"id",
36+
models.AutoField(
37+
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
38+
),
39+
),
40+
(
41+
"date_added",
42+
models.DateField(
43+
blank=True,
44+
help_text="The date the vulnerability was added to an exploit catalog.",
45+
null=True,
46+
),
47+
),
48+
(
49+
"description",
50+
models.TextField(
51+
blank=True,
52+
help_text="Description of the vulnerability in an exploit catalog, often a refinement of the original CVE description",
53+
null=True,
54+
),
55+
),
56+
(
57+
"required_action",
58+
models.TextField(
59+
blank=True,
60+
help_text="The required action to address the vulnerability, typically to apply vendor updates or apply vendor mitigations or to discontinue use.",
61+
null=True,
62+
),
63+
),
64+
(
65+
"due_date",
66+
models.DateField(
67+
blank=True,
68+
help_text="The date the required action is due, which applies to all USA federal civilian executive branch (FCEB) agencies, but all organizations are strongly encouraged to execute the required action",
69+
null=True,
70+
),
71+
),
72+
(
73+
"notes",
74+
models.TextField(
75+
blank=True,
76+
help_text="Additional notes and resources about the vulnerability, often a URL to vendor instructions.",
77+
null=True,
78+
),
79+
),
80+
(
81+
"known_ransomware_campaign_use",
82+
models.BooleanField(
83+
default=False,
84+
help_text="Known' if this vulnerability is known to have been leveraged as part of a ransomware campaign; \n or 'Unknown' if there is no confirmation that the vulnerability has been utilized for ransomware.",
85+
),
86+
),
87+
(
88+
"source_date_published",
89+
models.DateField(
90+
blank=True,
91+
help_text="The date that the exploit was published or disclosed.",
92+
null=True,
93+
),
94+
),
95+
(
96+
"exploit_type",
97+
models.TextField(
98+
blank=True,
99+
help_text="The type of the exploit as provided by the original upstream data source.",
100+
null=True,
101+
),
102+
),
103+
(
104+
"platform",
105+
models.TextField(
106+
blank=True,
107+
help_text="The platform associated with the exploit as provided by the original upstream data source.",
108+
null=True,
109+
),
110+
),
111+
(
112+
"source_date_updated",
113+
models.DateField(
114+
blank=True,
115+
help_text="The date the exploit was updated in the original upstream data source.",
116+
null=True,
117+
),
118+
),
119+
(
120+
"data_source",
121+
models.TextField(
122+
blank=True,
123+
help_text="The source of the exploit information, such as CISA KEV, exploitdb, metaspoit, or others.",
124+
null=True,
125+
),
126+
),
127+
(
128+
"source_url",
129+
models.URLField(
130+
blank=True,
131+
help_text="The URL to the exploit as provided in the original upstream data source.",
132+
null=True,
133+
),
134+
),
135+
(
136+
"advisory",
137+
models.ForeignKey(
138+
on_delete=django.db.models.deletion.CASCADE,
139+
related_name="exploits",
140+
to="vulnerabilities.advisoryv2",
141+
),
142+
),
143+
],
144+
),
145+
]

0 commit comments

Comments
 (0)