docbrown/app
Joe Doss 6406b0727b
Allow localhost or 127.0.0.1 to access api/health_checks without health-check-token (#8231)
* This change allows access to api/health_checks if you are coming from localhost
or 127.0.0.1. Pretty sweet huh?

The reason for this change is because I want to easily get to these healthcheck
end points from localhost without having to get the health-check-token beforehand.

Buttttt.... this addition has some issues. You can spoof the host header pretty
easily:

https://daniel.haxx.se/blog/2018/04/05/curl-another-host/

I thought about doing `return if !request.ssl? && request.local?`

to check of the request was over https or not. Any localhost healthcheck we do
directly to puma will be over http. Checking for TLS seemed like a logical next
check, but since we force https on the edge and not necessarily from the edge to
Puma the Host header can still be spoofed to get at these end points.

More info on host header attacks and what Rails 6 is doing about it:

https://github.com/rails/rails/issues/29893

While I do think it is a good idea to protect these healthcheck end points from
the outside world, I do want to be able to get to them easily locally. WWYD?

* Fix Health Check spec by stubbing request

Co-authored-by: mstruve <mollylbs@gmail.com>
2020-06-02 11:29:04 -04:00
..
assets [deploy] Add Reddit Liquid Tag (#8111) 2020-06-01 18:52:07 -04:00
black_box [deploy] Remove Google Analytics page counts (#6969) 2020-04-14 10:44:05 -04:00
controllers Allow localhost or 127.0.0.1 to access api/health_checks without health-check-token (#8231) 2020-06-02 11:29:04 -04:00
dashboards [deploy] Rename classified listings (#7910) 2020-05-27 13:35:09 +00:00
decorators [deploy] Rename classified listings (#7910) 2020-05-27 13:35:09 +00:00
errors [deploy] Create FastlyConfig & refactor params safe list (#7630) 2020-05-01 11:23:48 -04:00
fields
helpers [deploy] Change default fetch format in cloudinary links (#8226) 2020-06-01 17:53:04 -04:00
javascript [deploy] Optimization: Remove Comment Count From Aysnc user_data (#8174) 2020-06-01 10:38:57 -05:00
labor [deploy] Remove All Notification Count Helper Classes (#8221) 2020-06-02 09:48:02 -05:00
lib Add merveilles.town to list of Mastodon instances (#7983) 2020-05-20 17:48:46 -04:00
liquid_tags [deploy] Add Reddit Liquid Tag (#8111) 2020-06-01 18:52:07 -04:00
mailers [deploy] Remove All Notification Count Helper Classes (#8221) 2020-06-02 09:48:02 -05:00
models Add unique index to comments - part 6 (#8214) 2020-06-02 11:30:43 +02:00
policies [deploy] Rename classified listings (#7910) 2020-05-27 13:35:09 +00:00
queries/internal Refactor internal users index (#7457) 2020-04-24 17:27:07 -04:00
sanitizers
serializers [deploy] Rename classified listings (#7910) 2020-05-27 13:35:09 +00:00
services [deploy] Remove All Notification Count Helper Classes (#8221) 2020-06-02 09:48:02 -05:00
uploaders Limit ALL Upload file sizes to 25 MB (#5356) [deploy] 2020-01-07 11:20:40 -05:00
view_objects [deploy] Fix height/width mismatch (#7485) 2020-04-23 13:38:10 -04:00
views Swap sponsorships link (#8228) 2020-06-02 09:01:54 +02:00
workers [deploy] Ignore Unfound Elasticsearch Docs and Records (#8225) 2020-06-02 08:32:16 -05:00