twaldear / flask-csp Goto Github PK
View Code? Open in Web Editor NEWContent Security Policy header support for Flask
License: MIT License
Content Security Policy header support for Flask
License: MIT License
I know it's redundant and already mentioned in the guide you link to, but it could be helpful to remind users that the data
permission is spelled with a colon, e.g.:
@csp_header({'default-src':"'none'",'script-src':"'self'", 'font-src': "data: 'self'"})
..if you are a little sloppy and in a hurry like me it was quite possible to lose a bit of time there.
Thanks for a nice extension!
It would be helpful if csp.py
were refactored to make it easier to use it in other ways besides decorating a standard Flask route. For example, extracting a function to apply CSP to a Flask response, so that it could be called from an after_app_request
hook.
This line in example has one to many brackets README.md#L92.
There is a try/except clause which uses a Python 2.5 syntax which is deprecated in 2.6 and removed in 3.0+.
The culprit is line 14 in csp.py: except Exception, e:
should be except Exception as e:
in Python 2.6+ according to the style guide.
Hey,
There are .pyc
files in the repo. Noone needs them when cloning the repo, so please remove them and add .gitignore
file with *.pyc
record.
Also, this might be handy.
F:\Coding\app> python dash.py
Traceback (most recent call last):
File "dash.py", line 3, in
from flask_csp.csp import csp_header
File "C:\ProgramData\Anaconda3\lib\site-packages\flask_csp\csp.py", line 14
except Exception, e:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.