diff options
author | rinpatch <rinpatch@sdf.org> | 2020-05-29 12:32:48 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-05-29 12:32:48 +0300 |
commit | 27180611dfffd064e65793f90c67dc16fff8ecc2 (patch) | |
tree | 44747025f6d2b4dd2faa3b6036071ae75c9a8747 /lib | |
parent | 29ff6d414ba096e74e04264af895abcabcf580b4 (diff) | |
download | pleroma-27180611dfffd064e65793f90c67dc16fff8ecc2.tar.gz |
HTTP Security plug: make starting csp string generation more readable
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/plugs/http_security_plug.ex | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/pleroma/plugs/http_security_plug.ex b/lib/pleroma/plugs/http_security_plug.ex index df38d5022..2208d1d6c 100644 --- a/lib/pleroma/plugs/http_security_plug.ex +++ b/lib/pleroma/plugs/http_security_plug.ex @@ -49,17 +49,16 @@ defmodule Pleroma.Plugs.HTTPSecurityPlug do end end - @csp_start [ - "default-src 'none'", - "base-uri 'self'", - "frame-ancestors 'none'", - "style-src 'self' 'unsafe-inline'", - "font-src 'self'", - "manifest-src 'self'" - ] - |> Enum.join(";") - |> Kernel.<>(";") - |> List.wrap() + static_csp_rules = [ + "default-src 'none'", + "base-uri 'self'", + "frame-ancestors 'none'", + "style-src 'self' 'unsafe-inline'", + "font-src 'self'", + "manifest-src 'self'" + ] + + @csp_start [Enum.join(static_csp_rules, ";") <> ";"] defp csp_string do scheme = Config.get([Pleroma.Web.Endpoint, :url])[:scheme] |