Skip to content

Commit 746f1fa

Browse files
authored
Merge pull request #3344 from DefectDojo/release/1.10.0
Release: Merge release into master from: release/1.10.0
2 parents e3f4d67 + a022af5 commit 746f1fa

File tree

173 files changed

+21826
-2750
lines changed

Some content is hidden

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

173 files changed

+21826
-2750
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.gitignore
33
*.md
44
.env*
5+
**/local_settings.py

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ coverage.xml
5656
# Django stuff:
5757
*.log
5858
*.pot
59-
**/settings.py
59+
**/local_settings.py
6060

6161
# Vim swapfiles
6262
*.swp
@@ -119,6 +119,13 @@ Pipfile*
119119
docker/certs/*
120120
!docker/certs/readme.txt
121121

122+
#ignore locally added extra fixtures
123+
docker/extra_fixtures/*
124+
!docker/extra_fixtures/readme.txt
125+
docker/extra_settings/*
126+
!docker/extra_settings/README.md
127+
128+
122129
# Helm dependencies
123130
helm/defectdojo/charts
124131

CONTRIBUTING.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Before submitting, please ensure that you are using the latests code by performing a `git pull`.
66

7-
Please include your operating system, your operating system version number (16.04, 10.6, etc), and the dojo install you are using (setup.bash, docker, etc).
7+
Please include your operating system name, your operating system version number (16.04, 18.6, etc), and the dojo install type you are using (setup.bash, docker, etc).
88

99
Bugs that do not have this information will be closed.
1010

@@ -14,17 +14,23 @@ Here are a few things to keep in mind when making changes to DefectDojo.
1414

1515
## Modifying DefectDojo and Testing
1616

17-
Please use [these test scripts](./tests) to test your changes. These are the exact scripts we run in our [Travis Build](https://travis-ci.org/OWASP/django-DefectDojo).
17+
Please use [these test scripts](./tests) to test your changes. These are the scripts we run in our [integration tests](DOCKER.md#run-the-tests-with-docker).
1818

19-
For changes that require additional settings, settings.dist.py is the file you want to change. Settings.py is created by setup.bash from settings.dist.py
19+
For changes that require additional settings, you can now use local_settings.py file. See the logging section below for more information.
2020

2121
## Python3 version
22-
For compatibility reasons, the code in dev branch should be python3.5 compliant.
22+
For compatibility reasons, the code in dev branch should be python3.6 compliant.
2323

2424
## Logging
25-
Logging is configured in `settings.dist.py`.
25+
Logging is configured in `settings.dist.py` and can be tuned using a `local_settings.py`, see [template for local_settings.py](dojo/settings/template-local_settings)
26+
Specific logger can be added. For example to activate logs related to the deduplication, change the level from DEBUG to INFO in `local_settings.py`:
2627

27-
Specific logger can be added. For example to activate logs related to the deduplication, change the level from DEBUG to INFO in:
28+
29+
```
30+
LOGGING['loggers']['dojo.specific-loggers.deduplication']['level'] = 'DEBUG'
31+
```
32+
33+
Or you can modify `settings.dist.py` directly, but this adds the risk of having conflicts when `settings.dist.py` gets updated upstream.
2834

2935
```
3036
'dojo.specific-loggers.deduplication': {
@@ -34,6 +40,10 @@ Specific logger can be added. For example to activate logs related to the dedupl
3440
}
3541
```
3642

43+
## Debug Toolbar
44+
In the `dojo/settings/template-local_settings.py` you'll find instructions on how to enable the [Django Debug Toolbar](https://github.com/jazzband/django-debug-toolbar).
45+
This toolbar allows you to debug SQL queries, and shows some other interesting information.
46+
3747
## Submitting Pull Requests
3848

3949
The following are things to consider before submitting a pull request to
@@ -53,7 +63,7 @@ DefectDojo.
5363

5464
0. Pull requests should be submitted to the 'dev' branch.
5565

56-
0. In dev branch, the code should be python 3.5 compliant.
66+
0. In dev branch, the code should be python 3.6 compliant.
5767

5868
[dojo_settings]: /dojo/settings/settings.dist.py "DefectDojo settings file"
5969
[setup_py]: /setup.py "Python setup script"

DOCKER.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ or
4949
docker-compose build nginx
5050
```
5151

52+
> **_NOTE:_** It's possible to add extra fixtures in folder "/docker/extra_fixtures".
5253
5354
## Run with Docker compose in release mode
5455
To run the application based on previously built image (or based on dockerhub images if none was locally built), run:
@@ -68,7 +69,6 @@ In this setup, you need to rebuild django and/or nginx images after each code ch
6869
For development, use:
6970

7071
```zsh
71-
cp dojo/settings/settings.dist.py dojo/settings/settings.py
7272
docker/setEnv.sh dev
7373
docker-compose build
7474
docker-compose up
@@ -94,9 +94,7 @@ To update changes in static resources, served by nginx, just refresh the browser
9494

9595
*Notes about volume permissions*
9696

97-
*The manual copy of settings.py is sometimes required once after cloning the repository, on linux hosts when the host files cannot be modified from within the django container. In that case that copy in entrypoint-uwsgi-dev.sh fails.*
98-
99-
*Another way to fix this is changing `USER 1001` in Dockerfile.django to match your user uid and then rebuild the images. Get your user id with*
97+
*If you run into permission issues with the mounted volumes, a way to fix this is changing `USER 1001` in Dockerfile.django to match your user uid and then rebuild the images. Get your user id with*
10098

10199
```
102100
id -u
@@ -109,7 +107,6 @@ If you want to be able to step in your code, you can activate ptvsd.Server.
109107
You can launch your local dev instance of DefectDojo as
110108

111109
```zsh
112-
cp dojo/settings/settings.dist.py dojo/settings/settings.py
113110
docker/setEnv.sh ptvsd
114111
docker-compose up
115112
```
@@ -264,7 +261,6 @@ The integration-tests are under `tests`
264261
This will run all unit-tests and leave the uwsgi container up:
265262

266263
```
267-
cp dojo/settings/settings.dist.py dojo/settings/settings.py
268264
docker/setEnv.sh unit_tests
269265
docker-compose up
270266
```
@@ -295,7 +291,6 @@ python manage.py test dojo.unittests.test_dependency_check_parser.TestDependency
295291
This will run all integration-tests and leave the containers up:
296292

297293
```
298-
cp dojo/settings/settings.dist.py dojo/settings/settings.py
299294
docker/setEnv.sh integration_tests
300295
docker-compose up
301296
```

Dockerfile.django

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ RUN \
1717
postgresql-client \
1818
xmlsec1 \
1919
git \
20+
uuid-runtime \
2021
&& \
2122
apt-get clean && \
2223
rm -rf /var/lib/apt/lists && \
@@ -43,8 +44,10 @@ RUN \
4344
libmariadb3 \
4445
xmlsec1 \
4546
git \
47+
uuid-runtime \
4648
# only required for the dbshell (used by the initializer job)
4749
postgresql-client \
50+
curl \
4851
&& \
4952
apt-get clean && \
5053
rm -rf /var/lib/apt/lists && \
@@ -71,15 +74,21 @@ COPY \
7174
/
7275
COPY wsgi.py manage.py tests/unit-tests.sh ./
7376
COPY dojo/ ./dojo/
74-
# Legacy installs need the modified settings.py, do not remove!
75-
RUN \
76-
cp dojo/settings/settings.dist.py dojo/settings/settings.py
77+
78+
# Add extra fixtures to docker image which are loaded by the initializer
79+
COPY docker/extra_fixtures/* /app/dojo/fixtures/
80+
7781
COPY tests/ ./tests/
7882
RUN \
79-
rm -f /readme.txt && \
83+
# Remove placeholder copied from docker/certs
84+
rm -f /readme.txt && \
85+
# Remove placeholder copied from docker/extra_fixtures
86+
rm -f dojo/fixtures/readme.txt && \
8087
mkdir -p dojo/migrations && \
8188
chmod g=u dojo/migrations && \
8289
true
90+
# Fallback for safety parser, if installation does't allow internet connectivity
91+
RUN curl -sS -o dojo/tools/safety/insecure_full.json https://raw.githubusercontent.com/pyupio/safety-db/master/data/insecure_full.json
8392
USER root
8493
RUN \
8594
adduser --system --no-create-home --disabled-password --gecos '' \

Dockerfile.nginx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,15 @@ RUN pip3 install \
5555
COPY components/ ./components/
5656
COPY manage.py ./
5757
COPY dojo/ ./dojo/
58-
RUN \
59-
cp dojo/settings/settings.dist.py dojo/settings/settings.py
58+
6059
RUN \
6160
cd components && \
6261
yarn && \
6362
cd .. && \
64-
python3 manage.py collectstatic --noinput && \
63+
env DD_SECRET_KEY='.' python3 manage.py collectstatic --noinput && \
6564
true
6665

67-
FROM nginx:1.19.3-alpine@sha256:a3c6118edc80de4a5aaf2711b7742c25d4d2da54325bae465205cb386afa79ee
66+
FROM nginx:1.19.4-alpine@sha256:f9ddfb3fd9590a3b6ba095939b7a5aee110a6fb397922e2684d6e189e78329c9
6867
ARG uid=1001
6968
ARG appuser=defectdojo
7069
COPY --from=collectstatic /app/static/ /usr/share/nginx/html/static/

KUBERNETES.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ helm repo update
3232

3333
Helm >= v3
3434
```zsh
35-
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
35+
helm repo add stable https://charts.helm.sh/stable
36+
helm repo add bitnami https://charts.bitnami.com/bitnami
3637
helm repo update
3738
```
3839
Then pull the dependent charts:
@@ -42,20 +43,20 @@ helm dependency update ./helm/defectdojo
4243

4344
Now, install the helm chart into minikube.
4445

45-
If you have setup an ingress controller:
46+
If you have setup an ingress controller:
4647
```zsh
4748
DJANGO_INGRESS_ENABLED=true
4849
```
49-
else:
50+
else:
5051
```zsh
5152
DJANGO_INGRESS_ENABLED=false
5253
```
5354

54-
If you have configured TLS:
55+
If you have configured TLS:
5556
```zsh
5657
DJANGO_INGRESS_ACTIVATE_TLS=true
5758
```
58-
else:
59+
else:
5960
```zsh
6061
DJANGO_INGRESS_ACTIVATE_TLS=false
6162
```
@@ -91,9 +92,9 @@ helm install \
9192
--set createMysqlSecret=true \
9293
--set createPostgresqlSecret=true
9394
```
94-
Note that you need only one of:
95+
Note that you need only one of:
9596
- postgresql or mysql
96-
- rabbitmq or redis
97+
- rabbitmq or redis
9798

9899
It usually takes up to a minute for the services to startup and the
99100
status of the containers can be viewed by starting up ```minikube dashboard```.
@@ -141,7 +142,7 @@ Use the same commands as before but add:
141142
```
142143

143144
### Installing from a private registry
144-
If you have stored your images in a private registry, you can install defectdojo chart with (helm 3).
145+
If you have stored your images in a private registry, you can install defectdojo chart with (helm 3).
145146

146147
- First create a secret named "defectdojoregistrykey" based on the credentials that can pull from the registry: see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
147148
- Then install the chart with the same commands as before but adding:
@@ -167,7 +168,7 @@ docker build --build-arg http_proxy=http://myproxy.com:8080 --build-arg https_pr
167168
### Upgrade the chart
168169
If you want to change kubernetes configuration of use an updated docker image (evolution of defectDojo code), upgrade the application:
169170
```
170-
kubectl delete job defectdojo-initializer
171+
kubectl delete job defectdojo-initializer
171172
helm upgrade defectdojo ./helm/defectdojo/ \
172173
--set django.ingress.enabled=${DJANGO_INGRESS_ENABLED} \
173174
--set django.ingress.activateTLS=${DJANGO_INGRESS_ACTIVATE_TLS}
@@ -317,7 +318,7 @@ kubectl logs $(kubectl get pod --selector=defectdojo.org/component=${POD} \
317318
# Open a shell in a specific pod
318319
kubectl exec -it $(kubectl get pod --selector=defectdojo.org/component=${POD} \
319320
-o jsonpath="{.items[0].metadata.name}") -- /bin/bash
320-
# Or:
321+
# Or:
321322
kubectl exec defectdojo-django-<xxx-xxx> -c uwsgi -it /bin/sh
322323

323324
# Open a Python shell in a specific pod
@@ -337,8 +338,8 @@ Helm >= v3
337338
helm uninstall defectdojo
338339
```
339340

340-
To remove persistent objects not removed by uninstall (this will remove any database):
341+
To remove persistent objects not removed by uninstall (this will remove any database):
341342
```
342343
kubectl delete secrets defectdojo defectdojo-redis-specific defectdojo-rabbitmq-specific defectdojo-postgresql-specific defectdojo-mysql-specific
343344
kubectl delete pvc data-defectdojo-rabbitmq-0 data-defectdojo-postgresql-0
344-
```
345+
```

MAINTAINERS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Furthermore, maintainers that have not had any activities (commits, PR, PR revie
3131

3232
### Maintainers
3333
* Anthony Pipia (@apipia)
34-
* Saurabh (@dr3dd589)
3534
* Jannik Jürgens (@alles-klar)
3635
* Pascal Trovatelli (@ptrovatelli)
36+
37+
### Reviewers
38+
* Saurabh (@dr3dd589)
39+
* Romain Aviolat (@xens)

SPONSORING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
On April 5th, 2018, OWASP clarified their sponsorship requirements to note that time, software, or any other quantifiable contribution can be counted towards the $1000 threshold outlined by the [OWASP Global Policy](https://www.owasp.org/index.php/Project_Sponsorship_Operational_Guidelines).
1+
On April 5th, 2018, OWASP clarified their sponsorship requirements to note that time, software, or any other quantifiable contribution can be counted towards the $1000 threshold outlined by the [OWASP Global Policy](https://owasp.org/www-policy/operational/project-sponsorship).
22

33
Below is our sponsorship guidelines to provide further clarification specific to our project for non-monetary contributions:
44

components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "DefectDojo",
3-
"version": "1.9.3",
3+
"version": "1.10.0",
44
"dependencies": {
55
"JUMFlot": "jumjum123/JUMFlot#*",
66
"bootstrap": "^3.4.0",
@@ -19,7 +19,7 @@
1919
"datatables.net-dt": "^1.10.22",
2020
"drmonty-datatables-plugins": "^1.0.0",
2121
"drmonty-datatables-responsive": "^1.0.0",
22-
"easymde": "^2.12.1",
22+
"easymde": "^2.13.0",
2323
"flot": "flot/flot#~0.8.3",
2424
"flot-axis": "markrcote/flot-axislabels#*",
2525
"font-awesome": "^4.0.0",

0 commit comments

Comments
 (0)