Commit graph

76 commits

Author SHA1 Message Date
Josh Wright
3fcc07af04 Add a default OPTIONS handler for wsgi (#2301)
When a browser makes a CORS request, it often makes a 'preflight'
options request in order to make sure the resource is valid, and that
it has the right CORS access. This adds a default OPTIONS handler for
all views. If a view needs to customize the OPTIONS handler for some
reason, it's free to, but this way CORS will work.
2016-06-14 19:44:12 -07:00
Robbie Trencheny
59a0005e5c Add CORS to WSGI (#2209)
* Add CORS support to WSGI

* Remove X-HA-Access as a CORS header, because as @JshWright so elegantly put it: "CORS controls access to response headers, not request headers"
2016-06-03 12:53:43 -07:00
Josh Wright
fe4d971427 Re-add config validation for the http component (#2186)
This commit adds back the config validation for the http component. It
was removed during the WSGI shuffle. This is just a direct copy of what
@robbiet480 added in ab294d12f7 (with some testing to verify it still
works).
2016-05-31 14:00:12 -07:00
Paulus Schoutsen
bfdb51a558 Bugfixes for urls with dates 2016-05-28 10:37:22 -07:00
Paulus Schoutsen
e10b00f341 Update frontend 2016-05-27 21:45:38 -07:00
Paulus Schoutsen
415cfc2537 WSGI: Hide password in logs (#2164)
* WSGI: Hide password in logs

* Add auth + pw in logs tests
2016-05-24 23:19:37 -07:00
Josh Wright
712c51e283 Fix TLS with eventlet (#2151)
* Fix TLS with eventlet

This fixes a simple error on my part when implementing the WSGI stuff.

eventlet.wrap_ssl() returns a wrapped socket, it does not modify the
object passed to it. We need to grab the returned value and use that.

* Fix style issue
2016-05-23 17:39:55 -07:00
Paulus Schoutsen
98de7c9287 Upgrade eventlet to 0.19 2016-05-22 20:14:46 -07:00
Paulus Schoutsen
2ed135439a Remove gzip API 2016-05-21 15:01:35 -07:00
Paulus Schoutsen
1750b22e59 Gzip all the things 2016-05-21 15:01:35 -07:00
Paulus Schoutsen
9aa9e57890 Cleanup 2016-05-21 15:01:35 -07:00
Paulus Schoutsen
794ff20987 Get EventStream working 2016-05-21 15:01:34 -07:00
Paulus Schoutsen
fe794d7fd8 Access camera images using access token 2016-05-21 15:01:34 -07:00
Paulus Schoutsen
585fbb1c02 Cache files in static folder for a year 2016-05-21 15:01:34 -07:00
Paulus Schoutsen
5aa0158761 Add url validators 2016-05-21 15:01:34 -07:00
Paulus Schoutsen
4d7555957c Fix camera 2016-05-21 15:01:34 -07:00
Josh Wright
aa34fe15b2 Friendlier exceptions for misconfigured views
If a view is missing a url or name attribute, this will result
in a more actionable exception being raised.
2016-05-21 15:01:34 -07:00
Paulus Schoutsen
1096232e17 More WIP 2016-05-21 15:01:34 -07:00
Josh Wright
54ecab7590 Improve view registration comments
Clarify that HomeAssistantWSGI.register_view() can handle either instantiated or uninstantiated view classes.
2016-05-21 15:01:33 -07:00
Paulus Schoutsen
15e329a588 Tons of fixes - WIP 2016-05-21 15:01:33 -07:00
Robbie Trencheny
952d1c796e Add CORS (Cross Origin Resource Sharing) support to HTTP (#2000) 2016-05-07 12:21:28 -07:00
Paulus Schoutsen
7d4b11f4ec Fix wrong merge 2016-04-19 22:59:29 -07:00
Paulus Schoutsen
4abbbf0f50 Merge remote-tracking branch 'origin/master' into dev
Conflicts:
	homeassistant/bootstrap.py
	homeassistant/components/frontend/version.py
	homeassistant/const.py
2016-04-19 22:53:26 -07:00
Jan Harkes
2c665ca3e4 Do not propagate api password (#1797)
* Do not propagate API password in service requests.

It makes service validation fail. The choice is to either handle it as an
optional key in every service handler and make sure it doesn't end up in event
stream and notifications, or to strip it as early as possible.

* Some places still need a forwarded api password.

- Event forwarding/remote api uses the local api password to
  authenticate against the remote instance.
- The generated index.html at '/' embeds the api password.
2016-04-11 19:48:16 -07:00
Jan Harkes
4857117dda Do not propagate api password (#1797)
* Do not propagate API password in service requests.

It makes service validation fail. The choice is to either handle it as an
optional key in every service handler and make sure it doesn't end up in event
stream and notifications, or to strip it as early as possible.

* Some places still need a forwarded api password.

- Event forwarding/remote api uses the local api password to
  authenticate against the remote instance.
- The generated index.html at '/' embeds the api password.
2016-04-11 19:37:15 -07:00
Josh Wright
80d6e9f08f Use constant time comparison for http authentication (#1804)
In order to prevent a potential timing attack, it's important to make
sure the password check takes the same amount of time, regardless of
how many characters in the candidate password match the real password.

This commit does increase the verbosity of the authentication check.
Generally it is a good idea for authentication logic to be very clear,
even if that requires some extra verbosity.
2016-04-11 19:36:25 -07:00
Andrew McClure
c99617d6e5 Ensure server_host is respected in configuration.yaml 2016-04-06 18:45:40 -07:00
Fabian Affolter
24b7a7b964 Add source ip to log entry 2016-04-03 00:46:05 -07:00
Paulus Schoutsen
7cb69ae9d9 Make sure we always sent content-length header 2016-03-27 12:15:41 -07:00
Paulus Schoutsen
4cbd49921f Use HTTP 1.1 2016-03-26 19:03:16 -07:00
Fabian Affolter
bb658412c4 Revert "Allow encrypted passwords"
This reverts commit 505b3b198e.
2016-03-19 22:19:08 +01:00
Fabian Affolter
505b3b198e Allow encrypted passwords 2016-03-19 22:15:23 +01:00
Fabian Affolter
c865ff852d Log failed login attempts 2016-03-15 23:40:24 +01:00
Paulus Schoutsen
f8d2da2ace Add content-length header to http resonses 2016-03-12 23:41:00 -08:00
Paulus Schoutsen
13d7f742a7 Add thread names 2016-03-12 16:54:31 -08:00
Fabian Affolter
b534244e40 Fix PEEP257 issues 2016-03-08 17:55:57 +01:00
Fabian Affolter
b8a40457ee Update docstrings to match PEP257 2016-03-07 18:50:30 +01:00
Paulus Schoutsen
e80309c03c Fix imports (using isort) 2016-02-18 21:27:50 -08:00
Philip Lundrigan
fdbb409331 Increase security of using SSL 2016-01-15 13:39:54 -07:00
Paulus Schoutsen
3b7b12bbd5 Make Flake8 happy 2016-01-12 21:53:27 -08:00
Philip Lundrigan
394c87c40b Remove unnecessary condition in write_text 2015-12-31 13:05:24 -07:00
Philip Lundrigan
7d41ce4e46 Switch from json messages to plain text messages 2015-12-30 22:43:32 -07:00
Paulus Schoutsen
027b891052 Add tests for API.stream 2015-12-14 23:20:43 -08:00
Paulus Schoutsen
931f7e8615 Simplify http component 2015-12-12 22:18:38 -08:00
Paulus Schoutsen
39e3a3c463 Bugfix: Allow accessing API via api_password in url 2015-12-06 21:09:49 -08:00
Paulus Schoutsen
98467d0d9f Correct HTTP start log message 2015-12-06 15:13:41 -08:00
Paulus Schoutsen
832674286b Update the http log message with correct url 2015-12-06 14:42:08 -08:00
Paulus Schoutsen
9d8e077acc Add support for keys to HTTP component 2015-12-06 14:19:25 -08:00
Paulus Schoutsen
b33e9fe6d9 Update API object to support SSL 2015-12-06 14:13:35 -08:00
Paulus Schoutsen
f4238ca242 Add SSL support to HA 2015-12-06 14:05:58 -08:00