fix: harden license server and web gui security
This commit is contained in:
1 parent
7c6189fd5e
commit
ee3424cd9e
9 files changed
+357
-11
No files matched your search
@@ -21,6 +21,7 @@ from gui.web_gui_pkg import (
|
||||
write_config,
|
||||
proc_runner_ops as _proc_ops,
|
||||
)
|
||||
from gui.web_gui_pkg.request_parsing import send_html_security_headers, send_security_headers
|
||||
|
||||
BASE_DIR = (
|
||||
path_config.PROJECT_ROOT
|
||||
@@ -111,6 +112,7 @@ def _send_html(handler, html: str, status: int = 200) -> None:
|
||||
handler.send_header("Content-Type", "text/html; charset=utf-8")
|
||||
handler.send_header("Content-Length", str(len(data)))
|
||||
handler.send_header("Cache-Control", "no-store")
|
||||
send_html_security_headers(handler)
|
||||
handler.end_headers()
|
||||
handler.wfile.write(data)
|
||||
|
||||
@@ -355,6 +357,7 @@ def handle_get(handler, u, runner, csrf_token: str) -> None:
|
||||
handler.send_header("Content-Type", "image/png")
|
||||
handler.send_header("Content-Length", str(len(_EMPTY_PNG_BYTES)))
|
||||
handler.send_header("Cache-Control", "no-store")
|
||||
send_security_headers(handler)
|
||||
handler.end_headers()
|
||||
handler.wfile.write(_EMPTY_PNG_BYTES)
|
||||
return
|
||||
@@ -372,6 +375,7 @@ def handle_get(handler, u, runner, csrf_token: str) -> None:
|
||||
handler.send_header("Content-Type", ctype)
|
||||
handler.send_header("Content-Length", str(len(data)))
|
||||
handler.send_header("Cache-Control", "no-store")
|
||||
send_security_headers(handler)
|
||||
handler.end_headers()
|
||||
handler.wfile.write(data)
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user