8 ms·
Prior to last year's release of macOS Catalina, OS X shipped with a Dashboard widget to display the weather forecast. In 2019, Apple broke this widget by turnin
by Wowfunhappy 7y ago
Prior to last year's release of macOS Catalina, OS X shipped with a Dashboard widget to display the weather forecast. In 2019, Apple broke this widget by turning off the servers it used.
Luckily, Dashboard widgets are just editable html and javascript files, so I rewrote a portion of Apple's weather widget to use the DarkSky API instead. Since the entire point of this project was to support a legacy feature (the Dashboard), I really wanted it to work on the full gamut of OS X 10.4 Tiger – 10.14 Mojave.
My modified version worked fine on 10.9 and above, but on 10.4 – 10.8, users reported being unable to retrieve any weather data. After some back and forth of looking at logs, I found the problem—old versions of OS X didn't support the modern iteration of HTTPS required by DarkSky. I couldn't fix this, because DarkSky doesn't offer their API via HTTP.
Was this really necessary? Weather forecasts are public information, so what level of safety is provided by HTTPS to the point where it should be not just a default, but the only option for developers?
(Luckily, I had the chance to rectify this when Apple bought DarkSky and forced me to change APIs. I'm now using Weatherbit, which offers HTTP. I would have preferred to use HERE, but like DarkSky, they're HTTPS-only.)
https://forums.macrumors.com/threads/i-fixed-apples-broken-weather-dashboard-widget.2225715/ https://forums.macrumors.com/threads/i-fixed-apples-broken-w...
- dahfizz 7y agoI agree. I treat cyber security a lot like physical security. "Always lock your front door" is good advice, just like "always use https" is good advice. But I'm not going to lock and deadbolt my door if I'm only walking out to grab something from my car and returning immediately.
- nannal 7y agoThe issue is that an MITM attacker can modify the traffic between client and server if it's not protected by HTTPS. They could include a script tag and then run JS in the context of the widget which may have undesirable effects. If the traffic is traveling over a connection you aren't 100% sure you control entirely, wrap it in HTTPS.
- dahfizz 7y agoThat's not a concern for a REST API where you are just grabbing and parsing json data. Even if someone injects some code into the result, it just gets parsed as a string and the worst thing that happens is the widget displays the wrong thing.
- fwip 7y agoUntil somebody finds a vulnerability in your JSON parser or other layers of your stack. :)
- sudosysgen 7y agoThere are inherent, unfixable vulnerabilities to a weather app, such as divulging location information and possibly travel patterns.
- maxwellg 7y agoIf you request weather info for a large range of locations at once - the k-Anonymity that HAVE I BEEN PWNED uses - you could prevent this at the cost of increasing response size dramatically https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/ https://www.troyhunt.com/ive-just-launched-pwned-passwords-v...
- saagarjha 7y agoI don't think that would help much. If my phone tries to get weather data for the prefix "66" and then "a9" and later "8d" and you correlate the cities together, you can be pretty sure I was driving around the Bay Area if the first list contains "Cupertino", the second "San Jose", and the third "Palo Alto".
- maxwellg 7y agoI was thinking less around prefix matching and more around requesting enough data to where an observer couldn't tell what I was really interested in. If I requested 100 distinct locations in every state - 5000 total - you would know I was interested in the United States, but you would have a hard time determining where specifically.
- kn0where 7y agoI spend a lot of time playing with old Macs, and so I’m used to anything internet-related being broken due to TLS or defunct URLs. So, I was pleasantly surprised when installing Mac OS 9 one day that Apple’s NTP servers are still just as they were 20 years ago.
- abrowne 7y agoBut someone could MITM your forecast and tell you it wasn't going to rain, leading you to get soaked for lack of wearing rain gear /s I stopped using the Dashboard weather widget when I realized it was giving me the weather for Minneapolis, Kansas, because it was ignoring the state part of the location, and Kansas comes before Minnesota alphabetically.
- Wowfunhappy 7y ago> I stopped using the Dashboard weather widget when I realized it was giving me the weather for Minneapolis, Kansas, because it was ignoring the state part of the location, and Kansas comes before Minnesota alphabetically. Huh, that's odd—it's absolutely programmed to look at city and state individually. I had to interface with that code in my version. When I type Minneapolis into my version, it correctly displays both cities (alongside Minneapolis, NC) the drop-down, and lets me choose between them. I would have expected the original to do the same thing, but I obviously can't check now.
- abrowne 7y agoSorry, I wasn't clear. This was back in 10.4 or 10.5. I remember seeing Apple had fixed it in a later version like how you describe.
- dexen 7y agoYou bring up an interesting case. On the one hand, we have matter of privacy - people presumably request the forecast for their present location, or their travel destination. This may be sensitive information, depending on personal circumstances. On the other hand, we have usability - in the name of security, people got stopped from using a convenient feature. This seems pretty close to the trouble of planned obsolescence, and seems to be a somewhat common trend, of security running counter to usability and hackability (in the DIY sense).
- Cthulhu_ 7y agoMaybe you have to include a secure access key with every request? Maybe DarkSky sets a cookie that they do not want anyone to be able to intercept or manipulate? HTTPS by default is good, because you don't know what could go wrong. What if there's a security vulnerability in the dashboard widget that someone who can intercept and manipulate the response can abuse?
- evil-olive 7y agoCorrect, for DarkSky the API key is embedded in the request URL [0]. Their pricing is generous (1000 requests/day are free, after than $1 per 10,000 requests) but there is definitely the risk that traffic over HTTP could have the URL sniffed, and then be used to make charges on that customer's behalf. 0: https://darksky.net/dev/docs https://darksky.net/dev/docs
- earthboundkid 7y agoFetching a weather forecast reveals that I was in a certain location. Depending on circumstances, that could easily be incriminating evidence. Yes, Dark Sky should be HTTPS by default.
- cguess 7y agoAlso could imply where you're going to. Looking up the weather in London (if I don't normally) almost certainly entails a trip. This is pretty deep down the threat modeling hole though, and no, normal people don't need to care about this.
- bowmessage 7y agoNormal people don't even know what HTTPS means!
- kstrauser 7y agoThat's why we like to use it everywhere: to protect the people who didn't know they needed protection.
- bowmessage 7y agoYeah, +1, what I meant to convey too :)
- SilasX 7y agoWhat, you don't bombard weather APIs with dummy requests about random cities so as to obscure where you might be going?
- brewdad 7y agoWhen baseball season is actually occurring I will sometimes look up weather in a half dozen cities around the country to get an idea of which games might get rained out. Not exactly the same thing but I'm not actually traveling to any of them.
- freefriedrice 7y ago> the modern iteration of HTTPS required by DarkSky. I don't follow. The TLS handshake negotiates the appropriate ciphersuite. With the exception of dropping SHA1 in TLSv1.3, how was the macOS SSL module not able to negotiate a handshake? There should be plenty of suites available. What did Darksky ask for in the TLS handshake??? For example: I'm still running Mojave, and here's what I see from the handshake with the Darksky.net site on :443 ... : : issuer=C = US, O = Amazon, OU = Server CA 1B, CN = Amazon --- No client certificate CA names sent Peer signing digest: SHA512 Peer signature type: RSA Server Temp Key: ECDH, P-256, 256 bits --- SSL handshake has read 5538 bytes and written 439 bytes Verification: OK --- New, TLSv1.2, Cipher is ECDHE-RSA-AES128-GCM-SHA256 : : : They aren't even using TLS1.3 on the main page.
- Wowfunhappy 7y agoKeep in mind that Mountain Lion is a lot older than Mojave. If I go to SSL labs and test DarkSky.net, it shows a "protocol mismatch" for Mountain Lion and older, which is exactly what I saw with the widget: https://www.ssllabs.com/ssltest/analyze.html?d=darksky.net&s=52.202.200.76&latest https://www.ssllabs.com/ssltest/analyze.html?d=darksky.net&s... (scroll down to "not simulated clients" and click "expand). I don't actually understand that much about the internals of https, but my assumption is that there weren't any cipher suites supported by both DarkSky and Mountain Lion.
- freefriedrice 7y agoWow, that's really cool. Googling around it appears that Mountain Lion wasn't upgraded to TLSv1.2 so any website that upgraded to TLSv1.1 broke on pre-Yosemite. I didn't realize this. Very interesting.
- Wowfunhappy 7y ago> any website that upgraded to TLSv1.1 broke on pre-Yosemite. Tiny addendum, what I saw was different by one version: DarkSky worked fine in Mavericks, just not Mountain Lion.
- 7y ago
- MaxBarraclough 7y ago> Weather forecasts are public information, so what level of safety is provided by HTTPS to the point where it should be not just a default, but the only option for developers? Even if it's public information, you should protect against an attacker modifying the payload to exploit a weakness in your browser/application, and to protect against any any other kind of unauthorised modification of the payload. (I see Cthulhu_ already mentioned this.) We've discussed the non-obvious advantages of HTTPS before. [0][1] There's a reason Netflix encrypt video streams. I agree it's probably not worth breaking existing applications to encrypt the weather data, but it's worth doing going forward. [0] https://news.ycombinator.com/item?id=22933774 https://news.ycombinator.com/item?id=22933774 (Forgive me linking to my own comments) [1] https://news.ycombinator.com/item?id=21912817 https://news.ycombinator.com/item?id=21912817
- divbzero 7y agoCould you have bypassed DarkSky’s TLS version requirements by proxying the API requests through Cloudflare or some other TLS forward proxy?
- Wowfunhappy 7y agoYou can use a proxy, yes. The workaround I suggested to users on OS X 10.4 – 10.8 was to set up a web server with the following PHP file: <? header('Access-Control-Allow-Origin: *'); $url = $_GET['url']; echo file_get_contents($url); And then edit the dashboard widget's API request url to point to: http://theWebServer.com/thePhpFile.php?url=https://darkSkyURL But, this required users to have access to a web server. I very briefly considered setting up a public instance, but I'm not a professional web developer and didn't know what the implications would be, either for the overall security of my server, or in bandwidth costs, particularly if malicious users started using the "proxy" for other things. All of the client-side code is out in the open, so it also wasn't clear how I'd make an authentication scheme. I'm sure there's a way, but again, not a web developer!
- laughinghan 7y agoI think the suggestion is to skip a web server at all and go "serverless" with Cloudflare Workers, which are free for up to 100,000 requests/day: https://workers.cloudflare.com/ https://workers.cloudflare.com/ If your Worker code hardcodes the Dark Sky domain, the worst an attacker could do is either use up your free worker quota from Cloudflare, or hammer Dark Sky at the Worker ratelimit (1,000/minute, which Dark Sky should easily handle). AWS, Azure, GCP all also have free tiers for their serverless services. RunKit (http://runkit.com http://runkit.com) might also work. These are all likely to be HTTPS-only, but hopefully at least one of them supports TLS v1.1, rather than being 1.2-only like apparently is the problem with Dark Sky.
- divbzero 7y agoServerless would work but my initial idea was more basic, simply a combination of something like: A. DNS record (foo.example.com CNAME api.darksky.net) B. TLS forward proxy (e.g. Cloudflare Full SSL https://www.cloudflare.com/ssl/ https://www.cloudflare.com/ssl/) C. Host header rewrite (e.g. Cloudflare Page Rules https://support.cloudflare.com/hc/en-us/articles/206652947-Using-Page-Rules-to-Re-Write-Host-Headers https://support.cloudflare.com/hc/en-us/articles/206652947-U...)
- Mandatum 7y agoYeah, I regularly ask clients to drop TLS support for their public-facing API's that aren't consumed by the browser. These are the same clients that shared a public-facing FTP server to partners to allow them to retrieve catalogue's of prices and product descriptions. The admin of having to rotate keys and help customers with their TLS and SSL related problems (which is many in Enterprise, Java 5 and 6 is fucking rampant still) just isn't worth it. Yes, someone could MitM the connection. Do we care? No. The data has very little consequences if it's corrupted.