~suligap/canonical-identity-provider:bump-requests-to-2.23.0

Last commit made on 2020-05-28
Get this branch:
git clone -b bump-requests-to-2.23.0 https://git.launchpad.net/~suligap/canonical-identity-provider
Only Przemysław Suliga can upload to this branch. If you are Przemysław Suliga please log in for upload directions.

Branch merges

Branch information

Name:
bump-requests-to-2.23.0
Repository:
lp:~suligap/canonical-identity-provider

Recent commits

e66f5f9... by Przemysław Suliga

Bump requests to 2.23.0

Overlooked in
https://code.launchpad.net/~suligap/canonical-identity-provider/+git/canonical-identity-provider/+merge/384254

7604f54... by Przemysław Suliga

Prepare for talisker's statsd integration

Merged from https://code.launchpad.net/~suligap/canonical-identity-provider/+git/canonical-identity-provider/+merge/384617

3ac6bb4... by Przemysław Suliga

Switch to Django 1.10 style middleware

Merged from https://code.launchpad.net/~suligap/canonical-identity-provider/+git/canonical-identity-provider/+merge/384550

896f48a... by Przemysław Suliga

Prepare for talisker's statsd integration

- Bump statsd package version to 3.3.0 (required by talisker for
  configuring the statsd client)
- Add talisker.django.middleware

After this, talisker can be configured using a STATSD_DSN env var to
send out various metrics to statsd. Currently those will be timers and
counters for views; example counter:

    $prefix.wsgi.latency.account-index.GET.200

The middleware is needed for view name introspection, also for the
purposes of creating these metrics:
https://talisker.readthedocs.io/en/latest/django.html#metadata

This also results in an X-View-Name response header being added.
Example:

    X-View-Name: account-index

Enabling the metrics sending part requires adding a proper STATSD_DSN
env var to talisker's execution env. Later more metrics can be added by
switching to use talisker provided `requests` session for example.

Maybe later, we can look into replacing the django_statsd based
PistonRequestTimingMiddleware metrics by these talisker provided ones.
They have a bit different naming structure (but it might be a win just
letting talisker decide here).

0036cd5... by Przemysław Suliga

Switch to Django 1.10 style middleware

https://docs.djangoproject.com/en/1.11/topics/http/middleware/#upgrading-middleware

In most cases this is adding the MiddlewareMixin to our custom
middleware classes. Plus a version bump for django-honeypot that brings
the new style middleware compatibility.

Other middleware used (django and other 3rd party middleware) was already
compatible.

Requires
https://code.launchpad.net/~suligap/canonical-identity-provider/dependencies-django-honeypot-0.7.0/+merge/384546

5d56f93... by Przemysław Suliga

Drop deprecated django-secure dependency

Merged from https://code.launchpad.net/~suligap/canonical-identity-provider/+git/canonical-identity-provider/+merge/384528

57f14a9... by Przemysław Suliga

Remove djangosecure from INSTALLED_APPS

5d1d22e... by Przemysław Suliga

Drop deprecated django-secure dependency

djangosecure was mostly swallowed by Django in 1.8:
https://docs.djangoproject.com/en/1.8/releases/1.8/#security-enhancements

And switch to django.middleware.security.SecurityMiddleware.

This has the additional benefit of no longer depending on a middleware class
that is not compatible with Django's "new style" MIDDLEWARE:
https://docs.djangoproject.com/en/1.11/topics/http/middleware/#upgrading-middleware

Functionally nothing changes with the djangosecure settings we use:

- `SECURE_BROWSER_XSS_FILTER = True` adds the
  `x-xss-protection: 1; mode=block` response header

- `SECURE_CONTENT_TYPE_NOSNIFF = True` adds the
  `x-content-type-options: nosniff` response header

- SECURE_HSTS_SECONDS and SECURE_HSTS_INCLUDE_SUBDOMAINS are also supported. As
  a side note: It looks like for SSO, HSTS might be configured in its reverse
  proxies, since the max-age values differ between what's being server by
  login.ubuntu.com and the value that exists in SSO's django settings. Also,
  SECURE_HSTS_PRELOAD is not configured in SSO's django settings but `preload`
  exists in responses from login.ubuntu.com.

- SECURE_SSL_REDIRECT (set to None currently) is also supported

- SECURE_FRAME_DENY is being dropped in this change as the behavior is already
  being overriden by Django's XFrameOptionsMiddleware configured in SSO.
  Functionally nothing changes and `X-Frame-Options: SAMEORIGIN` header is being
  added to responses`. This setting was set to None and it does not exist
  outside of djangosecure's middleware.

This change also puts the SecurityMiddleware first in the middleware's list.

1c9af4d... by Przemysław Suliga

Switch to talisker and simplify/standardise the Sentry config

Merged from https://code.launchpad.net/~suligap/canonical-identity-provider/+git/canonical-identity-provider/+merge/384254

b7aa595... by Daniel Manrique

Emit metrics when 2fa devices are added.

The metric includes the device type (automatically-added backup devices
have the fake "paper_auto" type) and subtype (for OATH devices which
can be TOTP or HOTP)

Merged from https://code.launchpad.net/~roadmr/canonical-identity-provider/+git/canonical-identity-provider/+merge/384389