Commit Graph

19 Commits

Author SHA1 Message Date
c1c40208ca Another try at fixing google analytics vs CSP 2018-12-22 16:24:10 +01:00
3606b102b0 Allow all of google-analytics in CSP
It needs a tleast both www.google-analytics and ssl.google-analytics..
2018-12-22 16:22:35 +01:00
d36ea4a985 Enable setting of security http headers
The following security policy headers are set:

X-XSS-Protection: 1; mode=block -- always set

X-Frame-Options: DENY is set for all pages except for the documentation
  pages, primarily because pgadmin4 loads them in an iframe which would
  break.

Content-Security-Policy: <x>-src
  Is set to allow the default of self only, then allowing scripts for
  google analytics and fonts for google fonts. Images are allowed from everywhere.
  frame-ancestors 'none' is set by the same rules as X-Frame-Options

This also adds a decorator for @script_sources to have a single view
allow extra sources, and this is used for recaptcha. A generic decorator
is also made for other types of exclusions, though we don't have any at
this point.

If the setting SECURITY_POLICY_REPORT_ONLY is set to True then the policy
will be report-only and not enforced (for testing), otherwise enforcing
mode is enabled.

The setting SECURITY_POLICY_REPORT_URI sets where to send security
policy reports, if any.
2018-12-21 21:46:28 +01:00
747cc8f06a Add support for doing ESI on pages in Varnish 2018-06-29 18:03:25 +02:00
dcd98cf6fe Add support for automatic template based xkey
This adds an xkey header to all outgoing requests with the hash of the
name of all templates loaded. In the future we will be able to use this
to purge "all pages that included a specific template", regardless of
where in the hierarchy it was loaded.

Do this by faking a template loader that never finds anything -- but it
will record the path of the template that it tried to load, and then
leave it to another template loader to actually load it. Store this in
thread local storage (it's a bit ugly, but it's the only thing Django
supports for storing things at the request level from a template
loader), and fetch it from the middleware.
2018-06-29 18:01:35 +02:00
0c6099e236 Remove unused imports 2018-06-29 13:40:04 +02:00
2f52c4f7c4 Clean up whitespace in primary Python / HTML files
Clean up the whitespace in the primary Python / HTML files in
order to make it easier to apply changes going forward.
2017-11-29 08:21:35 -05:00
3c089cd09a Remove SSL decorators and middleware
The site is now served regardless of SSL, and assumes that the webserver
or web cache ensures that things rae always SSL.
2016-05-24 21:13:00 +02:00
753d20545a Remove SSL optional tag 2016-05-24 21:13:00 +02:00
b1ae5f8ec0 Remove workaround for django bug #15152.
This bug is fixed before django 1.8, so remove our workaround which
should now be unnecessary.
2016-05-19 14:23:52 -04:00
385dd66a7c Remove workaround for persistent admin filters
Persistent admin filters are fixed in django 1.8
2016-05-19 14:23:47 -04:00
596520ba13 Implement workaround for django bug #15152 for badly encoded URLs
Hopefully this will stop the system spamming us..
2014-06-03 09:26:48 +02:00
048a17ae4b Don't redirect dynamic CSS from https to http
This can break things (d'uh).

Do this by introducing a new decorator, @ssl_optional. When this is
present, no SSL redirection will happen, regardless of whether the
access comes in over http or https.

This decorator overrides @ssl_required, but for redability's sake,
never use both at the same time.
2014-01-02 12:00:32 +01:00
756aa6ffbe Clean up imports
Remove unused imports and some other completely unused code.
2014-01-01 15:42:30 +01:00
5a4e2ea792 Make filters in admin be sticky, according to:
http://code.djangoproject.com/ticket/3777
2013-01-30 11:41:14 +01:00
557c44fab5 Update @ssl_required decorator to play nice with other decorators
The decorator now retains all attributes of the original view and adds a
new 'view.ssl_required = True' attribute.
2012-11-11 16:07:05 +01:00
4936664ddb Enforce redirection of /admin/ to https in the django code instead,
seems impossible to get it working properly in the webserver...
2010-06-09 19:47:27 +02:00
5f619889d7 Make https redirection work again.
Add a way to skip https redirection, so we can still run it locally,
and mark a couple of forms as requiring https.
2009-09-16 15:46:17 +02:00
90b758c247 A first very basic import.
Contains basic functionality, and an import of most of the static content
from the old site.

There is still plenty more to do...
2009-09-14 14:39:25 +02:00