fix: harden license server and web gui security

This commit is contained in:
Your Name committed 2026-06-28 09:24:22 +08:00
1 parent 7c6189fd5e
commit ee3424cd9e
9 files changed
+357 -11

No files matched your search

+7
View File
@@ -3,6 +3,8 @@ from http import HTTPStatus
from http.server import BaseHTTPRequestHandler
from typing import Callable
from gui.web_gui_pkg.request_parsing import send_html_security_headers, send_security_headers
def serve_static(
handler: BaseHTTPRequestHandler,
@@ -60,6 +62,7 @@ def serve_static(
handler.send_response(HTTPStatus.NOT_MODIFIED)
handler.send_header("ETag", etag)
handler.send_header("Cache-Control", cache_control)
send_security_headers(handler)
handler.end_headers()
return
except Exception:
@@ -68,6 +71,10 @@ def serve_static(
handler.send_header("Content-Type", ctype)
handler.send_header("Content-Length", str(len(data)))
handler.send_header("Cache-Control", cache_control)
if ext == ".html":
send_html_security_headers(handler)
else:
send_security_headers(handler)
if etag:
handler.send_header("ETag", etag)
handler.end_headers()