Skip to content

Commit d9f65bc

Browse files
committed
Merge branch 'master' into calendar
2 parents 1b7b8da + 56bfa31 commit d9f65bc

File tree

22 files changed

+521
-26
lines changed

22 files changed

+521
-26
lines changed

docs/dojo-production.rst

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
Running in Production
2+
=====================
3+
4+
This guide will walk you through how to setup DefectDojo for running in production using Ubuntu 16.04, nginx, and uwsgi.
5+
6+
*Install, Setup, and Activate Virtualenv*
7+
8+
.. code-block:: console
9+
10+
pip install virtualenv
11+
12+
virtualenv dojo
13+
14+
source my_project/bin/activate
15+
16+
**Install Dojo**
17+
18+
.. code-block:: console
19+
20+
cd django-DefectDojo
21+
22+
./install.bash
23+
24+
**Install Uwsgi**
25+
26+
.. code-block:: console
27+
28+
pip install uwsgi
29+
30+
**Install WKHTML**
31+
32+
from inside the django-DefectDojo/ directory execute:
33+
34+
.. code-block:: console
35+
36+
./reports.sh
37+
38+
**Disable Debugging**
39+
40+
Using the text-editor of your choice, change ``DEBUG`` in django-DefectDojo/dojo/settings.py to:
41+
42+
.. code-block:: console
43+
44+
`DEBUG = False`
45+
46+
**Start Celery and Beats**
47+
48+
From inside the django-DefectDojo/ directory execute:
49+
50+
.. code-block:: console
51+
52+
celery -A dojo worker -l info --concurrency 3
53+
54+
celery beat -A dojo -l info
55+
56+
It is recommended that you daemonized both these processes with the sample configurations found `here`_ and `here.`_
57+
58+
.. _here: https://github.com/celery/celery/blob/3.1/extra/supervisord/celeryd.conf
59+
.. _here.: https://github.com/celery/celery/blob/3.1/extra/supervisord/celerybeat.conf
60+
61+
However, for a quick setup you can use the following to run both in the background
62+
63+
.. code-block:: console
64+
65+
celery -A dojo worker -l info --concurrency 3 &
66+
67+
celery beat -A dojo -l info &
68+
69+
*Start Uwsgi*
70+
71+
From inside the django-DefectDojo/ directory execute:
72+
73+
.. code-block:: console
74+
75+
uwsgi --socket :8001 --wsgi-file wsgi.py --workers 7
76+
77+
It is recommended that you use an Upstart job or a @restart cron job to launch uwsgi on reboot. However, if you’re in a hurry you can use the following to run it in the background:
78+
79+
.. code-block:: console
80+
81+
uwsgi --socket :8001 --wsgi-file wsgi.py --workers 7 &
82+
83+
*NGINX Configuration*
84+
85+
Everyone feels a little differently about nginx settings, so here are the barebones to add your to your nginx configuration to proxy uwsgi:
86+
87+
.. code-block:: json
88+
89+
upstream django {
90+
91+
server 127.0.0.1:8001;
92+
}
93+
94+
location /dojo/static/ {
95+
alias /data/prod_dojo/django-DefectDojo/static/;
96+
}
97+
98+
location /dojo/media/ {
99+
alias /data/prod_dojo/django-DefectDojo/media/;
100+
}
101+
102+
103+
location /dojo {
104+
uwsgi_pass django;
105+
include /data/prod_dojo/django-DefectDojo/wsgi_params;
106+
}
107+
108+
*That's it!*

docs/features.rst

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -389,18 +389,19 @@ DefectDojo has the ability to import reports from other security tools. Current
389389

390390
1. Burp XML
391391
2. Nessus (CSV, XML)
392-
3. Nexpose XML 2.0
393-
4. ZAP XML
394-
5. Veracode Detailed XML Report
395-
6. Checkmarx Detailed XML Report
396-
7. AppSpider Vulnerabilities Summary XML Report (VulnerabilitiesSummary.xml)
397-
8. Arachni Scanner JSON Report
398-
9. Visual Code Grepper XML or CSV
399-
10. OWASP Dependency Check XML
400-
11. Retire.js JavaScript Scan JSON
401-
12. Node Security Platform JSON
402-
12. Qualys XML
403-
13. Generic Findings in CSV format
392+
3. Nmap (XML)
393+
4. Nexpose XML 2.0
394+
5. ZAP XML
395+
6. Veracode Detailed XML Report
396+
7. Checkmarx Detailed XML Report
397+
8. AppSpider Vulnerabilities Summary XML Report (VulnerabilitiesSummary.xml)
398+
9. Arachni Scanner JSON Report
399+
10. Visual Code Grepper XML or CSV
400+
11. OWASP Dependency Check XML
401+
12. Retire.js JavaScript Scan JSON
402+
13. Node Security Platform JSON
403+
14. Qualys XML
404+
15. Generic Findings in CSV format
404405

405406

406407
The importers analyze each report and create new Findings for each item reported. DefectDojo collapses duplicate

docs/labels.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Issue Labels
2+
============================
3+
4+
This section covers our issue labels and what they mean.
5+
6+
'1.2 release' - These issues are targeted for the 1.2 release of DefectDojo which is scheduled for AppSec USA on September 19th
7+
8+
'believe to be fixed' - Issues that have been investigated / verified where code has been merged to resolve the issue. We do not close verified issues until the person who submitted the issue confirm the fix is working. If the submitter is unresponsive we will go ahead and close a 'believe to be fixed' issue, provided that the author of the code has tested the resolution.
9+
10+
'bug' - Issues that have been investigated and are confirmed.
11+
12+
'code sprint' - DefectDojo is participating in the OWASP 2017 Code Sprint where students assist with OWASP projects. Although this issues are earmarked for the Code Sprint, anyone is welcome to work on a Code Sprint issue, provided that is hasn't been assigned. These are great introductory issues for first time contributors.
13+
14+
'docker' - Issues that are specific to the Docker deployment that are not present in the regular install.
15+
16+
'documentation' - Issues that are related to documentation and do not have any impact related to code or application performance.
17+
18+
'enhancement' - Ideas that are not bugs that may or may not be implemented in the future.
19+
20+
‘high priority’ - Issues that the maintainers consider to be highly impacting and will receive priority.
21+
22+
‘in progress’ - Issues that code is actively being developed for.
23+
24+
‘invalid’ - Issues that invalid possibly from using an old code base or outdated library.
25+
26+
‘investigating’ - Issues that are actively being investigated but haven’t been confirmed as a bug.
27+
28+
‘out of scope’ - Issues that related to third party libraries or code we don’t have control over.
29+
30+
‘question’ - These are questions from the community on, docs, deployment, code, or contributing.
31+
32+
‘swag reward’ - when a ‘swag reward’ issue is fixed, the contributor receives swag (such as shirt, stickers, etc).
33+
34+
‘top priority’ - Issues with this label out-rank ‘high priority’ and receive priority on completion from a maintainer.
35+
36+
‘unable to reproduce’ - The issues has been investigated and the maintainer is not able to reproduce the issue.
37+
38+
‘$100 reward’ - The contributor will receive $100 USD for successfully fixing the issue.
39+
40+

dojo/engagement/views.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,11 @@ def add_tests(request, eid):
315315
if form.is_valid():
316316
new_test = form.save(commit=False)
317317
new_test.engagement = eng
318-
# new_test.lead = User.objects.get(id=form['lead'].value())
318+
try:
319+
new_test.lead = User.objects.get(id=form['lead'].value())
320+
except:
321+
new_test.lead = None
322+
pass
319323
new_test.save()
320324
tags = request.POST.getlist('tags')
321325
t = ", ".join(tags)
@@ -344,6 +348,8 @@ def add_tests(request, eid):
344348
return HttpResponseRedirect(reverse('view_engagement', args=(eng.id,)))
345349
else:
346350
form = TestForm()
351+
form.initial['target_start'] = eng.target_start
352+
form.initial['target_end'] = eng.target_end
347353
add_breadcrumb(parent=eng, title="Add Tests", top_level=False, request=request)
348354
return render(request, 'dojo/add_tests.html',
349355
{'form': form,

dojo/forms.py

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def __init__(self, *args, **kwargs):
183183

184184
class Meta:
185185
model = Product
186-
fields = ['name', 'description', 'tags', 'product_manager', 'technical_contact', 'team_manager', 'prod_type',
186+
fields = ['name', 'description', 'tags', 'prod_manager', 'tech_contact', 'manager', 'prod_type',
187187
'authorized_users']
188188

189189

@@ -228,7 +228,7 @@ class Meta:
228228

229229

230230
class ImportScanForm(forms.Form):
231-
SCAN_TYPE_CHOICES = (("Burp Scan", "Burp Scan"), ("Nessus Scan", "Nessus Scan"), ("Nexpose Scan", "Nexpose Scan"),
231+
SCAN_TYPE_CHOICES = (("Burp Scan", "Burp Scan"), ("Nessus Scan", "Nessus Scan"), ("Nmap Scan", "Nmap Scan"), ("Nexpose Scan", "Nexpose Scan"),
232232
("AppSpider Scan", "AppSpider Scan"), ("Veracode Scan", "Veracode Scan"),
233233
("Checkmarx Scan", "Checkmarx Scan"), ("ZAP Scan", "ZAP Scan"),
234234
("Arachni Scan", "Arachni Scan"), ("VCG Scan", "VCG Scan"),
@@ -555,6 +555,9 @@ class TestForm(forms.ModelForm):
555555
required=False,
556556
help_text="Add tags that help describe this test. "
557557
"Choose from the list or add new tags. Press TAB key to add.")
558+
lead = forms.ModelChoiceField(
559+
queryset=User.objects.exclude(is_staff=False),
560+
required=False, label="Testing Lead")
558561

559562

560563
def __init__(self, *args, **kwargs):
@@ -623,6 +626,46 @@ class Meta:
623626
'review_requested_by')
624627

625628

629+
class AdHocFindingForm(forms.ModelForm):
630+
title = forms.CharField(max_length=1000)
631+
date = forms.DateField(required=True,
632+
widget=forms.TextInput(attrs={'class':
633+
'datepicker'}))
634+
cwe = forms.IntegerField(required=False)
635+
severity_options = (('Low', 'Low'), ('Medium', 'Medium'),
636+
('High', 'High'), ('Critical', 'Critical'))
637+
description = forms.CharField(widget=forms.Textarea)
638+
severity = forms.ChoiceField(
639+
choices=severity_options,
640+
error_messages={
641+
'required': 'Select valid choice: In Progress, On Hold, Completed',
642+
'invalid_choice': 'Select valid choice: Critical,High,Medium,Low'})
643+
mitigation = forms.CharField(widget=forms.Textarea)
644+
impact = forms.CharField(widget=forms.Textarea)
645+
endpoints = forms.ModelMultipleChoiceField(Endpoint.objects, required=False, label='Systems / Endpoints',
646+
widget=MultipleSelectWithPopPlusMinus(attrs={'size': '11'}))
647+
references = forms.CharField(widget=forms.Textarea, required=False)
648+
is_template = forms.BooleanField(label="Create Template?", required=False,
649+
help_text="A new finding template will be created from this finding.")
650+
651+
def clean(self):
652+
# self.fields['endpoints'].queryset = Endpoint.objects.all()
653+
cleaned_data = super(AdHocFindingForm, self).clean()
654+
if ((cleaned_data['active'] or cleaned_data['verified'])
655+
and cleaned_data['duplicate']):
656+
raise forms.ValidationError('Duplicate findings cannot be'
657+
' verified or active')
658+
if cleaned_data['false_p'] and cleaned_data['verified']:
659+
raise forms.ValidationError('False positive findings cannot '
660+
'be verified.')
661+
return cleaned_data
662+
663+
class Meta:
664+
model = Finding
665+
order = ('title', 'severity', 'endpoints', 'description', 'impact')
666+
exclude = ('reporter', 'url', 'numerical_severity', 'endpoint', 'images', 'under_review', 'reviewers',
667+
'review_requested_by')
668+
626669
class PromoteFindingForm(forms.ModelForm):
627670
title = forms.CharField(max_length=1000)
628671
date = forms.DateField(required=True,

dojo/models.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,12 @@ class CWE(models.Model):
416416

417417
class Endpoint(models.Model):
418418
protocol = models.CharField(null=True, blank=True, max_length=10,
419-
help_text="The communication protocl such as 'http', 'ftp', etc.")
419+
help_text="The communication protocol such as 'http', 'ftp', etc.")
420420
host = models.CharField(null=True, blank=True, max_length=500,
421421
help_text="The host name or IP address, you can also include the port number. For example"
422422
"'127.0.0.1', '127.0.0.1:8080', 'localhost', 'yourdomain.com'.")
423+
fqdn = models.CharField(null=True, blank=True, max_length=500)
424+
port = models.IntegerField(null=True, blank=True, help_text="The network port associated with the endpoint.")
423425
path = models.CharField(null=True, blank=True, max_length=500,
424426
help_text="The location of the resource, it should start with a '/'. For example"
425427
"/endpoint/420/edit")
@@ -438,14 +440,19 @@ def __unicode__(self):
438440
from urlparse import uses_netloc
439441

440442
netloc = self.host
443+
fqdn = self.fqdn
444+
port = self.port
441445
scheme = self.protocol
442446
url = self.path if self.path else ''
443447
query = self.query
444448
fragment = self.fragment
445449

450+
if port:
451+
netloc += ':%s' % port
452+
446453
if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
447454
if url and url[:1] != '/': url = '/' + url
448-
if scheme:
455+
if scheme and scheme in uses_netloc and url[:2] != '//':
449456
url = '//' + (netloc or '') + url
450457
else:
451458
url = (netloc or '') + url
@@ -531,6 +538,7 @@ def get_breadcrumbs(self):
531538

532539
class Test(models.Model):
533540
engagement = models.ForeignKey(Engagement, editable=False)
541+
lead = models.ForeignKey(User, editable=True, null=True)
534542
test_type = models.ForeignKey(Test_Type)
535543
target_start = models.DateTimeField()
536544
target_end = models.DateTimeField()

dojo/product/urls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@
2020
name='add_meta_data'),
2121
url(r'^product/(?P<pid>\d+)/edit_meta_data', views.edit_meta_data,
2222
name='edit_meta_data'),
23+
url(r'^product/(?P<pid>\d+)/ad_hoc_finding', views.ad_hoc_finding,
24+
name='ad_hoc_finding'),
2325
]

0 commit comments

Comments
 (0)