DefectDojo / django-DefectDojo

DevSecOps, ASPM, Vulnerability Management. All on one platform.
https://defectdojo.com
BSD 3-Clause "New" or "Revised" License
3.75k stars 1.56k forks source link

Custom Report is fetching resources from the wrong location #5917

Closed schewara closed 2 years ago

schewara commented 2 years ago

Bug description

Custom Reports can not be generated, as some requests are directed to a incorrect location.

When clicking on the Run button for creating a Custom HTML Report, the Browser tries to fetch /static/bootswatch/readable/bootstrap.min.css from my Workstations Public IP.

Searching through the Codebase, I found, that

are using

<link href="{{ host }}{% static "bootswatch/readable/bootstrap.min.css" %}" rel="stylesheet">

while other Templates use

<link href="{{ STATIC_URL }}bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

which could maybe explain the source of the problem

Steps to reproduce Steps to reproduce the behavior:

  1. Go to 'https://dd.your.tld/reports/builder'
  2. Fill out the 'Report Options' with 'Report type' = HTML
  3. Open some 'Web Developer Tool' to show the requests
  4. Click on 'RUN'
  5. In the 'Web Developer Tool' you will see a request to https://my-public-ip:8080/static/bootswatch/readable/bootstrap.min.css
  6. After the Browser runs into a time-out an Empty Page (at least on my end) is shown, but some more Infos can be found in the returned source
<body>
<div id="[summary]()">
  <h1>Forbidden <span>(403)</span></h1>
  <p>CSRF verification failed. Request aborted.</p>

  <p>You are seeing this message because this HTTPS site requires a “Referer header” to be sent by your Web browser, but none was sent. This header is required for security reasons, to ensure that your browser is not being hijacked by third parties.</p>
  <p>If you have configured your browser to disable “Referer” headers, please re-enable them, at least for this site, or for HTTPS connections, or for “same-origin” requests.</p>
  <p>If you are using the &lt;meta name=&quot;referrer&quot; content=&quot;no-referrer&quot;&gt; tag or including the “Referrer-Policy: no-referrer” header, please remove them. The CSRF protection requires the “Referer” header to do strict referer checking. If you’re concerned about privacy, use alternatives like &lt;a rel=&quot;noreferrer&quot; …&gt; for links to third-party sites.</p>
</div>
<div id="[explanation]()">
  <p><small>More information is available with DEBUG=True.</small></p>
</div>
</body>

Expected behavior Based on the Log-file, the Report is generated, but never shown in the Browser.

Deployment method (select with an X)

Environment information

Logs As the Clientsends the Request to the wrong location, no errors can be found in the logs.

StefanFl commented 2 years ago

merged for release 2.8.0