summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoreugenijm <eugenijm@protonmail.com>2021-01-08 12:06:04 +0300
committereugenijm <eugenijm@protonmail.com>2021-01-21 21:55:11 +0300
commit133644dfa2e46dc48980ae6f835b7aa2758b4250 (patch)
treeab043113d6db4cc4729aad8cbded8a8bd8ff185e /lib
parentd8860eaee46c9bc0a079e90dfb008c54923d7330 (diff)
downloadpleroma-133644dfa2e46dc48980ae6f835b7aa2758b4250.tar.gz
pleroma-133644dfa2e46dc48980ae6f835b7aa2758b4250.zip
Ability to set the Service-Worker-Allowed header
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/plugs/http_security_plug.ex8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/pleroma/web/plugs/http_security_plug.ex b/lib/pleroma/web/plugs/http_security_plug.ex
index 4b84f575d..6c959a870 100644
--- a/lib/pleroma/web/plugs/http_security_plug.ex
+++ b/lib/pleroma/web/plugs/http_security_plug.ex
@@ -23,6 +23,7 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlug do
defp headers do
referrer_policy = Config.get([:http_security, :referrer_policy])
report_uri = Config.get([:http_security, :report_uri])
+ service_worker_allowed = Config.get([:http_security, :service_worker_allowed])
headers = [
{"x-xss-protection", "1; mode=block"},
@@ -34,6 +35,13 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlug do
{"content-security-policy", csp_string()}
]
+ headers =
+ if service_worker_allowed do
+ [{"service-worker-allowed", service_worker_allowed} | headers]
+ else
+ headers
+ end
+
if report_uri do
report_group = %{
"group" => "csp-endpoint",