flask - How to allow inline scripts and styles under CSP? -
i want apply content security polices application, using extension called flask_tailsman
handles setting http headers can protect against few common web application security issues.
i've created csp list contains polices inside code:
csp = { 'default-src': '\'self\'', 'img-src': '*', 'script-src': [ 'cdnjs.cloudflare.com', 'code.jquery.com', '127.0.0.1:5000', ], 'connect-src': '\'self\'', "style-src": [ 'unsafe-inline', '127.0.0.1:5000' ], 'font-src': '\'self\'', } secure_header.init_app(app, content_security_policy=csp)
in documentation allow inline codes, should use unsafe-inline
rather default 'self'.
if opened app inside console gives me punch of errors thats says:
refused apply inline style because violates following content security policy directive: "style-src unsafe-inline 127.0.0.1:5000". either 'unsafe-inline' keyword, hash ('sha256-cwe3bg0vyqoidnakbb/btdkhul49qzuwgncmpgny5zw='), or nonce ('nonce-...') required enable inline execution.'
refused execute inline script because violates following content security policy directive: "script-src cdnjs.cloudflare.com code.jquery.com 127.0.0.1:5000". either 'unsafe-inline' keyword, hash ('sha256-bnbhrziv8cmknm4i7fagtmjxrwebmln96v4mq+blvk4='), or nonce ('nonce-...') required enable inline execution.
in front-end design need inline styles can't delete them, please solving problem ???
Comments
Post a Comment