Skip to content

Commit d07788c

Browse files
committed
Fixing Merge Conflicts
2 parents 6c37be2 + bc19dd3 commit d07788c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+621
-209
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ notifications:
5656
slack:
5757
rooms:
5858
secure: nPXwHnPcf37yGkCkLimx5UmY9LTtOHL0lw88cAQeXCNNjeZuhS2jS5xGUOwwp3SrsYE4tZhD0WuVEHGDcyIhmBZh9Qqk3NHKz+tQDD/e0GE/8uTTfR1Eh+pq1YOIcLYzzKA2khmJSeHqqDriVZZoWpn67oHtrui9FYesapZ8AX0=
59-
on_success: change
60-
on_failure: always
59+
on_success: never
60+
on_failure: never
6161
on_start: never
6262
addons:
6363
firefox: "45.0"

ansible/dev-install/templates/settings.py.j2

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ LOGIN_REDIRECT_URL = '/'
99
SESSION_COOKIE_HTTPONLY = True
1010
CSRF_COOKIE_HTTPONLY = True
1111
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
12-
ENABLE_DEDUPLICATION = False
13-
ENABLE_JIRA = False
14-
# True will display S0, S1, S2, ect in most places
15-
# False will display Critical, High, Medium, etc
16-
S_FINDING_SEVERITY_NAMING = False
1712
URL_PREFIX = ''
1813

1914
# Uncomment this line if you enable SSL

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/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+

docs/upgrading.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,27 @@ The following needs to be added to settings.py: ::
7171
]
7272

7373
Once all these steps are completed your installation of DefectDojo will be running under Django 1.11
74+
75+
76+
July 6th 2017 - New location for system settings
77+
================================================
78+
79+
Pull request #313 moves a number of system settings previously located in the application's settings.py
80+
to a model that can be used and changed within the web application under "Configuration -> System Settings".
81+
82+
If you're using a custom ``URL_PREFIX`` you will need to set this in the model after upgrading by
83+
editing ``dojo/fixtures/system_settings.json`` and setting your URL prefix in the ``url_prefix`` value there.
84+
Then issue the command ``./manage.py loaddata system_settings.json`` to load your settings into the database.
85+
86+
If you're not using a custom ``URL_PREFIX``, after upgrading simply go to the System Settings page and review
87+
which values you want to set for each setting, as they're not automatically migrated from settings.py.
88+
89+
If you like you can then remove the following settings from settings.py to avoid confusion:
90+
91+
* ``ENABLE_DEDUPLICATION``
92+
* ``ENABLE_JIRA``
93+
* ``S_FINDING_SEVERITY_NAMING``
94+
* ``URL_PREFIX``
95+
* ``TIME_ZONE``
96+
* ``TEAM_NAME``
97+

dojo/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
ScanSettingsForm, FindingForm, StubFindingForm, FindingTemplateForm, \
2525
ImportScanForm, SEVERITY_CHOICES
2626
from dojo.tools.factory import import_parser_factory
27-
27+
from dojo.utils import get_system_setting
2828
from datetime import datetime
2929

30-
localtz = timezone(settings.TIME_ZONE)
30+
localtz = timezone(get_system_setting('time_zone'))
3131

3232
"""
3333
Setup logging for the api

dojo/cred/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
from dojo.forms import *
2727
from dojo.tasks import *
2828
from dojo.forms import *
29-
from dojo.utils import dojo_crypto_encrypt, prepare_for_view, FileIterWrapper
29+
from dojo.utils import dojo_crypto_encrypt, prepare_for_view, FileIterWrapper, get_system_setting
3030
from dojo.product import views as ds
3131

32-
localtz = timezone(settings.TIME_ZONE)
32+
localtz = timezone(get_system_setting('time_zone'))
3333

3434
logging.basicConfig(
3535
level=logging.DEBUG,

dojo/development_environment/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
from dojo.filters import DevelopmentEnvironmentFilter
1313
from dojo.forms import Development_EnvironmentForm
1414
from dojo.models import Development_Environment
15-
from dojo.utils import get_page_items, add_breadcrumb
15+
from dojo.utils import get_page_items, add_breadcrumb, get_system_setting
1616

17-
localtz = timezone(settings.TIME_ZONE)
17+
localtz = timezone(get_system_setting('time_zone'))
1818

1919
logging.basicConfig(
2020
level=logging.DEBUG,

dojo/endpoint/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
from dojo.forms import EditEndpointForm, \
1818
DeleteEndpointForm, AddEndpointForm, EndpointMetaDataForm
1919
from dojo.models import Product, Endpoint, Finding
20-
from dojo.utils import get_page_items, add_breadcrumb, get_period_counts
20+
from dojo.utils import get_page_items, add_breadcrumb, get_period_counts, get_system_setting
2121
from django.contrib.contenttypes.models import ContentType
2222
from custom_field.models import CustomFieldValue, CustomField
2323

24-
localtz = timezone(settings.TIME_ZONE)
24+
localtz = timezone(get_system_setting('time_zone'))
2525

2626
logging.basicConfig(
2727
level=logging.DEBUG,

dojo/engagement/views.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
JIRA_PKey, JIRA_Conf, JIRA_Issue, Cred_User, Cred_Mapping
2727
from dojo.tools.factory import import_parser_factory
2828
from dojo.utils import get_page_items, add_breadcrumb, handle_uploaded_threat, \
29-
FileIterWrapper, get_cal_event, message
29+
FileIterWrapper, get_cal_event, message, get_system_setting
3030
from dojo.tasks import update_epic_task, add_epic_task, close_epic_task
3131

32-
localtz = timezone(settings.TIME_ZONE)
32+
localtz = timezone(get_system_setting('time_zone'))
3333

3434
logging.basicConfig(
3535
level=logging.DEBUG,
@@ -141,12 +141,12 @@ def edit_engagement(request, eid):
141141
except:
142142
enabled = False
143143
pass
144-
if hasattr(settings, "ENABLE_JIRA"):
145-
if settings.ENABLE_JIRA:
146-
if JIRA_PKey.objects.filter(product=eng.product).count() != 0:
147-
jform = JIRAFindingForm(prefix='jiraform', enabled=enabled)
148-
else:
149-
jform = None
144+
145+
if get_system_setting('enable_jira') and JIRA_PKey.objects.filter(product=eng.product).count() != 0:
146+
jform = JIRAFindingForm(prefix='jiraform', enabled=enabled)
147+
else:
148+
jform = None
149+
150150
form.initial['tags'] = [tag.name for tag in eng.tags]
151151
add_breadcrumb(parent=eng, title="Edit Engagement", top_level=False, request=request)
152152
return render(request, 'dojo/new_eng.html',
@@ -309,7 +309,11 @@ def add_tests(request, eid):
309309
if form.is_valid():
310310
new_test = form.save(commit=False)
311311
new_test.engagement = eng
312-
# new_test.lead = User.objects.get(id=form['lead'].value())
312+
try:
313+
new_test.lead = User.objects.get(id=form['lead'].value())
314+
except:
315+
new_test.lead = None
316+
pass
313317
new_test.save()
314318
tags = request.POST.getlist('tags')
315319
t = ", ".join(tags)
@@ -338,6 +342,8 @@ def add_tests(request, eid):
338342
return HttpResponseRedirect(reverse('view_engagement', args=(eng.id,)))
339343
else:
340344
form = TestForm()
345+
form.initial['target_start'] = eng.target_start
346+
form.initial['target_end'] = eng.target_end
341347
add_breadcrumb(parent=eng, title="Add Tests", top_level=False, request=request)
342348
return render(request, 'dojo/add_tests.html',
343349
{'form': form,

0 commit comments

Comments
 (0)