hakko wrote:I don't think that an SSL connection is so appealing. Partly, I have to admit, this is a user interface issue. Using the self signed certificates (and how many Subsonic users know how to issue a valid certificate for their domain?) has my non-techy friends arrive at a big warning screen saying "This connection cannot be verified" and having them manually accept the certificate and add an exception yada yada. Most people don't get past that.
You do have a point, but until now I have had no problems telling people to just bypass the authentication screen when giving them their username/password. It does feel clumsy, specially if you use the Subsonic redirection service (which redirects to an IP, which will never match a self-signed certificate with a domain name, which means that there is no way to avoid the scare screen in browsers such as Chrome), but it has not been a showstopper in my experience. My gut feeling is that most people would tend to click through without thinking twice, although perhaps your friends are smarter in the security department than mine
Secondly, from a more technical perspective, using SSL feels inefficient for a REST service. SSL/TLS is cheap for a durable HTTP session between two computers. Our scenario is repeated short stateless interactions. Adding the initial handshake/negotiation every time you change directory seems wrong to me, when it would be enough to calculate a hash sum of the request parameters plus a secret key and have the server validate it.
I'm nowhere near being a REST guru, but isn't being stateless one of the key points of REST? There is no way (at least, no obvious way) to avoid the negotiation and remain stateless. Any challenge authentication mechanism needs a different secret key per session (or request) to be valid, so you would need the secret key to be somehow stored on the server and either be generated on the fly for each request/session (implies handshaking, defeats statelessness) or be fixed per user (which would mean that, unless some periodic key-changing mechanism is used, a "captured" REST URL will still be valid even if the user/password is not known). The de facto standard for this would probably be OAuth, which is quite a can of worms to open.
REST over SSL solves most of these problems. I'm not arguing that it's the absolute best solution, but it does get close without needing a major reworking of the authentication system, by delegating the handshaking/encryption to a separate (and well tried) protocol. And, fortunately, it is now perfectly possible to encrypt everything with SSL at negligible computational cost. REST+SSL is (roughly) equivalent to having a separate challenge per request, whereas REST+SSL+persistent connections is roughly equivalent to a separate challenge per session (the ideal behaviour).
Plus the more obscure caveats: URLs normally gets logged by web servers (and you don't want your password written there). If invoked from a browser, it gets cached there too.
Well, Subsonic runs its own server, which means that it can control what it logs (besides, if you can access the Subsonic logs, you already have access to the system). And the Subsonic API allows HTTP Basic authentication to be used, which probably is a more sensible mechanism than passing user/password in the REST URLs. Besides, I don't see any obvious scenario (other than testing) in which manually performing REST calls from a browser is needed.
Lastly, I don't understand how server security can be optional with default value false. If SSL is what keeps unwanted visitors out of your server, then at least make it mandatory?
I agree that this should be enabled by default; the only reason I can think of is the 'scare screen' problem.
By the way, I do agree with your point that a more secure authentication mechanism for apps would be desirable, although I don't think that 4.7 should be the place for it (it needs time to plan, implement, test and provide a sensible deprecation path for the current mechanism). I think that discussing this in a new thread in the 'feature requests' section is probably more sensible.
In order to be constructive, perhaps a good course of action would be providing a handshake within Subsonic - begin all communications by requesting a secret key (unique per session and per user), then provide a hash of the URL + password + secret in the REST request. A 'serial number' (an unique, arbitrary id, with the restriction that every request should have an id greater than all previously passed ids in a given session) could be included to make all URLs unique. This would be reasonably secure, even with two technical weaknesses: it would need the Subsonic server to keep track of the secrets, ids and sessions (which goes against the REST philosophy and might be complicated) and it essentially means replacing the SSL connection with an alternative (and inferior) mechanism. But hey, you need to compromise somewhere.
Best regards