Commit Graph

96 Commits

Author SHA1 Message Date
Jim Moffet
509cce38f4 set up basicauth config to protect staging site 2022-06-30 17:05:42 -07:00
Jim Moffet
2b727e13b4 local dev upgrades 2022-06-13 14:26:46 -07:00
Chris Hill-Scott
61045fab89 Bump itsdangerous to the latest version
We were blocked on using the very latest version of itsdangerous because
it was only compatible with versions of Flask greater than 2.

Now that we’re using the latest version of Flask we can also keep this
dependency up to date.
2022-06-06 12:13:38 +01:00
Chris Hill-Scott
8ea2f49ee6 Bump Flask, Jinja and Werkzeug to latest versions
Now that we’ve upgraded itsdangerous to the latest version we are:
- unblocked from upgrading to Flask 2, which requires a recent version
  of itsdangerous
- unblocked from upgrading Jinja and Werkzeug to the latest versions,
  which require Flask 2

This commit just does the version upgrades, breaking changes will be
addressed in subsequent commits.
2022-06-06 12:12:52 +01:00
Ben Thorner
ee3d2d1804 Bump utils to version 56.0.0
The only impactful change is the major version itself, where I've
fixed the breaking changes due to the upgrade of PyPDF2 [^1] and
checked there are no deprecation warnings when I run the tests.

[^1]: https://github.com/alphagov/notifications-utils/pull/973
2022-06-01 13:29:54 +01:00
Katie Smith
600a9afad7 Upgrade itsdangerous from 1.1.0 to 2.0.1
This upgrades itsdangerous by a major version.

When testing most routes we:
* use the `client_request` fixture
  * under the hood this logs in the user with `TestClient.login`
  * logging in the user signs their session with a secret and the current time

For some tests we also:
* wrap the test method with a `freeze_time()` decorator to simulate a past date and time

When Pytest calls the wrapped test method:
* any application code which tries to get the current time will get the frozen time
* any application code getting the current user means decoding the session
* the code which decodes the session will see that the session was created in the future, in other words it has a negative age
  * as of ItsDangerous 2.0.0 signatures with a negative age raise an exception

To avoid all the tests which freeze time failing, this adds itsdangerous
to the list of packages that freezegun ignores.

We can't yet upgrade to a version of itsdangerous that is >= 2.1.0
because there are compatibility issues with Flask 1.x.
2022-05-27 11:45:00 +01:00
Chris Hill-Scott
f1bf991a3c Update prometheus-client from 0.14.0 to 0.14.1 2022-05-26 14:58:27 +01:00
Chris Hill-Scott
83bb7fa8b1 Stop pyup trying to upgrade blocked dependencies
We can’t upgrade Jinja or Werkzeug until we’re on Flask 2.x.x. We can’t
upgrade Flask to 1.1.3 because it pins older versions of Jinja and
Werkzeug than the ones we’re using. We can’t upgrade Flask to 2.x.x
until we upgrade itsdangerous to 2.x.x, which is blocked by
https://github.com/alphagov/notifications-admin/pull/4044/files
2022-05-19 11:13:57 +01:00
Chris Hill-Scott
381bd2cd1c Update humanize from 4.0.0 to 4.1.0 2022-05-10 10:13:12 +01:00
Chris Hill-Scott
6f95e4e0ca Pin Werkzeug to below 2.1.x
We can’t upgrade to Werkzeug 2.1.0 because the `BaseResponse` class
has been renamed. The old version of Flask we are using tries to import
`BaseResponse` causing an error.

    See https://github.com/pallets/werkzeug/issues/1963
2022-05-05 14:13:24 +01:00
Chris Hill-Scott
75a57568b6 Pin Jinja to below 3.1.x
We can’t upgrade to Jinja 3.1.0 because the `escape` module has been
moved to the `markupsafe` library. The old version of Flask we are
using tries to import `escape` from `jinja2`, causing an error.

See https://jinja.palletsprojects.com/en/3.1.x/changes/#version-3-1-0
2022-05-05 14:12:48 +01:00
Chris Hill-Scott
80ad40f587 Update minor and patch versions of some core dependencies 2022-05-05 13:45:42 +01:00
Chris Hill-Scott
a5517f2360 Bump utils to 55.1.6
Brings in:
- [x] https://github.com/alphagov/notifications-utils/pull/966/files
2022-04-26 16:40:22 +01:00
sakisv
76b9e28d4d Use our own fork of gds_metrics_python and add shared auth token
This will allow both prometheis (the shared one and our own) to scrape
the /metrics endpoint, each with their own authentication

See alphagov/gds_metrics_python#1 for more details
2022-04-21 15:32:57 +03:00
Ben Thorner
9be800c263 Bump utils to 55.1.4
This required bumping the minimum version of boto3 with:

    pip-compile -P awscli requirements.in

I haven't looked into the awscli/boto3/botocore changes due to the
high churn on those libraries. Given they're minor changes we can
assume they are benign. s3transfer changes are also benign [^1]

[^1]: https://github.com/boto/s3transfer/blob/develop/CHANGELOG.rst
2022-04-12 14:14:42 +01:00
Katie Smith
31e287d039 Unpin prometheus-client and use the latest version
The prometheus-client was pinned to avoid installing version 0.10.0,
which removed support for `prometheus_multiproc_dir` and renamed the
variable `PROMETHEUS_MULTIPROC_DIR`. Version 0.10.1 reintroduced support
for the lowercase `prometheus_multiproc_dir` environment variable.
2022-04-06 14:57:56 +01:00
Katie Smith
b6b8b74035 Bump pyexcel-ods3 to 0.6.1 2022-04-06 13:42:20 +01:00
Katie Smith
0bec5e8f0a Update pyproj from 3.2.1 to 3.3.0 2022-04-06 12:17:09 +01:00
Katie Smith
f3db221fcb Bump notifications-utils to 55.1.2
This brings in a change to allow pyproj to be updated.
2022-04-06 12:06:36 +01:00
Katie Smith
777f719185 Update pyexcel from 0.6.7 to 0.7.0 2022-04-06 10:30:53 +01:00
Katie Smith
0feb37743a Update pytz from 2021.3 to 2022.1 2022-04-06 09:37:27 +01:00
Katie Smith
7e5e4b18a0 Update flask-login from 0.5.0 to 0.6.0 2022-04-06 09:29:37 +01:00
Katie Smith
57f8a724c1 Update flask-wtf from 1.0.0 to 1.0.1 2022-04-06 09:25:32 +01:00
Katie Smith
8d3eedd88e Remove importlib-metadata from requirements file
This was pinned in
ee3fb2f175
to prevent version conflicts. It only seems to be required by packages
when the version of Python is 3.8 or lower
(e.g. 21d3c70d67/docs/source/release-notes/3.8.0.rst (new-dependency-information)),
so is now not required anyway.
2022-04-06 08:54:57 +01:00
Ben Thorner
99eebddfaf Bump -utils to get latest version of Shapely
This was pinned in [^1] but I'm not sure why - we ought to pin it
in -utils if it needs pinning. Version 1.7.1 doesn't work with Mac
M1 installs of Homebrew - unless you manually hack the library.

As per [^2], we don't think the calculation change matters much.

[^1]: 969e7a6dbd (diff-eee0e41c3756911002e040cf5a8f66b004bb66c8ff1a359bb8ba35d86081e80cR21)
[^2]: 8a10d74fc5
2022-03-15 15:34:11 +00:00
Ben Thorner
a5d18cf1a0 Simplify clearing the template cache
This is more consistent and more visible than a direct call to a
function. It makes use of the new decorator added in response to [^1].

[^1]: https://github.com/alphagov/notifications-admin/pull/4162#pullrequestreview-896208092
2022-03-07 14:42:55 +00:00
Ben Thorner
81d9c73543 Bump -utils to 55.0.0
This renames "delete_cache_keys_by_pattern" to match the new method
name, which will also catch exceptions if Redis is down [1].

Note that this also includes a change to RecipientCSV [2], which has
no effect because the new default is the same as the old behaviour.

[1]: https://github.com/alphagov/notifications-utils/pull/949
[2]: https://github.com/alphagov/notifications-utils/pull/947/files#diff-a8a994bf655634f89dc7439880708b4ff0d780ac1bd8033827d8aaa2692a8e0fR373
2022-03-07 13:53:57 +00:00
Leo Hemsted
c64e19b153 pin gunicorn to support newer version of eventlet
this is consistent with notifications api
https://github.com/alphagov/notifications-api/pull/3466
2022-03-03 11:16:24 +00:00
Katie Smith
ed90daa48f Update pyexcel-io from 0.6.5 to 0.6.6 2022-03-02 14:56:06 +00:00
Katie Smith
a1a377339c Update wtforms from 3.0.0 to 3.0.1 2022-03-02 14:51:37 +00:00
Katie Smith
36b4dee23e Update humanize from 3.12.0 to 4.0.0
Breaking change is due to dropping support for Python 3.6.
2022-03-02 14:45:18 +00:00
Katie Smith
4f78216411 Update govuk-bank-holidays from 0.10 to 0.11 2022-03-02 14:42:02 +00:00
Chris Hill-Scott
61660134ff Bump utils to 53.0.0
Changes:

53.0.0
---

* `notifications_utils.columns.Columns` has moved to
  `notifications_utils.insensitive_dict.InsensitiveDict`
* `notifications_utils.columns.Rows` has moved to
  `notifications_utils.recipients.Rows`
* `notifications_utils.columns.Cell` has moved to
  `notifications_utils.recipients.Cell`

52.0.0
---

* Deprecate the following unused `redis_client` functions:
  - `redis_client.increment_hash_value`
  - `redis_client.decrement_hash_value`
  - `redis_client.get_all_from_hash`
  - `redis_client.set_hash_and_expire`
  - `redis_client.expire`

51.3.1
---

* Bump govuk-bank-holidays to cache holidays for next year.

51.3.0
---

* Log exception and stacktrace when Celery tasks fail.
2022-02-04 10:43:36 +00:00
Leo Hemsted
00f63d02fc remove cryptography pin
we previously pinned cryptography to versions less than 3.4 since after
that point, cryptography started using rust as a dependency. This isn't
an issue if you install from wheel, but we found that the version of pip
bundled with the python buildpack was too old to support this. However,
since upgrading from python 3.6 to python 3.9, the pip version has been
bumped and we now no longer need to pin cryptography as it installs
correctly.
2022-01-19 18:27:41 +00:00
Ben Thorner
3c3bc71cc0 Revert "Trial running Sentry in Admin"
This reverts commit 5ae8acb8aa.
2022-01-05 14:35:49 +00:00
Ben Thorner
5818c9b4a3 Merge pull request #4114 from alphagov/trial-sentry-180766893
Trial running Sentry in a Flask app
2021-12-31 11:31:53 +00:00
Ben Thorner
5ae8acb8aa Trial running Sentry in Admin
This will capture and send various events to Sentry:

- Any unhandled exceptions.
- Any logger.error calls.
- Some request traces.

The latter are severely limited to avoid going over the free tier
limits for Sentry, and to avoid excess effort on our end.
2021-12-31 10:57:05 +00:00
Ben Thorner
69fbce50ed Bump govuk-bank-holidays to latest version
While the package can always fetch new holidays via the GOV.UK API,
the latest version of the packages also caches ones for next year,
which means we can avoid unnecessary web requests.
2021-12-30 09:29:18 +00:00
Ben Thorner
7ebf60845f Bump utils to 51.2.1
This brings a few performance improvements for RecipientCSV, which
we use to preview and process CSVs. One change also renames one of
the attributes for the class to "guestlist".
2021-12-10 16:35:40 +00:00
Tom Byers
aca3af4dbe Bring in notifications-utils 50.0.0
Makes the mock up of an alert we show use an
inline SVG instead of it as a background image.
This means it can use the colour of the heading
text next to it in a way that adapts when high
contrast mode is on.

https://github.com/alphagov/notifications-utils/pull/922
2021-12-09 12:03:02 +00:00
David McDonald
a9617d4df6 Bump utils to 49.1.0 2021-12-07 12:44:18 +00:00
Chris Hill-Scott
6cb326f153 Update utils to do linear transformation of polygons
Brings in https://github.com/alphagov/notifications-utils/pull/889/files

At the moment, we are not doing any transformation of features before
applying geometric algorithms to them. This is, in effect, assuming that
the earth is flat.

This new version of utils implements the transformation of our polygons
to a Cartesian plane. In other words, it converts them from being
defined in spherical degrees to metres.

For the admin app this means we need to convert places where the code
expects things to be measured in degrees to work in metres instead.
2021-12-01 14:10:54 +00:00
Chris Hill-Scott
b74fcf2570 Bump WTForms and Flask-WTF to latest versions
WTForms versions less than 3.0.0 have a security vulnerability where
arbitrary HTML can be inserted into the label of a form, allowing the
possibility of a cross-site scripting attack.

I don’t know if there’s anywhere we put user-generated content into form
labels but it’s possible we are vulnerable somewhere.

This require moving some imports because as of
https://github.com/wtforms/wtforms/pull/614/files
there is no longer a separate module for HTML 5 fields, they are now
considered core fields.

As of https://github.com/wtforms/wtforms/issues/445/files custom
implementations of `pre_validate` or `post_validate` must raise
`ValidationError` to trigger a validation message, where we were raising
`ValueError` this was no longer being caught.

As of https://github.com/wtforms/wtforms/pull/355/files `StringField`
returns `None` for empty data, not `''` but our `validate_email_address`
function only accepts strings.
2021-11-30 17:33:13 +00:00
Chris Hill-Scott
1aa79eb9a6 Don’t put version number in requirements twice
It’s a pain having to remember to update both of them. Looks like `pip`
now supports a different syntax without the `egg` bit which means a git
dependency only needs the version number changing in one place.
2021-11-23 11:27:12 +00:00
Chris Hill-Scott
89de57c521 Check that PyProj can be installed on PaaS
Previously when trying to bring in
https://github.com/alphagov/notifications-utils/pull/889 we had trouble
because there were no wheels available for the version of Pip that we
were using. Now that we have upgraded to Python 3.9 we are using a
newer buildpack which should have the necessary wheels available.

This commit is just installing the package and nothing else, to give us
more confidence that we can merge
https://github.com/alphagov/notifications-utils/pull/915/files without
having to subsequently revert it.
2021-11-17 09:54:04 +00:00
David McDonald
56d6b3e533 Merge pull request #4059 from alphagov/bump-utils-to-fix-non-break-space
Upgrade utils to 48.0.0
2021-11-05 15:13:48 +00:00
Chris Hill-Scott
95be3bd199 Merge pull request #4043 from alphagov/jinja2-version3
Require the newest version of Jinja2
2021-11-04 16:45:51 +00:00
David McDonald
c6b884dcef Upgrade utils to 48.0.0
Fixes a bug with non breaking spaces being removed from templates
2021-11-01 10:22:58 +00:00
Chris Hill-Scott
873cfaf7a0 Bump utils to 47.0.1
Changes:
https://github.com/alphagov/notifications-utils/compare/46.1.0...47.0.1

The breaking change is due to the removal of ZendeskClient.create_ticket
which this app is no longer using.

> Although this is a breaking change to the ZendeskClient, nothing is
> using the code that was deleted.

— https://github.com/alphagov/notifications-utils/pull/902#discussion_r720095133
2021-10-28 09:33:03 +01:00
pyup-bot
908bea2163 Update pytz from 2021.1 to 2021.3 2021-10-20 14:50:12 +01:00