django-DefectDojo icon indicating copy to clipboard operation
django-DefectDojo copied to clipboard

Broken URL after Editing files with hot-reloading

Open Roooodie opened this issue 4 years ago • 7 comments

Bug description Broken URL makes we cannot operate defectdojo after editing/custom define Jira Fields (dojo/jira_link/helper). i'm using dev with hot reload env.

Steps to reproduce Steps to reproduce the behavior:

  1. Go to 'dojo/jira_link/helper'

  2. Change the jira fields my example: from fields = { 'project': { 'key': jira_project.project_key }, 'summary': jira_summary(obj), 'description': jira_description(obj), 'issuetype': { 'name': jira_instance.default_issue_type }, } to fields = { 'project': { 'key': jira_project.project_key }, 'summary': jira_summary(obj), 'description': jira_description(obj), 'issuetype': { 'name': jira_instance.default_issue_type }, 'versions': [{ 'name': '-' }] }

  3. save '....'

  4. See error in defectdojo

Expected behavior working normally.

Deployment method (select with an X)

  • [X] Docker Compose
  • [ ] Kubernetes
  • [ ] GoDojo

Environment information

  • Operating System: Cent OS 7
  • tested on v. 2.9.0, v.2.11.0

image

Logs [pid: 16|app: 0|req: 824/1878] D.D.24.180 () {44 vars in 861 bytes} [Mon Jun 20 09:11:26 2022] GET /alerts/count => generated 14 bytes in 22 msecs (HTTP/1.1 200) 6 headers in 171 bytes (1 switches on core 1) [pid: 16|app: 0|req: 825/1879] D.D.24.180 () {44 vars in 861 bytes} [Mon Jun 20 09:11:36 2022] GET /alerts/count => generated 14 bytes in 19 msecs (HTTP/1.1 200) 6 headers in 171 bytes (1 switches on core 0) [uwsgi-python-reloader] module/file /app/./dojo/jira_link/helper.py has been modified ...gracefully killing workers... Gracefully killing worker 1 (pid: 15)... Gracefully killing worker 2 (pid: 16)... worker 1 buried after 1 seconds worker 2 buried after 1 seconds binary reloading uWSGI... chdir() to /app closing all non-uwsgi socket fds > 2 (max_fd = 1048576)... found fd 3 mapped to socket 0 (0.0.0.0:3031) running /usr/local/bin/uwsgi *** Starting uWSGI 2.0.20 (64bit) on [Mon Jun 20 09:11:43 2022] *** compiled with version: 10.2.1 20210110 on 12 April 2022 10:44:13 os: Linux-3.10.0-1160.53.1.el7.x86_64 #1 SMP Fri Jan 14 13:59:45 UTC 2022 nodename: 9367e8a69f7a machine: x86_64 clock source: unix detected number of CPU cores: 4 current working directory: /app detected binary path: /usr/local/bin/uwsgi !!! no internal routing support, rebuild with pcre support !!! your memory page size is 4096 bytes detected max file descriptor number: 1048576 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 inherited INET address 0.0.0.0:3031 fd 3 Python version: 3.8.12 (default, Dec 21 2021, 10:55:30) [GCC 10.2.1 20210110] Python main interpreter initialized at 0x55753cd642f0 python threads support enabled your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 1 seconds mapped 274704 bytes (268 KB) for 4 cores *** Operational MODE: preforking+threaded *** *** uWSGI is running in multiple interpreter mode *** gracefully (RE)spawned uWSGI master process (pid: 1) spawned uWSGI worker 1 (pid: 441, cores: 2) spawned uWSGI worker 2 (pid: 442, cores: 2) unable to stat() /app/dojo/setting/settings.py, events will be triggered as soon as the file is created Python auto-reloader enabled [20/Jun/2022 09:11:51] INFO [dojo.models:3753] enabling audit logging [20/Jun/2022 09:11:51] INFO [dojo.models:3753] enabling audit logging WSGI app 0 (mountpoint='') ready in 3 seconds on interpreter 0x55753cd642f0 pid: 441 (default app) WSGI app 0 (mountpoint='') ready in 3 seconds on interpreter 0x55753cd642f0 pid: 442 (default app) [20/Jun/2022 09:11:56] WARNING [django.request:224] Not Found: /alerts/count WARNING:django.request:Not Found: /alerts/count [pid: 441|app: 0|req: 1/1] D.D.24.180 () {44 vars in 861 bytes} [Mon Jun 20 09:11:51 2022] GET /alerts/count => generated 44257 bytes in 4196 msecs (HTTP/1.1 404) 6 headers in 189 bytes (1 switches on core 0) [20/Jun/2022 09:11:56] WARNING [django.request:224] Not Found: /alerts/count WARNING:django.request:Not Found: /alerts/count [pid: 441|app: 0|req: 2/2] D.D.24.180 () {44 vars in 861 bytes} [Mon Jun 20 09:11:56 2022] GET /alerts/count => generated 44257 bytes in 88 msecs (HTTP/1.1 404) 6 headers in 189 bytes (1 switches on core 1)

later: [20/Jun/2022 09:13:27] INFO [dojo.models:3753] enabling audit logging WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x55ad88be72f0 pid: 469 (default app) [20/Jun/2022 09:13:27] INFO [dojo.models:3753] enabling audit logging WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x55ad88be72f0 pid: 470 (default app) [20/Jun/2022 09:13:30] WARNING [django.request:224] Not Found: /http:/D.D.152.36:8080/alerts/count WARNING:django.request:Not Found: /http:/D.D.152.36:8080/alerts/count [pid: 469|app: 0|req: 1/1] D.D.24.180 () {44 vars in 908 bytes} [Mon Jun 20 09:13:27 2022] GET /http://D.D.152.36:8080/alerts/count => generated 44257 bytes in 3026 msecs (HTTP/1.1 404) 6 headers in 189 bytes (1 switches on core 0) [20/Jun/2022 09:13:33] WARNING [django.request:224] Not Found: /http:/D.D.152.36:8080/alerts/count WARNING:django.request:Not Found: /http:/D.D.152.36:8080/alerts/count

Sample scan files If applicable, add sample scan files to help reproduce your problem.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context (optional) Add any other context about the problem here.

Roooodie avatar Jun 20 '22 09:06 Roooodie

even after return it back to the default value, it will still be have that broken URL. also i don't know if it something to do with jira fields, but for my case when i tried to change the fields and after that it still happening ... been tried to rebuild the image, and still get the same error. v.2.9.0 and 2.11.0 are in different Virtual Machine (done it twice).

Roooodie avatar Jun 20 '22 09:06 Roooodie

Have you changed any other setting inbetween? The URL /http:/10.177.152.36:8080/alerts/count looks dodgy.

StefanFl avatar Jun 20 '22 10:06 StefanFl

Have you changed any other setting inbetween? The URL /http:/10.177.152.36:8080/alerts/count looks dodgy.

sadly no, I've only change the push jira finding fields as what i mention above. most likely that the base url got changed to "D.D.152.36:8080/http://D.D.152.36:8080/", which is not correct.

Roooodie avatar Jun 20 '22 14:06 Roooodie

so after tinkering with the container a little bit, i found out that the only way to make the DefectDojo normal again (using the correct url) is by deleting the docker volumes (meaning deleting the entire defectdojo and create a new one?) and build the defectdojo again.

any info on why is this happening?

Roooodie avatar Jun 21 '22 08:06 Roooodie

@Roooodie To be honest, I have no idea what's happening there.

StefanFl avatar Jun 23 '22 06:06 StefanFl

hello @StefanFl . Is it normal when you try to reproduce this on your side? maybe if you can tell me where is the base url configuration placed ? the file where the base url settled/populated from environment var (somehow didn't found it, lol) maybe we can ty to trace it from there.

Roooodie avatar Jun 26 '22 20:06 Roooodie

Found it! my changes in system setting for url_prefix messed it up!

for sometimes I already changed the url_prefix to our domain name. but it never works at the times so we think that it's not active. just after we changes something (restart the container) that setting finally taking action and make our URL broken or so i thought so.

Roooodie avatar Jun 30 '22 20:06 Roooodie