Commit graph

1936 commits

Author SHA1 Message Date
Leandro Britez
37ff7b1b05 Add support for multiple RCPT TO in incoming email 2022-07-29 12:56:30 +03:00
Pēteris Caune
a4b6fc61ad
Replace HipChat, Pagerteam classes with transports.RemovedTransport 2022-07-29 11:35:03 +03:00
Pēteris Caune
580304110e
Make tests not sensitive to the SITE_NAME setting 2022-07-27 15:26:32 +03:00
Pēteris Caune
65cef0b271
Fix grouping and sorting in the text version of the report/nag emails
Fixes: #679
2022-07-27 15:22:41 +03:00
Pēteris Caune
b2b361e2b9
Improve Notification admin: link to project from the list view 2022-07-26 11:04:03 +03:00
Pēteris Caune
5a94e6809e
Update links to Django docs (3.1 -> 4.0) 2022-07-26 10:40:50 +03:00
Pēteris Caune
438c94efb7
Fix a race condition in the "Change Email" flow
The race scenario was as follows:

* Alice initiates email address change to bob@example.org
* a verification link is sent to bob@example.org
* separately, somebody creates a new account for bob@example.org
* Alice clicks on the verification link

At this point,
- if the database has an uniqueness constraint on auth_user.email,
  Alice will receive a HTTP 500 error
- if there's no uniqueness constraint, the email change
  will succeed and the system will have two accounts with the
  same email address

The simple fix is to re-check the address availability just
before finalizing the email address change. Currently this is
not done in a transaction block, so the race condition still
exists in theory, but is much less likely to happen in practice.
2022-07-21 15:14:51 +03:00
Pēteris Caune
01720ca9ae
Update notification templates to handle "log" events 2022-07-21 14:22:41 +03:00
Pēteris Caune
dc107ff7f5
Add ping endpoints for "log" events 2022-07-21 10:30:52 +03:00
Pēteris Caune
efa5acc1b4
Add support for the $JSON placeholder in webhook payloads 2022-07-20 12:06:39 +03:00
Pēteris Caune
cd087d2fbf
Add API support for enabling/disabling filtering in message body
Specifically, add read/write support for the new fields:

* success_kw
* failure_kw
* filter_subject
* filter_body

The API still supports reading/writing the "subject" and
"subject_fail" fields, but these are now marked as deprecated
in API documentation.

Fixes: #653
2022-07-15 13:04:41 +03:00
Pēteris Caune
4766aade95
Fix migrations
When adding "NOT NULL" on multiple columns at once, Django
throws errors:

    django.db.utils.OperationalError:
    cannot ALTER TABLE "api_check" because it has
    pending trigger events

A workaround is to modify columns one by one in
separate migrations.
2022-07-13 12:24:47 +03:00
Pēteris Caune
ae4ee37053
Add "NOT NULL" constraints on the new api_check fields
cc: #653
2022-07-13 12:02:58 +03:00
Pēteris Caune
cc32af6127
Remove api_check.subject and api_check.subject_fail fields
cc: #653
2022-07-13 11:40:35 +03:00
Pēteris Caune
426d6d07b3
Update API to use success_kw and failure_kw fields
cc: #653
2022-07-13 11:05:13 +03:00
Pēteris Caune
003d35d431
Add "Filter by keywords in the message body" feature
cc: #653
2022-07-12 15:46:15 +03:00
Pēteris Caune
3effd77e70
Add retry limit in hc.lib.s3.put_object 2022-07-01 23:47:47 +03:00
Pēteris Caune
227a8407bb
Update the Signal integration to handle RATE_LIMIT_FAILURE errors 2022-07-01 15:12:13 +03:00
Pēteris Caune
0553f0a38a
Fix the display of ignored pings with non-zero exit status 2022-06-30 16:49:09 +03:00
Pēteris Caune
ec0be60ca8
Include last ping type in MS Teams notifications 2022-06-30 13:15:40 +03:00
Pēteris Caune
56a0d9f78b
Include last ping type in Slack, Mattermost, Discord notifications 2022-06-30 12:56:09 +03:00
Pēteris Caune
b3f2bc64a5
Improve "Show Usage Examples" dialog, "Email" tab 2022-06-30 10:22:46 +03:00
Pēteris Caune
0c6223ffa5
Implement the "Add Check" dialog 2022-06-29 10:35:12 +03:00
Pēteris Caune
1b6269b29f
Improve Credential admin 2022-06-22 10:21:14 +03:00
Pēteris Caune
fa3b2dc6e3
Add code comments and type hints, remove now-unused cbor.js 2022-06-19 12:51:01 +03:00
Pēteris Caune
2b623453c1
Update tests 2022-06-19 12:31:27 +03:00
Pēteris Caune
a4c4df976c
Split the helper class in GetHelper and CreateHelper 2022-06-19 11:30:37 +03:00
Pēteris Caune
57021e962c
Refactor webauthn implementation, use webauthn-json 2022-06-19 10:10:57 +03:00
Pēteris Caune
64a6245736
Improve tests 2022-06-17 15:44:47 +03:00
Pēteris Caune
93c13b8221
Include check.desc in email text template, update tests 2022-06-17 14:55:34 +03:00
Pēteris Caune
9e578f6dfc
Add "Disabled" priority for Pushover notifications
Fixes: #663
2022-06-10 18:19:12 +03:00
Pēteris Caune
51f7fe7332
Expose subject and subject_fail in API GET calls, improve docs 2022-06-03 09:59:20 +03:00
Pēteris Caune
6a68fd2c23
Add subject and subject_fail type and length validation 2022-06-03 09:18:22 +03:00
Tyler
d61909ffd2 Expose subject and subject_fail via API 2022-06-03 09:12:46 +03:00
Pēteris Caune
b19ddab1bd
Add Gotify integration
Fixes: #270
2022-06-01 16:13:41 +03:00
Pēteris Caune
03dea07ae2
Remove obsolete field: Check.last_ping_was_fail 2022-05-31 15:13:00 +03:00
Pēteris Caune
8216377da6
Improve tests 2022-05-30 17:33:10 +03:00
Pēteris Caune
f7b4a6d71c
Remove support for unsigned login tokens 2022-05-30 16:59:13 +03:00
Pēteris Caune
c1ff8875e3
Implement login link expiration
Login links will now expire in 1 hour.
2022-05-30 15:48:51 +03:00
Pēteris Caune
66b7f4dd32
Fix upload test to specify its own PING_BODY_LIMIT 2022-05-30 14:42:23 +03:00
Pēteris Caune
a5e5b45983
Reduce logging, add Ctrl+C handler in sendalerts and sendreports
cc: #656
2022-05-27 14:49:44 +03:00
Pēteris Caune
901f944055
Test pyflakes warnings 2022-05-26 21:39:53 +03:00
Pēteris Caune
09a99d3e9c
Add tests 2022-05-20 18:14:43 +03:00
Pēteris Caune
6790d867a6
Add address verification step in the "Change Email" flow
A similar issue has come up multiple times: the user
changes account's email address, enters a bad address
by mistake, and gets locked out of their account.

This commit adds an extra step in the "Change Email" flow:

* In "Account Settings", user clicks on [Change Email]
* User gets a prompt for a 6-digit confirmation code, which
  has been sent to their old address. This is to prevent
  account takeover when Eve sits down at a computer where Alice
  is logged in.
* The user enters the confirmation code, and a "Change Email"
  form loads.
* The user enters their new email address.
* (The new step!) Instead of changing the email right away,
  we send a special login link to user's specified new address.
* (The new step, continued) The user clicks on the login link,
  their account's email address gets updated, and they get
  logged in.

The additional step makes sure the user can receive email
at their new address. If they cannot receive email there,
they cannot complete the "Change Email" procedure.
2022-05-20 17:54:45 +03:00
Pēteris Caune
8da87cdea5
Update code to not use related managers of unsaved objects
When testing with django==4.1a1, some tests were failing with
a message:

> ValueError: 'Check' instance needs to have a primary key
> value before this relationship can be used.

This commit fixes these failures, but there might be more
places to fix, that are not covered by tests yet.
2022-05-18 13:07:50 +03:00
Pēteris Caune
59e112852b
Switch from auto_now_add=True to default=now
I've run in the following problem a few times in tests:

* I create a model instance
* set its "created" field to a specific value
* I save the model instance
* I write testcase logic which relies on that specific "created" value

The testcase fails, because, with auto_now_add=True, Django
overwrites the created field. I can work around this by:

* Create and save a model instance
* Save it
* Set the created field to my desired value
* Save it again

But this is annoying to do, and annoying to troubleshoot
– it's easy to forget about the auto_now_add behaviour.

So I'm replacing auto_now_add=True with
default=django.utils.timezone.now.
2022-05-18 11:42:56 +03:00
Pēteris Caune
7247983fdd
Add logic to handle ContentDecodingError exceptions 2022-05-17 16:16:24 +03:00
Pēteris Caune
fb0e3bc10d
Update hc.front.views.channels to handle empty strings in settings
Fixes: #635
2022-05-16 15:10:26 +03:00
Pēteris Caune
e7076155e7
Add "Ping-Body-Limit" response header in ping API responses
The header format is:

    Ping-Body-Limit: n

Where "n" is an integer number, the value of the  PING_BODY_LIMIT
configuration setting.

Clients can use this header to decide how much POST data to send
in HTTP requests. If a client sends more than "n" bytes in the
request body, Healthchecks will store the first "n" bytes, and
ignore the rest.

The default value for PING_BODY_LIMIT is 10000 (10KB).
2022-05-10 15:44:27 +03:00
Pēteris Caune
eac023caa1
Enable searching channels by code in admin UI 2022-05-10 15:36:49 +03:00