Commit graph

607 commits

Author SHA1 Message Date
Pēteris Caune
e1f51093f1
Implement automatic api_ping and api_notification pruning
cc: #556
2021-10-21 14:35:02 +03:00
Pēteris Caune
ba3f222f37
Fix a crash in hc.api.views.pause with an int in request body
The jsonify decorator parses request payload as JSON
and puts it in request.json. The payload would normally
be a complex object, but if a client sends, let's say,
a single integer, then request.json is a python int.

The authorize decorator looks for API key first in request
headers, then in request body. It expects the request
body to be a complex object.

This commit changes adds the following validation rule in
the jsonify decorator: if request body is not empty, it
*must* parse as JSON, and the root element of the parsed
document *must* be a dict.
2021-10-20 23:06:21 +03:00
Pēteris Caune
829a39f4cf
Fix hc.api.views.ping to handle non-utf8 data in request body
Fixes: #574
2021-10-19 19:19:46 +03:00
Pēteris Caune
6158f9c539
Change outgoing webhook timeout to 10s, and change the retry logic
Previous retry logic was:
- max 3 tries
- every try times out after 5 seconds

The new retry logic is:
- max 3 tries
- every try times out after 10 seconds
- if the first two tries have used > 10 seconds, don't
  do the third try

cc: #569
2021-10-14 16:22:14 +03:00
Pēteris Caune
141d71d9fe
Switch from croniter to cronsim (vendored in hc.lib.cronsim) 2021-10-14 12:42:31 +03:00
Pēteris Caune
0056cbf058
Fix release dates in CHANGELOG 2021-10-13 12:27:23 +03:00
Pēteris Caune
30a3482d0e
Fix missing uwsgi dependencies in arm/v7 Docker image 2021-10-13 10:43:04 +03:00
Pēteris Caune
3e0ff1cf81
Update CHANGELOG for v1.23.0 release 2021-10-13 09:35:00 +03:00
Pēteris Caune
5656515830
Add 'schemaVersion' field in the shields.io endpoint
Fixes: #566
2021-10-02 13:38:45 +03:00
Pēteris Caune
5fe4a60b30
Upgrade to jQuery 3.6.0 2021-10-01 13:12:20 +03:00
Pēteris Caune
148894bd9e
Upgrade to Bootstrap 3.4.1 2021-10-01 12:21:54 +03:00
Pēteris Caune
27da637e86
Fix Dockerfile to correctly build cryptography==35.0.0 on 32-bit arm
Fixes: #565

Also, split Dockerfile into two stages, so rust
and other build dependencies don't end up in the final image.

Note cryptography has binary wheels for various architectures,
but unfortunately not for 32-bit arm. And, starting from v35.0.0,
cryptography requires rust to build from source.
2021-10-01 09:53:48 +03:00
Pēteris Caune
6e3a1c790d
Fix the ping handler to reject status codes > 255 2021-09-15 11:36:15 +03:00
Pēteris Caune
f8131741ef
Fix minor API inconsistencies
1. Drop API support for GET, DELETE requests with a request body.
Healthchecks had an undocumented quirk where you could authenticate a
GET or DELETE request by putting a '{"api_key":"..."}' in request body.
This commit removes this feature.

Note: POST requests can still authenticate either by sending
a X-Api-Key header, or by putting a "api_key" key in request body.
GET and DELETE requests can now only authenticate with the
request header.

2. Add missing @csrf_exempt annotations in API views
When client sends a HTTP POST request to a GET-only endpoint,
the server is supposed to respond with "405 Method Not Allowed".
Due to CSRF checking, a couple endpoints were responding with
"403 Forbidden" instead. Adding @csrf_exempt annotations fixes
the problem.
2021-09-10 22:49:12 +03:00
Pēteris Caune
3dfdbc09ca
Add ability to create/revoke individual keys 2021-09-09 14:55:17 +03:00
Pēteris Caune
8541ec59ca
Add ability to edit existing WhatsApp integrations 2021-08-26 10:17:01 +03:00
Pēteris Caune
5af09ed4dd
Add ability to edit existing Signal integrations 2021-08-26 10:01:09 +03:00
Pēteris Caune
3807c200ce
Add ability to edit existing SMS integrations 2021-08-26 09:42:35 +03:00
Pēteris Caune
2a9a544ddf
Add ability to edit existing email integrations 2021-08-25 18:04:54 +03:00
Pēteris Caune
98eb7cc14a
Add /api/v1/badges/ endpoint
cc: #552
2021-08-18 17:47:57 +03:00
Pēteris Caune
1247cc4ea7
Fix a crash during login when user's profile does not exist
Fixes: #77
2021-08-18 10:32:10 +03:00
Pēteris Caune
b43612806f
Fix dark mode bug in selectpicker widgets 2021-08-10 16:47:47 +03:00
Pēteris Caune
544ec7ea69
Add handling for non-latin-1 characters in webhook headers 2021-08-10 10:36:58 +03:00
Pēteris Caune
2a9bc42dd4
Update Changelog for v1.22.0 release 2021-08-06 14:27:15 +03:00
Pēteris Caune
7252f2f101
Fix _allow_redirect function to reject absolute URLs
This fixes a security issue:
- attacker can crafts a redirect URL to an external site
- attacker gets victim to click on it
- victim logs in
- after login, Healthchecks redirects victim to the external site

The _allow_redirect function now additionally
requires the redirect URL is relative (has no scheme or domain).
2021-08-06 13:34:40 +03:00
Pēteris Caune
e6427995b7
Add Whitenoise and improve README
Fixes: #548
2021-08-05 18:06:47 +03:00
Pēteris Caune
222722569e
Add support for 2FA using TOTP
Fixes: #354
2021-07-30 16:43:23 +03:00
Pēteris Caune
4f83f8c06b
Fix a 403 when transferring a project to a read-only team member 2021-07-26 12:50:43 +03:00
Pēteris Caune
e46000ecdf
Add admin action to log in as any user 2021-07-20 11:16:12 +03:00
Pēteris Caune
2382bf6722
Add SITE_LOGO_URL setting
Fixes: #323
2021-07-16 15:30:34 +03:00
Pēteris Caune
dd88924660
Fix dark mode styling issues in Cron Syntax Cheatsheet 2021-07-16 12:25:16 +03:00
Pēteris Caune
99bb71c920
Use multicolor channel icons for better appearance in the dark mode 2021-07-07 15:23:02 +03:00
Pēteris Caune
5a4c06ffae
Update CHANGELOG for v1.21.0 release 2021-07-02 16:52:24 +03:00
Pēteris Caune
d243f502d3
Fix off-by-one-month error in monthly reports, downtime columns
Fixes: #539
2021-07-02 15:22:51 +03:00
Pēteris Caune
2d20f439dd
Remove PagerDuty Connect
PagerDuty Connect is deprecated and will be discontinued.
It is replaced by PagerDuty Simple Install Flow (see
README for setup instructions).
2021-06-21 10:44:21 +03:00
Pēteris Caune
c5229d6505
Add CSS for dark mode 2021-06-16 15:23:34 +03:00
Pēteris Caune
fd7ab5e767
Implement PagerDuty Simple Install Flow 2021-06-16 14:18:32 +03:00
Pēteris Caune
df44ee58c0
Add an option for weekly reports (in addition to monthly) 2021-05-24 13:44:34 +03:00
Pēteris Caune
855d188981
Add support for "... is UP" SMS notifications
Fixes: #512
2021-05-21 12:57:23 +03:00
Pēteris Caune
e090aa5403
Improve the handling of unknown email addresses in the Sign In form 2021-05-12 13:49:56 +03:00
Pēteris Caune
ae4487b6c3
Update to Django 3.2.2 2021-05-06 11:07:51 +03:00
Pēteris Caune
64f2e86051
Increase "Success / Failure Keywords" field lengths to 200 2021-05-06 11:00:36 +03:00
Pēteris Caune
e2b96d9bd8
Update CHANGELOG for v1.20.0 release 2021-04-22 13:03:07 +03:00
Pēteris Caune
738a648407
Improve project sorting in the "My Projects" page
Primary sort key: projects with overall_status=down go first
Secondary sort key: project's name
2021-04-14 16:18:43 +03:00
Pēteris Caune
78652b5659
Upgrade Django version to 3.2 2021-04-07 11:39:11 +03:00
Pēteris Caune
67d11e8d40
Fix the month boundary calculation in monthly reports
Fixes: #497
2021-04-02 13:49:55 +03:00
Pēteris Caune
68b1d5bb8b
Fix the "Email Reports" screen to clear Profile.next_nag_date 2021-03-15 13:06:57 +02:00
Pēteris Caune
05db43f95d
Fix the pause action to clear Profile.next_nag_date if all checks up 2021-03-15 12:52:35 +02:00
Pēteris Caune
7ba5fcbb71
Fix sendalerts to clear Profile.next_nag_date if all checks up
Profile.next_nag_date tracks when the next hourly/daily reminder
should be sent. Normally, sendalerts sets this field when
a check goes down, and sendreports clears it out whenever
it is about to send a reminder but realizes all checks are up.

The problem: sendalerts can set next_nag_date to a non-null
value, but it does not clear it out when all checks are up.
This can result in a hourly/daily reminder being sent out
at the wrong time. Specific example, assuming hourly reminders:

13:00: Check A goes down. next_nag_date gets set to 14:00.
13:05: Check A goes up. next_nag_date remains set to 14:00.
13:55: Check B goes down. next_nag_date remains set to 14:00.
14:00: Healthchecks sends a hourly reminder, just 5 minutes
       after Check B going down. It should have sent the reminder
       at 13:55 + 1 hour = 14:55

The fix: sendalerts can now both set and clear the next_nag_date
field. The main changes are in Project.update_next_nag_dates()
and in Profile.update_next_nag_date(). With the fix:

13:00: Check A goes down. next_nag_date gets set to 14:00.
13:05: Check A goes up. next_nag_date gets set to null.
13:55: Check B goes down. next_nag_date gets set to 14:55.
14:55: Healthchecks sends a hourly reminder.
2021-03-15 12:34:39 +02:00
Pēteris Caune
2bfea987e9
Replace details_url with cloaked_url in email and chat notifications 2021-03-04 16:55:05 +02:00