From b446175a5d5fe240a57737fbc74f638cde0c83bd Mon Sep 17 00:00:00 2001 From: 1modm Date: Sun, 28 Nov 2021 00:12:48 +0000 Subject: [PATCH] debug mode and templates fix --- app/config/Dockerfile | 2 +- app/config/petereport_config.py | 4 ++-- app/petereport/settings.py | 2 +- app/preport/forms.py | 2 +- app/preport/templates/findings/template_add.html | 6 ++++++ app/preport/templates/home/footer.html | 2 +- app/preport/urls.py | 2 +- app/preport/views.py | 10 ++++++---- docker-compose.yml | 2 +- 9 files changed, 20 insertions(+), 12 deletions(-) diff --git a/app/config/Dockerfile b/app/config/Dockerfile index 8e528d0..683e8e6 100644 --- a/app/config/Dockerfile +++ b/app/config/Dockerfile @@ -22,7 +22,7 @@ ENV LANGUAGE en_US.UTF-8 RUN apt-get -y install python3 python3-dev python3-pip # install dependencies -RUN apt-get -y install pipenv texlive-full python3-pypandoc +RUN apt-get -y install pipenv texlive-full texlive-latex-extra python3-pypandoc RUN apt-get -y install wget RUN apt-get -y install libpangocairo-1.0-0 diff --git a/app/config/petereport_config.py b/app/config/petereport_config.py index 90215d1..3294b9c 100644 --- a/app/config/petereport_config.py +++ b/app/config/petereport_config.py @@ -14,8 +14,8 @@ DJANGO_CONFIG = { 'secret_key': 'django-insecure-key-CHANGEMEPLEASE-pKj9bd9h7*RMCuU', - 'debug': True, - 'admin_module': True, + 'debug': False, + 'admin_module': False, 'allowed_hosts': '[\'*\']', 'server_host': 'http://127.0.0.1:8000' } diff --git a/app/petereport/settings.py b/app/petereport/settings.py index 0d4641e..f1404c4 100644 --- a/app/petereport/settings.py +++ b/app/petereport/settings.py @@ -148,7 +148,7 @@ ) #STATIC_URL = '/static/' -STATIC_DIR = os.path.join(BASE_DIR, 'preport/static') +STATIC_DIR = os.path.join(BASE_DIR, 'static') MEDIA_ROOT = os.path.join(BASE_DIR, "media") diff --git a/app/preport/forms.py b/app/preport/forms.py index 97aed2a..a492a29 100644 --- a/app/preport/forms.py +++ b/app/preport/forms.py @@ -90,7 +90,7 @@ class NewFindingTemplateForm(forms.ModelForm): severity = forms.ChoiceField(choices=severity_choices, required=True, widget=forms.Select(attrs={'class': 'form-control', 'type': "text", 'required': "required", 'placeholder': "Critical/High/Medium/Low/Info/None"})) - cwe = CWEModelChoiceField(queryset=DB_CWE.objects.all(), empty_label="(Select a CWE)", widget=forms.Select(attrs={'class': 'form-control'})) + cwe = CWEModelChoiceField(queryset=DB_CWE.objects.all(), empty_label="(Select a CWE)", widget=forms.Select(attrs={'class': 'form-control select2CWE'})) class Meta: model = DB_Finding_Template diff --git a/app/preport/templates/findings/template_add.html b/app/preport/templates/findings/template_add.html index d6ff44a..92ae62f 100644 --- a/app/preport/templates/findings/template_add.html +++ b/app/preport/templates/findings/template_add.html @@ -771,5 +771,11 @@

- Version 0.1 + Version 0.3
Copyright © 2021 PeTeReport. All rights reserved. diff --git a/app/preport/urls.py b/app/preport/urls.py index 3df3aa9..d2a716b 100644 --- a/app/preport/urls.py +++ b/app/preport/urls.py @@ -64,4 +64,4 @@ path('attacktree/delete/', views.attacktree_delete, name='attacktree_delete'), path('attacktree/edit/', views.attacktree_edit, name='attacktree_edit'), path('attacktree/view/', views.attacktree_view, name='attacktree_view'), -] +] diff --git a/app/preport/views.py b/app/preport/views.py index 245d2fe..c195a45 100644 --- a/app/preport/views.py +++ b/app/preport/views.py @@ -161,9 +161,10 @@ def index(request): cwe_categories = [] for key_cwe, value_cwe in cwe_cat.items(): + fixed_key_cwe = '\n'.join(key_cwe[i:i+70] for i in range(0, len(key_cwe), 70)) dict_cwe = { "value": value_cwe, - "name": key_cwe + "name": fixed_key_cwe } cwe_categories.append(dict_cwe) @@ -186,7 +187,7 @@ def user_list(request): userList = User.objects.values() group_list = Group.objects.all() - return render(request, 'configuration/user_list.html', {'group_list': group_list}) + return render(request, 'configuration/user_list.html', {'userList': userList, 'group_list': group_list}) @@ -454,9 +455,10 @@ def report_view(request,pk): cwe_categories = [] for key_cwe, value_cwe in cwe_cat.items(): + fixed_key_cwe = '\n'.join(key_cwe[i:i+70] for i in range(0, len(key_cwe), 70)) dict_cwe = { "value": value_cwe, - "name": key_cwe + "name": fixed_key_cwe } cwe_categories.append(dict_cwe) @@ -1200,7 +1202,7 @@ def upload_csv_findings(request,pk): f_severity = header.index("Severity") f_cvss_score = header.index("CVSS Base Score") f_cvss = header.index("CVSS Score") - f_cwe = header.index("CWEid") + f_cwe = header.index("CWE ID") f_description = header.index("Description") f_location = header.index("Location") f_impact = header.index("Impact") diff --git a/docker-compose.yml b/docker-compose.yml index 52d73ad..25b059b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,7 @@ services: pipenv run ./app/manage.py makemigrations && pipenv run ./app/manage.py migrate && pipenv run ./app/manage.py loaddata ./app/config/cwe-list.json && - pipenv run gunicorn --chdir ./app petereport.wsgi:application --bind 0.0.0.0:8000" + pipenv run gunicorn --chdir ./app petereport.wsgi:application --timeout 120 --graceful-timeout 60 --bind 0.0.0.0:8000" volumes: - .:/opt/petereport expose: