Commit Graph

90 Commits

Author SHA1 Message Date
Ville Skyttä
b52c5c82b1 Use http.HTTPStatus in components/[gh]* (#58246) 2021-10-23 20:34:53 +02:00
Paulus Schoutsen
a4d9019ffc Refactor persistent notification to no longer route all data via a service (#57157)
* Convert persistent notification tests to async

* Create/dismiss persistent notifications in exposed functions, not service calls

* Fix notify persistent_notification

* Remove setting up persistent_notification

* Drop more setups

* Empty methods

* Undeprecate sync methods because too big task

* Fix setup clearing notifications

* Fix a bunch of tests

* Fix more tests

* Uno mas

* Test persistent notification events

* Clean up stale comment

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-10-07 12:58:00 +02:00
Erik Montnemery
f6682ba99d Block tests from opening sockets (#55516) 2021-10-05 14:46:09 -10:00
Ville Skyttä
1aa7c87151 Remove redundant aiohttp response status=200 kwargs (#56417)
* Remove redundant aiohttp response status=200 kwargs

* Remove some more in h.c.auth

* Restore explicit status=HTTP_OK for auth and webhook per review request
2021-09-21 10:51:12 -07:00
Erik Montnemery
acdddabe1f Use hass_client_no_auth test fixture in integrations h-p (#55583) 2021-09-02 14:49:40 +02:00
Paulus Schoutsen
38a7bdbcf3 Do not process forwarded for headers for cloud requests (#54364) 2021-08-10 01:45:56 +02:00
Marc Mueller
10bfc78365 Fix missing encoding with open() (#53593)
* Fix missing encoding with open()

* Fix tests

* Improve open - frontend
2021-07-28 09:41:45 +02:00
Joakim Plate
d339e3bd8c Reject trusted network access from proxies (#52388) 2021-07-02 11:49:42 +02:00
Joakim Plate
eedf1c3ebe Reject requests from the proxy itself (#52073)
* Reject requests from the proxy itself

* Adjust tests
2021-06-27 19:02:51 +02:00
Franck Nijhof
33e08f38da Raise bad request when receiving HTTP request from untrusted proxy (#51839)
* Raise bad request when receiving HTTP request from untrusted proxy

* Fix code comment
2021-06-17 04:41:19 +02:00
Franck Nijhof
cdd1f6b2f0 Always load middle to handle forwarded proxy data (#51332) 2021-06-01 09:38:55 -07:00
J. Nick Koston
a4432557d3 Defer writing http config until after startup has calmed down (#50000) 2021-05-02 19:48:49 -10:00
Bram Kragten
e3105c7eb1 Revert CORS changes for my home assistant (#47064)
* Revert CORS changes for my home assistant

* Update test_init.py

* Update test_init.py
2021-02-25 15:28:22 -08:00
Franck Nijhof
22389043eb Remove base_url fallback (#46316) 2021-02-10 14:31:11 +01:00
Bram Kragten
6f446cf627 Add my component (#46058)
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-02-08 14:44:46 +01:00
gregod
cf9ea6f82d Sanitize user-agent in wrong_login message (#45251) 2021-01-18 09:21:30 +01:00
Pascal Vizeli
e1427c45f2 Bump aioHTTP 3.7.3 - YARL 1.6.3 (#45180) 2021-01-15 13:19:22 +01:00
Franck Nijhof
dee0f887de Extend filter and filter tests (#45179) 2021-01-15 10:30:29 +01:00
Franck Nijhof
f047d04882 Add filtering 2021-01-14 20:02:01 +01:00
Franck Nijhof
65cf2fcb6f Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Franck Nijhof
1c2ebdf307 Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
Franck Nijhof
475e70986b Extend IP ban / failed login notification information (#39020) 2020-08-18 23:32:19 +02:00
Franck Nijhof
cc4ebc925c Improve X-Forwarded-* request headers handling (#38696)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
2020-08-11 22:57:50 +02:00
Franck Nijhof
20710d8605 Add current request context to get_url helper (#38602) 2020-08-09 14:07:31 +02:00
J. Nick Koston
578d4a9b6a Make the frontend available sooner (Part 1 of 2) (#36263)
* Part 1 of 2 (no breaking changes in part 1).

When integrations configured via the UI block startup or fail to start,
the webserver can remain offline which make it is impossible
to recover without manually changing files in
.storage since the UI is not available.

This change is the foundation that part 2 will build on
and enable a listener to start the webserver when the frontend
is finished loading.

Frontend Changes (home-assistant/frontend#6068)

* Address review comments

* bump timeout to 1800s, adjust comment

* bump timeout to 4h

* remove timeout failsafe

* and the test
2020-06-02 13:54:11 -05:00
Paulus Schoutsen
acbffb511d Fix base_url extract stack (#36331)
* Fix base_url extract stack

* Fix tests
2020-06-01 11:44:45 -07:00
Pascal Vizeli
ed014e3c96 Revert "Ensure frontend is available if integrations fail to start - Part 1 of 2 (#36093)" (#36251)
This reverts commit fbe7b4ddfa.
2020-05-29 10:18:39 +02:00
J. Nick Koston
fbe7b4ddfa Ensure frontend is available if integrations fail to start - Part 1 of 2 (#36093)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-05-28 21:09:07 -07:00
Franck Nijhof
e3e3a113e9 async_get_url -> get_url (#35382) 2020-05-08 21:53:28 +02:00
Franck Nijhof
e56dd8ed50 Detect use of deprecated base_url (#35353)
* Detect use of deprecated base_url

* Update get_url helper

* Update core migration

* Migrate all tests
2020-05-08 17:52:32 +02:00
Franck Nijhof
2223592486 Add get_url helper, deprecate base_url (#35224) 2020-05-08 02:29:47 +02:00
Paulus Schoutsen
2af984917e Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -07:00
Paulus Schoutsen
76f392476b Use a future for mock coro (#34989) 2020-04-30 16:31:00 -07:00
Paulus Schoutsen
ec47216388 Use built-in test helpers on 3.8 (#34901) 2020-04-30 13:29:50 -07:00
springstan
bc26be3c11 Add and use HTTP_FORBIDDEN constant (#33839) 2020-04-09 17:41:17 +02:00
Martin Hjelmare
c3decc6531 Do not ban supervisor ip if set (#33781)
* Use asynctest patch instead of mock_coro

* Add test for supervisor ip ban

* Do not ban supervisor ip if set

* Extract supervisor ip helper

* Check supervisor ip before banning

* Remove added blank line

* Clean up get supervisor ip

Co-Authored-By: Pascal Vizeli <pvizeli@syshack.ch>

Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
2020-04-08 10:31:44 -07:00
Franck Nijhof
d7e9959442 String formatting improvements for tests (2) (#33666) 2020-04-05 00:33:07 +02:00
Paulus Schoutsen
33361f8580 Fix HTTP config serialization (#31319) 2020-01-30 09:47:16 -08:00
Paulus Schoutsen
5fdc60e067 Add Safe Mode (#30723)
* Store last working HTTP settings

* Add safe mode

* Fix tests

* Add cloud to safe mode

* Update logging text

* Fix camera tests leaving files behind

* Make emulated_hue tests not leave files behind

* Make logbook tests not leave files behind

* Make tts tests not leave files behind

* Make image_processing tests not leave files behind

* Make manual_mqtt tests not leave files behind
2020-01-14 13:03:02 -08:00
Bas Nijholt
3d10bb3647 Sort imports according to PEP8 for http (#29679) 2019-12-09 11:59:38 +01:00
Paulus Schoutsen
3231e22ddf Remove direct authentication via trusted networks or API password (#27656)
* Remove direct authentication via trusted networks and API password

* Fix tests
2019-10-14 14:56:45 -07:00
Paulus Schoutsen
57f84cbbaa Update HTTP defaults (#25702)
* Update HTTP defaults

* Fix tests
2019-08-05 08:24:54 +02:00
Paulus Schoutsen
4de97abc3a Black 2019-07-31 12:25:30 -07:00
Paulus Schoutsen
0df1bb5029 Fix python 3.5 test 2019-07-26 16:15:46 -07:00
Paulus Schoutsen
fae3546910 Allow cors for static files (#25468) 2019-07-25 13:52:27 +02:00
Paulus Schoutsen
6f903db8c4 Fix cors on the index view (#24283) 2019-06-03 11:43:13 -07:00
Jason Hu
fe1840f901 Deprecate http.api_password (#21884)
* Deprecated http.api_password

* Deprecated ApiConfig.api_password

GitHub Drafted PR would trigger CI after changed it to normal PR.
I have to commit a comment change to trigger it

* Trigger CI

* Adjust if- elif chain in auth middleware
2019-03-10 19:55:36 -07:00
Paul Bottein
4d9cf15c45 Fix authorization header in cors (#21662)
* Fix authorization headers in cors

* Use aiohttp authorization header instead of custom const
2019-03-09 10:00:10 -08:00
Louis Matthijssen
d39784906b Fix HTTP login attempts check triggering too late (#20431) 2019-01-26 03:13:44 +01:00
Andrew Sayre
bb21cb6c89 Remove trailing slash from base_url and added ability to generate webhook path. (#20295) 2019-01-21 20:50:41 +01:00