Need Lucky::SecureHeaders::ContentSecurityPolicy #1357
Unanswered
BrucePerens
asked this question in
Feature requests & Ideas
Replies: 1 comment
-
I like this idea. Thanks for putting all this together! Maybe this could be a shard to start out? One suggestion for the tags: def csp_meta_tags(static : Bool = false)
meta "http-equiv": "Report-To", content: ContentSecurityPolicy.report_to
meta "http-equiv": "Content-Security-Policy", content: ContentSecurityPolicy.policy(static)
end
def csp_script(js : String)
script nonce: ContentSecurityPolicy.nonce do
raw js
end
end I've never used CSP before, so I'm not sure if there's ever cases of additional configuration needed, or like in the case of the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Lucky needs to deal with Content Security Policy rather than some of the X-... headers currently in
Lucky::SecureHeaders
. I wrote a not-sufficiently-generalized version for my own application, here it is for your inspiration.Some of the CSP headers are still in flux, I think the
report-to
format has changed in a recent RFC.Context: the application has a separate static and dynamic site, the static site is presently on Wasabi, which won't let me set its CSP headers so they end up in
<meta ...>
tags.config/content_security_policy.cr
src/models/content_security_policy.cr
fragments from main layout:
Definition of the
<script>
wrapper:Use of the
<script>
wrapper:CSP headers in the
<head>
block.static?
tells me if the site being rendered gets the static site policy, or the dynamic site policy.Beta Was this translation helpful? Give feedback.
All reactions