Add CSP to local web UI forbidding JavaScript eval()
This commit is contained in:
@@ -198,7 +198,10 @@ def _serve_traversable(
|
||||
return NOT_FOUND
|
||||
content_type = MIMETYPES.get(
|
||||
os.path.splitext(traversable.name)[1].lower(), FALLBACK_MIMETYPE)
|
||||
headers = {"Content-Type": content_type}
|
||||
headers = {
|
||||
"Content-Type": content_type,
|
||||
"Content-Security-Policy": "default-src 'self'; object-src 'none'"
|
||||
}
|
||||
if isinstance(traversable, pathlib.Path):
|
||||
headers["Last-Modified"] = time.strftime(
|
||||
"%a, %d %b %Y %H:%M:%S GMT",
|
||||
|
||||
Reference in New Issue
Block a user