-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Summary
Currently, when using the WebUI, clicking the link for a completed scan result triggers an automatic download of the HTML file. While having the file locally is useful for archiving, it would improve the user experience if the report rendered directly in the browser.
Steps to Reproduce
In WebUI, click any scan result e.g. https://127.0.0.1:8080/results/get?id=2, the result in HTML is downloaded
I expected scan results in HTML are viewable in the browser window of WebUI
Suggested Fix
The API in nettacker/api/engine.py can change text/plain to text/html and attachment to inline at least for HTML files.
Nettacker/nettacker/api/engine.py
Lines 373 to 376 in ed9c8ca
| @app.route("/results/get", methods=["GET"]) | |
| def get_result_content(): | |
| """ | |
| get a result HTML/TEXT/JSON content |
Nettacker/nettacker/api/engine.py
Lines 393 to 394 in ed9c8ca
| mimetype=mime_types().get(os.path.splitext(filename)[1], "text/plain"), | |
| headers={"Content-Disposition": "attachment;filename=" + filename.split("/")[-1]}, |
I am curious if the current "force download" behavior was a deliberate design choice to mitigate security risks, such as preventing potential Cross-Site Scripting (XSS). We might implement a secure rendering method like a sandboxed iframe or strict Content-Security-Policy headers to balance safety with a smoother UI.
I would love to contribute a fix for this if the maintainers agree this is a worthwhile improvement. Please let me know if you would like me to submit a PR.